Sync computers
This commit is contained in:
21
src/main.rs
21
src/main.rs
@@ -4,7 +4,7 @@
|
||||
//! scheduler, and logging), and starts initial processes.
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
#![allow(static_mut_refs)]
|
||||
// #![warn(clippy::pedantic)]
|
||||
#![feature(
|
||||
riscv_ext_intrinsics,
|
||||
const_trait_impl,
|
||||
@@ -20,11 +20,10 @@ use embedded_alloc::LlffHeap as Heap;
|
||||
use log::info;
|
||||
|
||||
use crate::{
|
||||
fs::FILE_SYSTEM,
|
||||
fs::FAT32_FILE_SYSTEM,
|
||||
io::init_log,
|
||||
process::{create_process, create_process_from_file},
|
||||
riscv::enable_supervisor_interrupt,
|
||||
scheduler::{idle, scheduler_init},
|
||||
scheduler::{idle, SCHEDULER},
|
||||
user::{proc2, test},
|
||||
vga::{Color, Vga},
|
||||
};
|
||||
@@ -39,11 +38,13 @@ mod panic_handler;
|
||||
mod process;
|
||||
mod riscv;
|
||||
mod scheduler;
|
||||
mod sync;
|
||||
mod syscall;
|
||||
mod time;
|
||||
mod uart;
|
||||
mod user;
|
||||
mod vga;
|
||||
mod virtual_fs;
|
||||
|
||||
pub const HEAP_SIZE: usize = 1024 * 1024 * 32; // 32Mo RAM
|
||||
#[global_allocator]
|
||||
@@ -58,17 +59,19 @@ pub extern "C" fn supervisor_mode_entry() {
|
||||
embedded_alloc::init!(HEAP, HEAP_SIZE);
|
||||
init_log().unwrap();
|
||||
Vga::init();
|
||||
FILE_SYSTEM.init();
|
||||
scheduler_init();
|
||||
FAT32_FILE_SYSTEM.init();
|
||||
SCHEDULER.lock().init();
|
||||
}
|
||||
|
||||
info!("Hello World !");
|
||||
unsafe { Vga::draw_string(10, 10, "Hello World !", Color::WHITE, Color::BLACK) };
|
||||
|
||||
create_process(Box::new(test), "proc1");
|
||||
create_process(Box::new(proc2), "proc2");
|
||||
SCHEDULER.lock().create_process(Box::new(test), "proc1");
|
||||
SCHEDULER.lock().create_process(Box::new(proc2), "proc2");
|
||||
|
||||
create_process_from_file("/usr/bin/test_pic");
|
||||
SCHEDULER
|
||||
.lock()
|
||||
.create_process_from_file("/usr/bin/test_pic");
|
||||
|
||||
enable_supervisor_interrupt();
|
||||
idle();
|
||||
|
||||
Reference in New Issue
Block a user