Try loading code at runtime

This commit is contained in:
2026-02-13 17:22:23 +01:00
parent a53e11d6dd
commit 27a3847c13
28 changed files with 96 additions and 144 deletions

View File

@@ -1,69 +0,0 @@
#![no_std]
#![no_main]
#![allow(static_mut_refs)]
#![feature(
riscv_ext_intrinsics,
const_trait_impl,
iter_map_windows,
str_from_raw_parts,
macro_metavar_expr,
macro_metavar_expr_concat
)]
use embedded_alloc::LlffHeap as Heap;
use log::info;
use crate::{
io::init_log,
process::create_process,
riscv::enable_supervisor_interrupt,
scheduler::{idle, scheduler_init},
tests_fat::MemoryDisk,
user::{proc2, test},
vga::{Color, Vga},
};
extern crate alloc;
mod boot;
mod critical_section;
mod interrupt;
mod io;
mod panic_handler;
mod process;
mod riscv;
mod scheduler;
mod syscall;
mod tests_fat;
mod time;
mod uart;
mod user;
mod vga;
pub const HEAP_SIZE: usize = 4096;
#[global_allocator]
static HEAP: Heap = Heap::empty();
// Usize is assumed to be an u64 in the whole kernel
const _: () = assert!(size_of::<usize>() == size_of::<u64>());
#[unsafe(no_mangle)]
pub extern "C" fn supervisor_mode_entry() {
unsafe {
embedded_alloc::init!(HEAP, HEAP_SIZE);
init_log().unwrap();
Vga::init();
scheduler_init();
// enable_supervisor_interrupt();
}
info!("Hello World !");
unsafe { Vga::draw_string(10, 10, "Hello World !", Color::WHITE, Color::BLACK) };
create_process(test, "proc1");
create_process(proc2, "proc2");
MemoryDisk::new();
enable_supervisor_interrupt();
idle();
}