From c7d92071e1dd11c45999457b16554b4abaa73b28 Mon Sep 17 00:00:00 2001 From: salmonik Date: Sun, 2 Aug 2026 15:21:34 +0200 Subject: v0.5.5: crash reports go to a dedicated CRASHLOG USB stick The fault handler now writes crash.log to the volume labeled CRASHLOG (label-selected via fat::crash_vol), falling back to slot 0. On real hardware the boot USB may be unwritable, so a second stick labeled CRASHLOG survives the write; the shell auto-prints the previous crash report from it at next boot (read_crash_log resolves /disk//crash.log through the FAT path, since Disk nodes hold no cached children). - fat.rs: volume_label() + crash_vol() (no allocation) - fs.rs: write_crash_log targets crash_vol(); read_crash_log prefers the CRASHLOG disk node; drop now-unused first_disk() - mkdisk.sh: --label option - test-fault.sh: boots with a dedicated CRASHLOG stick (mkfs -F 32 -n CRASHLOG), verifies crash.log lands there and NOT on the ESP --- rsnix/src/uefi.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'rsnix/src/uefi.rs') diff --git a/rsnix/src/uefi.rs b/rsnix/src/uefi.rs index c311ad9..234ad65 100644 --- a/rsnix/src/uefi.rs +++ b/rsnix/src/uefi.rs @@ -40,6 +40,32 @@ pub const EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID: Guid = Guid { d: [0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a], }; +pub const EFI_LOADED_IMAGE_PROTOCOL_GUID: Guid = Guid { + a: 0x5b1b31a1, + b: 0x9562, + c: 0x11d2, + d: [0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b], +}; + +/// Minimal EFI_LOADED_IMAGE_PROTOCOL — we only need the image base/size +/// to reserve the kernel's own code/data/bss pages so the heap and page +/// allocators can never overwrite the running kernel. +#[repr(C)] +pub struct LoadedImageProtocol { + pub revision: u32, + _pad0: u32, + pub parent_handle: Handle, + pub system_table: *mut core::ffi::c_void, + pub device_handle: Handle, + pub file_path: *mut core::ffi::c_void, + _reserved: *mut core::ffi::c_void, + pub load_options_size: u32, + _pad1: u32, + pub load_options: *mut core::ffi::c_void, + pub image_base: *mut core::ffi::c_void, + pub image_size: u64, +} + // --------------------------------------------------------------------------- // Table header // --------------------------------------------------------------------------- -- cgit v1.2.3