[PATCH v2 1/1] riscv: additional crash information

Bin Meng bmeng.cn at gmail.com
Mon Aug 3 06:14:39 CEST 2020


On Sat, Aug 1, 2020 at 11:16 PM Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> If an exception occurs, the relocated program counter and return address
> are required for an analysis.
>
> With this patch you get:
>
>     => exception undefined
>
>     Unhandled exception: Illegal instruction
>     EPC: 0000000080595908 RA: 000000008059c0c6 TVAL: 000000008030c01e
>     EPC: 0000000080007908 RA: 000000008000e0c6 reloc adjusted
>
> We can use the relocated addresses to find the involved functions in
> u.boot.map:
>
>     .text.do_undefined
>                 0x0000000080007908        0x8 cmd/built-in.o
>     .text.cmd_process
>                 0x000000008000dfcc      0x11a common/built-in.o
>                 0x000000008000dfcc                cmd_process
>
> If an exception occurs in an UEFI binary additionally the load addresses of
> the UEFI binaries are needed. With this patch:
>
>     => setenv efi_selftest exception
>     => bootefi selftest
>
>     Unhandled exception: Illegal instruction
>     EPC: 000000008042e18a RA: 000000008042e18a TVAL: 000000008030c01e
>     EPC: 000000007fea018a RA: 000000007fea018a reloc adjusted
>
>     UEFI image [0x0000000000000000:0xffffffffffffffff] '/\selftest'
>     UEFI image [0x000000008042e000:0x000000008042e43f] pc=0x18a '/bug.efi'
>
> The value pc=0x18a matches the position of the illegal instruction in
> efi_selftest_miniapp_exception.efi (loaded as /bug.efi);
>
>     asm volatile (".word 0xffffffff\n");
>
>     00000180   93 85 C5 11  1C 64 22 85  82 97 FF FF  FF FF 1C 64
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> Reviewed-by: Sean Anderson <seanga2 at gmail.com>
> Tested-by: Sean Anderson <seanga2 at gmail.com>
> ---
> v2:
>         description of relocated addresses: %s/reloc/reloc adjusted/
> ---
>  arch/riscv/lib/interrupts.c | 57 +++++++++++++++++++++++--------------
>  1 file changed, 35 insertions(+), 22 deletions(-)
>

Reviewed-by: Bin Meng <bin.meng at windriver.com>


More information about the U-Boot mailing list