feat: userspace round-trip — syscall stubs, ecall dispatch, U-mode entry and exit on QEMU

This commit is contained in:
2026-10-18 02:15:35 +02:00
parent 450d74d07f
commit 570fe22bee
11 changed files with 322 additions and 115 deletions

View File

@@ -8,12 +8,19 @@ pub fn init_allocator(start: usize) {
unsafe { NEXT_FREE = start; }
}
pub fn alloc_page_table() -> &'static mut PageTable {
pub fn alloc_zeroed_page() -> usize {
unsafe {
let addr = NEXT_FREE;
NEXT_FREE += PAGE_SIZE;
core::ptr::write_bytes(addr as *mut u8, 0, PAGE_SIZE);
addr
}
}
pub fn alloc_page_table() -> &'static mut PageTable {
unsafe {
let addr = alloc_zeroed_page();
let table = &mut *(addr as *mut PageTable);
table.zero();
table
}
}