arm: print information about loaded UEFI images

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 [0xbffe6000:0xbffe631f] pc=0x138 '/\snp.efi'

With the offset 0x138 we can now find the relevant instruction in the
disassembled 'snp.efi' binary.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
Heinrich Schuchardt 2018-04-05 11:56:22 +02:00 committed by Alexander Graf
parent c9a63f44b5
commit 99b8db7291

View file

@ -20,6 +20,7 @@
*/ */
#include <common.h> #include <common.h>
#include <efi_loader.h>
#include <asm/proc-armv/ptrace.h> #include <asm/proc-armv/ptrace.h>
#include <asm/u-boot-arm.h> #include <asm/u-boot-arm.h>
#include <efi_loader.h> #include <efi_loader.h>
@ -51,6 +52,11 @@ void bad_mode (void)
reset_cpu (0); reset_cpu (0);
} }
static void show_efi_loaded_images(struct pt_regs *regs)
{
efi_print_image_infos((void *)instruction_pointer(regs));
}
void show_regs (struct pt_regs *regs) void show_regs (struct pt_regs *regs)
{ {
unsigned long __maybe_unused flags; unsigned long __maybe_unused flags;
@ -106,6 +112,7 @@ void do_undefined_instruction (struct pt_regs *pt_regs)
printf ("undefined instruction\n"); printf ("undefined instruction\n");
fixup_pc(pt_regs, -4); fixup_pc(pt_regs, -4);
show_regs (pt_regs); show_regs (pt_regs);
show_efi_loaded_images(pt_regs);
bad_mode (); bad_mode ();
} }
@ -115,6 +122,7 @@ void do_software_interrupt (struct pt_regs *pt_regs)
printf ("software interrupt\n"); printf ("software interrupt\n");
fixup_pc(pt_regs, -4); fixup_pc(pt_regs, -4);
show_regs (pt_regs); show_regs (pt_regs);
show_efi_loaded_images(pt_regs);
bad_mode (); bad_mode ();
} }
@ -124,6 +132,7 @@ void do_prefetch_abort (struct pt_regs *pt_regs)
printf ("prefetch abort\n"); printf ("prefetch abort\n");
fixup_pc(pt_regs, -8); fixup_pc(pt_regs, -8);
show_regs (pt_regs); show_regs (pt_regs);
show_efi_loaded_images(pt_regs);
bad_mode (); bad_mode ();
} }
@ -133,6 +142,7 @@ void do_data_abort (struct pt_regs *pt_regs)
printf ("data abort\n"); printf ("data abort\n");
fixup_pc(pt_regs, -8); fixup_pc(pt_regs, -8);
show_regs (pt_regs); show_regs (pt_regs);
show_efi_loaded_images(pt_regs);
bad_mode (); bad_mode ();
} }
@ -142,6 +152,7 @@ void do_not_used (struct pt_regs *pt_regs)
printf ("not used\n"); printf ("not used\n");
fixup_pc(pt_regs, -8); fixup_pc(pt_regs, -8);
show_regs (pt_regs); show_regs (pt_regs);
show_efi_loaded_images(pt_regs);
bad_mode (); bad_mode ();
} }
@ -151,6 +162,7 @@ void do_fiq (struct pt_regs *pt_regs)
printf ("fast interrupt request\n"); printf ("fast interrupt request\n");
fixup_pc(pt_regs, -8); fixup_pc(pt_regs, -8);
show_regs (pt_regs); show_regs (pt_regs);
show_efi_loaded_images(pt_regs);
bad_mode (); bad_mode ();
} }
@ -160,5 +172,6 @@ void do_irq (struct pt_regs *pt_regs)
printf ("interrupt request\n"); printf ("interrupt request\n");
fixup_pc(pt_regs, -8); fixup_pc(pt_regs, -8);
show_regs (pt_regs); show_regs (pt_regs);
show_efi_loaded_images(pt_regs);
bad_mode (); bad_mode ();
} }