From ba667148af04963f5d70c647511ea1fad1add21d Mon Sep 17 00:00:00 2001 From: salmonik Date: Fri, 31 Jul 2026 16:01:46 +0200 Subject: power: proper shutdown via UEFI ResetSystem (ACPI S5) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - uefi.rs: full EFI_RUNTIME_SERVICES layout with reset_system at index 10 (spec order); EfiResetSystem type + RESET_* constants - power.rs: stash the runtime-services table pre-EBS; poweroff() calls ResetSystem(EfiResetShutdown) — still callable after ExitBootServices because we never call SetVirtualAddressMap, so the pointers keep working with physical addresses; falls back to the hlt loop - shell: 'poweroff' and 'exit' shut the machine down (QEMU exits), 'halt' keeps the plain hlt loop --- rsdos/src/main.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'rsdos/src') diff --git a/rsdos/src/main.rs b/rsdos/src/main.rs index 1169785..d9578e2 100644 --- a/rsdos/src/main.rs +++ b/rsdos/src/main.rs @@ -37,6 +37,9 @@ pub extern "efiapi" fn efi_main(image_handle: Handle, system_table: *mut SystemT let bs = unsafe { &mut *st.boot_services }; let con_out = unsafe { &mut *st.con_out }; + // Keep the runtime-services table for later (ResetSystem → poweroff). + rsnix::power::init(st.runtime_services); + // ---- Phase 1: UEFI boot services alive ---- // Print banner via UEFI console -- cgit v1.2.3