make the swapper register immediately

this means we miss fewer advisories at boot
This commit is contained in:
bunnie 2024-03-16 18:54:51 +08:00
parent ed5dd7e538
commit 10c4ab80c8

View file

@ -158,21 +158,14 @@ fn swap_handler(
}
fn main() {
// init the log, but this is mostly unused.
log_server::init_wait().unwrap();
log::set_max_level(log::LevelFilter::Info);
log::info!("my PID is {}", xous::process::id());
// swapper is not allowed to use `log` for debugging under most circumstances, because
// the swapper can't send messages when handling a swap call. Instead, we use a local
// debug UART to handle this. This needs to be enabled with the "debug-print" feature
// and is mutually exclusive with the "gdb-stub" feature in the kernel since it uses
// the same physical hardware.
let mut ss = SwapperSharedState::new();
write!(ss.duart, "Swapper started.\n\r").ok();
let sid = xous::create_server().unwrap();
// Register the swapper with the kernel. Written as a raw syscall, since this is
// the only instance of its use (no point in use-once code to wrap it).
let (s0, s1, s2, s3) = sid.to_u32();
@ -208,6 +201,13 @@ fn main() {
// correctly
let rpt = unsafe { &mut *(rpt_init as *mut RuntimePageTracker) };
// init the log, but this is mostly unused.
log_server::init_wait().unwrap();
log::set_max_level(log::LevelFilter::Info);
log::info!("my PID is {}", xous::process::id());
// test the debug serial port
write!(ss.duart, "Swapper started.\n\r").ok();
let mut msg_opt = None;
loop {
xous::reply_and_receive_next(sid, &mut msg_opt).unwrap();