summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2023-09-05 16:25:05 -0400
committerPeter Jones <pjones@redhat.com>2023-12-05 13:20:00 -0500
commit6f0c8d2c920c82359f231205b26eb4ddd3718e1d (patch)
tree417cae150af8f70c3856011a582ffc0cd6a1e271
parent0226b56513b2b8bd5fd281bce77c40c9bf07c66d (diff)
downloadefi-boot-shim-6f0c8d2c920c82359f231205b26eb4ddd3718e1d.tar.gz
efi-boot-shim-6f0c8d2c920c82359f231205b26eb4ddd3718e1d.zip
Print errors when setting/clearing memory attrs
When working on issues with the memory attributes API, shim does not currently display any errors which are returned from the API itself. This adds those error messages. Resolves #575 Signed-off-by: Peter Jones <pjones@redhat.com>
-rw-r--r--pe.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/pe.c b/pe.c
index b3a9d46f..33056017 100644
--- a/pe.c
+++ b/pe.c
@@ -498,10 +498,20 @@ update_mem_attrs(uintptr_t addr, uint64_t size,
uefi_clear_attrs = shim_mem_attrs_to_uefi_mem_attrs (clear_attrs);
dprint("translating clear_attrs from 0x%lx to 0x%lx\n", clear_attrs, uefi_clear_attrs);
efi_status = EFI_SUCCESS;
- if (uefi_set_attrs)
+ if (uefi_set_attrs) {
efi_status = proto->SetMemoryAttributes(proto, physaddr, size, uefi_set_attrs);
- if (!EFI_ERROR(efi_status) && uefi_clear_attrs)
+ if (EFI_ERROR(efi_status)) {
+ dprint(L"Failed to set memory attrs:0x%0x physaddr:0x%llx size:0x%0lx status:%r\n",
+ uefi_set_attrs, physaddr, size, efi_status);
+ }
+ }
+ if (!EFI_ERROR(efi_status) && uefi_clear_attrs) {
efi_status = proto->ClearMemoryAttributes(proto, physaddr, size, uefi_clear_attrs);
+ if (EFI_ERROR(efi_status)) {
+ dprint(L"Failed to clear memory attrs:0x%0x physaddr:0x%llx size:0x%0lx status:%r\n",
+ uefi_clear_attrs, physaddr, size, efi_status);
+ }
+ }
ret = efi_status;
efi_status = get_mem_attrs (addr, size, &after);