feat: userspace round-trip — syscall stubs, ecall dispatch, U-mode entry and exit on QEMU
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user