refactor(adapter-riscv): restructure into hw/, mmu/, trap/ modules with board constants

Add Priority::DEFAULT and TimeSlice::DEFAULT to types crate.
All QEMU virt addresses consolidated in board.rs.
Structure mirrors future adapter-arm/ layout.
This commit is contained in:
2026-10-18 02:05:57 +02:00
parent 66a730b2fe
commit d327794d33
13 changed files with 100 additions and 109 deletions

View File

@@ -0,0 +1,19 @@
use super::page_table::{PageTable, PAGE_SIZE};
// Boot-time bump allocator for page tables.
// Only used during init before the scheduler starts.
static mut NEXT_FREE: usize = 0;
pub fn init_allocator(start: usize) {
unsafe { NEXT_FREE = start; }
}
pub fn alloc_page_table() -> &'static mut PageTable {
unsafe {
let addr = NEXT_FREE;
NEXT_FREE += PAGE_SIZE;
let table = &mut *(addr as *mut PageTable);
table.zero();
table
}
}