Skip to content

Commit 4df1899

Browse files
jongwuvathpela
authored andcommitted
pe: Enhance debug report for update_mem_attrs
When memory attributes cannot be updated due to misalignment with 4K or when the size is 0, the debug printout lacks sufficient clarity to indicate the issue. To enhance troubleshooting, it is crucial to generate an error log that explicitly states the failure to execute the expected action. This error log will be visible even when the debug level log is not enabled, thereby significantly reducing debugging time. Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
1 parent e42c319 commit 4df1899

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pe.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ update_mem_attrs(uintptr_t addr, uint64_t size,
480480
&before, efi_status);
481481

482482
if (!IS_PAGE_ALIGNED(physaddr) || !IS_PAGE_ALIGNED(size) || size == 0) {
483-
dprint(L"%a called on 0x%llx-0x%llx (size 0x%llx) +%a%a%a -%a%a%a\n",
483+
perror(L"Invalid call %a(addr:0x%llx-0x%llx, size:0x%llx, +%a%a%a, -%a%a%a)\n",
484484
__func__, (unsigned long long)physaddr,
485485
(unsigned long long)(physaddr + size - 1),
486486
(unsigned long long)size,
@@ -490,6 +490,12 @@ update_mem_attrs(uintptr_t addr, uint64_t size,
490490
(clear_attrs & MEM_ATTR_R) ? "r" : "",
491491
(clear_attrs & MEM_ATTR_W) ? "w" : "",
492492
(clear_attrs & MEM_ATTR_X) ? "x" : "");
493+
if (!IS_PAGE_ALIGNED(physaddr))
494+
perror(L" addr is not page aligned\n");
495+
if (!IS_PAGE_ALIGNED(size))
496+
perror(L" size is not page aligned\n");
497+
if (size == 0)
498+
perror(L" size is 0\n");
493499
return 0;
494500
}
495501

0 commit comments

Comments
 (0)