axhal/platform/x86_pc/
misc.rs1use x86_64::instructions::port::PortWriteOnly;
2
3pub fn terminate() -> ! {
7 info!("Shutting down...");
8
9 #[cfg(platform = "x86_64-pc-oslab")]
10 {
11 axlog::ax_println!("System will reboot, press any key to continue ...");
12 let mut buffer = [0u8; 1];
13 while super::console::read_bytes(&mut buffer) == 0 {}
14 axlog::ax_println!("Rebooting ...");
15 unsafe { PortWriteOnly::new(0x64).write(0xfeu8) };
16 }
17
18 #[cfg(platform = "x86_64-qemu-q35")]
19 unsafe {
20 PortWriteOnly::new(0x604).write(0x2000u16)
21 };
22
23 crate::arch::halt();
24 warn!("It should shutdown!");
25 loop {
26 crate::arch::halt();
27 }
28}