diff --git a/kernel/src/arch/aarch64/cpu.rs b/kernel/src/arch/aarch64/cpu.rs index 58d10f9..93457ae 100644 --- a/kernel/src/arch/aarch64/cpu.rs +++ b/kernel/src/arch/aarch64/cpu.rs @@ -7,6 +7,6 @@ pub fn id() -> usize { 0 } -pub fn exit_in_qemu(error_code: u8) -> ! { +pub unsafe fn exit_in_qemu(error_code: u8) -> ! { unimplemented!() } diff --git a/kernel/src/arch/riscv32/cpu.rs b/kernel/src/arch/riscv32/cpu.rs index fbee91f..315897d 100644 --- a/kernel/src/arch/riscv32/cpu.rs +++ b/kernel/src/arch/riscv32/cpu.rs @@ -36,6 +36,6 @@ pub fn halt() { unsafe { riscv::asm::wfi() } } -pub fn exit_in_qemu(error_code: u8) -> ! { +pub unsafe fn exit_in_qemu(error_code: u8) -> ! { super::sbi::shutdown() } diff --git a/kernel/src/syscall/misc.rs b/kernel/src/syscall/misc.rs index 07c2211..d422e0f 100644 --- a/kernel/src/syscall/misc.rs +++ b/kernel/src/syscall/misc.rs @@ -117,7 +117,9 @@ const LINUX_REBOOT_CMD_HALT: u32 = 0xcdef0123; pub fn sys_reboot(magic: u32, magic2: u32, cmd: u32, arg: *const u8) -> SysResult { // we will skip verifying magic if cmd == LINUX_REBOOT_CMD_HALT { - cpu::exit_in_qemu(1); + unsafe { + cpu::exit_in_qemu(1); + } } Ok(0) }