Perform the shutdown with some port IO in an emulator-specific method. Signed-off-by: greatbridf <greatbridf@icloud.com>
@@ -32,6 +32,7 @@ fn set_arch_config(config: &str) {
fn set_arch_configs_x86() {
set_arch_config("has_stacktrace");
+ set_arch_config("has_shutdown");
}
fn set_arch_configs_riscv64() {
@@ -538,3 +538,14 @@ pub unsafe extern "C" fn start_64bit() {
options(att_syntax)
)
+
+pub fn shutdown() -> ! {
+ unsafe {
+ core::arch::asm!(
+ "mov $0x2000, %ax",
+ "mov $0x604, %dx",
+ "outw %ax, %dx",
+ options(att_syntax, nomem, noreturn)
+ );
+ }
+}