Patched everything for aarch64, aside from scheduler, add more linker

points to aarch64 ld, add aarch64 heap, init, page tables and usermode,
make hhdm_offset a global atomic, aarch64 uses semihosting for output,
add generic PageTable type, add a function that creates and maps pages,
use allow to remove warnings, add a bufwriter so kernel panic always
works
This commit is contained in:
csd4ni3l
2026-05-16 00:30:01 +02:00
parent 17f2a3c7e4
commit 812d4cf6d4
32 changed files with 911 additions and 405 deletions
+10 -1
View File
@@ -86,7 +86,6 @@ impl Locked<Scheduler> {
};
}
#[cfg(target_arch = "x86_64")]
pub fn switch_to(&self, pid: u64, should_swapgs: bool) {
let (ctx_opt, entry, stack_top) = {
let mut guard = safe_lock(|| self.lock());
@@ -117,7 +116,9 @@ impl Locked<Scheduler> {
set_current_pid(Some(pid));
match ctx_opt {
#[allow(unused_variables, unused_unsafe)]
Some(saved_ctx) => unsafe {
#[cfg(target_arch = "x86_64")]
run_next((&saved_ctx) as *const UserContext, saved_ctx.rsp)
},
None => enter_usermode(entry as u64, (stack_top & !0xF) - 8, should_swapgs),
@@ -163,3 +164,11 @@ unsafe fn run_next(ctx: *const UserContext, user_rsp: u64) {
"sysretq",
);
}
#[cfg(target_arch = "aarch64")]
#[unsafe(naked)]
#[unsafe(no_mangle)]
unsafe fn run_next(ctx: *const UserContext, user_rsp: u64) {
// TODO: add switching logic
core::arch::naked_asm!("udf #0");
}