diff options
| author | salmonik <salmonik@tuta.io> | 2026-07-31 15:49:31 +0200 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-07-31 15:49:31 +0200 |
| commit | ee1c85bfcba17a120bbc95fb2399485295affb76 (patch) | |
| tree | 85cae4ab45652f6427046a5eb8173819eef0d5a7 | |
| parent | feat(rsboot): initial commit — UEFI bootloader extracted from RNG (diff) | |
| download | rsboot-ee1c85bfcba17a120bbc95fb2399485295affb76.tar.gz rsboot-ee1c85bfcba17a120bbc95fb2399485295affb76.zip | |
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.
| -rw-r--r-- | main.c | 5 |
1 files changed, 4 insertions, 1 deletions
| @@ -31,7 +31,10 @@ static u64 allocate_pages(efi_boot_services *b, u64 mt, u64 np, u64 *a) { | |||
| 31 | } | 31 | } |
| 32 | static u8 *rf(efi_boot_services *b, efi_file_protocol *f, u64 *sz, u64 mx) { | 32 | static u8 *rf(efi_boot_services *b, efi_file_protocol *f, u64 *sz, u64 mx) { |
| 33 | u64 np = (mx + 4095) / 4096, a; | 33 | u64 np = (mx + 4095) / 4096, a; |
| 34 | if (allocate_pages(b, 6, np, &a)) return 0; | 34 | /* LoaderData (2): scratch buffers for the OS loader, reclaimable by the |
| 35 | * OS once it takes control. Type 6 (RuntimeData) would mark them as | ||
| 36 | * runtime-services memory that must survive forever. */ | ||
| 37 | if (allocate_pages(b, 2, np, &a)) return 0; | ||
| 35 | u8 *d = (u8 *)a; | 38 | u8 *d = (u8 *)a; |
| 36 | u64 r = mx; | 39 | u64 r = mx; |
| 37 | if (f->read(f, &r, d) && r != mx) return 0; | 40 | if (f->read(f, &r, d) && r != mx) return 0; |
