[U-Boot] [PATCH v2 6/6] arm: print information about loaded UEFI images
Heinrich Schuchardt
xypron.glpk at gmx.de
Tue Apr 3 20:29:35 UTC 2018
If an exception occurs in a UEFI loaded image we need the start address of
the image to determine the relocation offset.
This patch adds the necessary lines after the registers in the crash dump.
A possible output would be:
UEFI image
start 0x7fdb4000, size 0xa7b60
pc offset 0x72ca
/\snp.efi
With the offset 0x72ca we can now find the relevant instruction in the
disassembled 'snp.efi' binary.
Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
v2
no change
---
arch/arm/lib/interrupts.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/arch/arm/lib/interrupts.c b/arch/arm/lib/interrupts.c
index 80869adb61..a28fef8f46 100644
--- a/arch/arm/lib/interrupts.c
+++ b/arch/arm/lib/interrupts.c
@@ -20,6 +20,7 @@
*/
#include <common.h>
+#include <efi_loader.h>
#include <asm/proc-armv/ptrace.h>
#include <asm/u-boot-arm.h>
#include <efi_loader.h>
@@ -51,6 +52,14 @@ void bad_mode (void)
reset_cpu (0);
}
+static void show_efi_loaded_images(struct pt_regs *regs)
+{
+#if defined(CONFIG_EFI_LOADER) && \
+ !defined(CONFIG_SPL_BUILD) && !defined(API_BUILD)
+ efi_print_image_infos((void *)instruction_pointer(regs));
+#endif
+}
+
void show_regs (struct pt_regs *regs)
{
unsigned long __maybe_unused flags;
@@ -77,6 +86,7 @@ void show_regs (struct pt_regs *regs)
printf("sp : %08lx ip : %08lx fp : %08lx\n",
regs->ARM_sp, regs->ARM_ip, regs->ARM_fp);
printf ("r10: %08lx r9 : %08lx r8 : %08lx\n",
+
regs->ARM_r10, regs->ARM_r9, regs->ARM_r8);
printf ("r7 : %08lx r6 : %08lx r5 : %08lx r4 : %08lx\n",
regs->ARM_r7, regs->ARM_r6, regs->ARM_r5, regs->ARM_r4);
@@ -106,6 +116,7 @@ void do_undefined_instruction (struct pt_regs *pt_regs)
printf ("undefined instruction\n");
fixup_pc(pt_regs, -4);
show_regs (pt_regs);
+ show_efi_loaded_images(pt_regs);
bad_mode ();
}
@@ -115,6 +126,7 @@ void do_software_interrupt (struct pt_regs *pt_regs)
printf ("software interrupt\n");
fixup_pc(pt_regs, -4);
show_regs (pt_regs);
+ show_efi_loaded_images(pt_regs);
bad_mode ();
}
@@ -124,6 +136,7 @@ void do_prefetch_abort (struct pt_regs *pt_regs)
printf ("prefetch abort\n");
fixup_pc(pt_regs, -8);
show_regs (pt_regs);
+ show_efi_loaded_images(pt_regs);
bad_mode ();
}
@@ -133,6 +146,7 @@ void do_data_abort (struct pt_regs *pt_regs)
printf ("data abort\n");
fixup_pc(pt_regs, -8);
show_regs (pt_regs);
+ show_efi_loaded_images(pt_regs);
bad_mode ();
}
@@ -142,6 +156,7 @@ void do_not_used (struct pt_regs *pt_regs)
printf ("not used\n");
fixup_pc(pt_regs, -8);
show_regs (pt_regs);
+ show_efi_loaded_images(pt_regs);
bad_mode ();
}
@@ -151,6 +166,7 @@ void do_fiq (struct pt_regs *pt_regs)
printf ("fast interrupt request\n");
fixup_pc(pt_regs, -8);
show_regs (pt_regs);
+ show_efi_loaded_images(pt_regs);
bad_mode ();
}
@@ -160,5 +176,6 @@ void do_irq (struct pt_regs *pt_regs)
printf ("interrupt request\n");
fixup_pc(pt_regs, -8);
show_regs (pt_regs);
+ show_efi_loaded_images(pt_regs);
bad_mode ();
}
--
2.16.3
More information about the U-Boot
mailing list