5897eefc3a
The local/sources/kernel fork at 1be659b adds the
hardware-agnostic S3 resume trampoline (Phase II.X):
* Saves the CPU state (general-purpose registers,
segment registers, RFLAGS, RSP, RIP, CR3) to a static
S3State struct in `enter_s3()`.
* Adds a 64-bit `naked_asm!` trampoline
(`s3_resume::s3_trampoline`) that the platform
firmware jumps to on S3 wake. The trampoline:
- Verifies the magic value (0x123456789abcdef0) in
S3_STATE.saved_magic (a la Linux's
`arch/x86/kernel/acpi/wakeup_64.S`)
- Restores ds/es/fs/gs/ss to __KERNEL_DS
- Restores CR3 (page table base)
- Restores RSP, RFLAGS
- Restores 13 general-purpose registers
- Sets the RESUMING_FROM_S3 flag
- Pushes saved RIP onto the stack and uses `ret`
* Exposes `s3_resume_address()` that acpid writes
to FACS.waking_vector.
* Exposes `s3_state_valid()` that the kernel checks
during boot to determine if this is a cold boot
or a resume from S3.
Hardware-agnostic: works on any x86_64 system with
standard ACPI S3 support (Dell, HP, Lenovo, LG Gram 14).
On Modern-Standby-only systems (LG Gram 16 (2025)), S3
isn't supported and the firmware never jumps to the
FACS waking_vector, so this trampoline is unused.
Build: redbear-mini.iso (512 MB) builds successfully.
The S3 resume path is verified to compile and be
present in the ISO. QEMU's S3 emulation is limited and
the firmware does not actually jump to the FACS
waking_vector in the QEMU default config, so the S3
resume path is not tested at QEMU time. The acpid <-> kernel
wiring via FACS.waking_vector is the next step (separate
Phase II.X.W commit).
base
@ aadf55bfca
bootloader
@ 3cc7ed909c
ctrlc
@ 3d2b25113a
installer
@ 8d1bad9eb4
libpciaccess
@ 1c33262e23
redox-drm
@ 02b05407fe
redoxfs
@ ab50acfcc7
relibc
@ a725e6ac8c
sysinfo
@ ee923581fb
userutils
@ 5dc4a8364e