mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
remove code bits now that all syscalls are re-entrant
previously we could re-enter into a process through a divergent call into the swapper. Now, we only ever re-enter as a syscall through the syscall interface. in order to make this happen we had to store all the thread and stack state for the handler so we can do a re-entrant syscall, but I think this is worth it. makes the code so much better.
This commit is contained in:
parent
8ce2ac566a
commit
747e07c90f
1 changed files with 15 additions and 27 deletions
|
|
@ -54,12 +54,6 @@ pub fn disable_all_irqs() {
|
||||||
sim_write(0x0);
|
sim_write(0x0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used by the swapper to put the correct value into SIM_BACKING, because
|
|
||||||
/// on recovery from OOM we may skip the read from swap pre-amble that would
|
|
||||||
/// normally set this up.
|
|
||||||
#[cfg(feature = "swap")]
|
|
||||||
pub fn set_sim_backing(sim: usize) { SIM_BACKING.store(sim, Ordering::SeqCst); }
|
|
||||||
|
|
||||||
/// Enable external interrupts
|
/// Enable external interrupts
|
||||||
#[export_name = "_enable_all_irqs"]
|
#[export_name = "_enable_all_irqs"]
|
||||||
pub extern "C" fn enable_all_irqs() {
|
pub extern "C" fn enable_all_irqs() {
|
||||||
|
|
@ -381,27 +375,21 @@ pub extern "C" fn trap_handler(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if response == xous_kernel::Result::ResumeProcess {
|
ArchProcess::with_current_mut(|p| {
|
||||||
ArchProcess::with_current_mut(|process| {
|
let thread = p.current_thread();
|
||||||
// re-enable IRQs as late as possible
|
#[cfg(feature = "debug-swap-verbose")]
|
||||||
enable_all_irqs();
|
println!(
|
||||||
crate::arch::syscall::resume(current_pid().get() == 1, process.current_thread())
|
"Swapper syscall returning to address {:08x} in pid {}.{}",
|
||||||
});
|
thread.sepc,
|
||||||
} else {
|
p.pid().get(),
|
||||||
ArchProcess::with_current_mut(|p| {
|
p.current_tid(),
|
||||||
let thread = p.current_thread();
|
);
|
||||||
#[cfg(feature = "debug-swap-verbose")]
|
// this is necessary because ClearMemoryNow diverges on this path instead of
|
||||||
println!(
|
// cleaning exiting out of its entry point. Means every thunk out has to check
|
||||||
"Swapper syscall returning to address {:08x} in pid {}.{}",
|
// this special case, even though it's rare...
|
||||||
thread.sepc,
|
Swap::with_mut(|s| s.clearmem_restore_irq());
|
||||||
p.pid().get(),
|
unsafe { _xous_syscall_return_result(&response, thread) };
|
||||||
p.current_tid(),
|
});
|
||||||
);
|
|
||||||
// re-enable IRQs as late as possible
|
|
||||||
enable_all_irqs();
|
|
||||||
unsafe { _xous_syscall_return_result(&response, thread) };
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle faulted instruction pages, because we can now actually have instruction pages that are
|
// Handle faulted instruction pages, because we can now actually have instruction pages that are
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue