Allow SBI system_reset to fail
This commit is contained in:
parent
2f568d5e73
commit
902106eb2e
|
|
@ -14,9 +14,17 @@ pub enum QemuExitCode {
|
|||
/// Exit QEMU with the given exit code.
|
||||
pub fn exit_qemu(exit_code: QemuExitCode) -> ! {
|
||||
log::debug!("exit qemu with exit code {exit_code:?}");
|
||||
match exit_code {
|
||||
let error_code = match exit_code {
|
||||
QemuExitCode::Success => sbi_rt::system_reset(sbi_rt::Shutdown, sbi_rt::NoReason),
|
||||
QemuExitCode::Failed => sbi_rt::system_reset(sbi_rt::Shutdown, sbi_rt::SystemFailure),
|
||||
};
|
||||
unreachable!("qemu does not exit");
|
||||
|
||||
log::error!(
|
||||
"SBI system_reset cannot shut down the underlying machine, error code: {:#?}",
|
||||
error_code
|
||||
);
|
||||
|
||||
loop {
|
||||
riscv::asm::wfi();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue