From ee1c85bfcba17a120bbc95fb2399485295affb76 Mon Sep 17 00:00:00 2001 From: salmonik Date: Fri, 31 Jul 2026 15:49:31 +0200 Subject: fix(memory): allocate file buffers as LoaderData (2), not RuntimeData (6) The bzImage and initramfs read buffers were allocated with EfiRuntimeServicesData (6), marking them as runtime-services memory that the OS must preserve forever. As OS-loader scratch they should be EfiLoaderData (2): reclaimable once the OS takes control. --- main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index d28a337..92e4a99 100644 --- a/main.c +++ b/main.c @@ -31,7 +31,10 @@ static u64 allocate_pages(efi_boot_services *b, u64 mt, u64 np, u64 *a) { } static u8 *rf(efi_boot_services *b, efi_file_protocol *f, u64 *sz, u64 mx) { u64 np = (mx + 4095) / 4096, a; - if (allocate_pages(b, 6, np, &a)) return 0; + /* LoaderData (2): scratch buffers for the OS loader, reclaimable by the + * OS once it takes control. Type 6 (RuntimeData) would mark them as + * runtime-services memory that must survive forever. */ + if (allocate_pages(b, 2, np, &a)) return 0; u8 *d = (u8 *)a; u64 r = mx; if (f->read(f, &r, d) && r != mx) return 0; -- cgit v1.2.3