Mark EFI image .text section as writable.

The EFI image .text section is taken from memtest_shared.bin, which is
a combined code and data section. Some recent UEFI BIOSs set the page
protection attributes when loading EFI images, so we need to mark this
section as both executable and writable to prevent page faults.

Fixes issue #413 and should fix issue #377.
This commit is contained in:
Martin Whitaker 2024-08-10 16:11:08 +01:00
parent 771d6d4dca
commit e38ad8e6a4
1 changed files with 2 additions and 1 deletions

View File

@ -7,7 +7,7 @@
// end of the boot sector), with the remainder of the header being provided by
// setup.S.
//
// Copyright (C) 2020-2023 Martin Whitaker.
// Copyright (C) 2020-2024 Martin Whitaker.
//
// Derived from Linux 5.6 arch/x86/boot/header.S:
//
@ -190,6 +190,7 @@ section_table:
.word 0 # NumberOfRelocations
.word 0 # NumberOfLineNumbers
.long IMAGE_SCN_MEM_READ \
| IMAGE_SCN_MEM_WRITE \
| IMAGE_SCN_MEM_EXECUTE \
| IMAGE_SCN_CNT_CODE # Characteristics (section flags)