[U-Boot] [PATCH] arm64 :show_regs: show the real hardware register even after relocation

Karl Beldan karl.beldan at gmail.com
Tue Jan 23 20:44:46 UTC 2018


On Tue, Jan 23, 2018 at 10:47:11AM +0800, Peng Fan wrote:
> Not only show the calculated value after relocation, also show
> the real hardware register value.
> 
> Signed-off-by: Peng Fan <peng.fan at nxp.com>
> Reported-by: Karl Beldan <karl.beldan at gmail.com>
> ---
>  arch/arm/lib/interrupts_64.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm/lib/interrupts_64.c b/arch/arm/lib/interrupts_64.c
> index cbcfeec2b0..843d9fcd54 100644
> --- a/arch/arm/lib/interrupts_64.c
> +++ b/arch/arm/lib/interrupts_64.c
> @@ -30,13 +30,14 @@ void show_regs(struct pt_regs *regs)
>  {
>  	int i;
>  
> +	printf("ELR:     %lx\n", regs->elr);
> +	printf("LR:      %lx\n", regs->regs[30]);
>  	if (gd->flags & GD_FLG_RELOC) {
> -		printf("ELR:     %lx\n", regs->elr - gd->reloc_off);
> -		printf("LR:      %lx\n", regs->regs[30] - gd->reloc_off);
> -	} else {
> -		printf("ELR:     %lx\n", regs->elr);
> -		printf("LR:      %lx\n", regs->regs[30]);
> +		printf("reloc ELR:     %lx    lr: %lx\n",

While formatting is often subjective, the other contributors took care
of properly aligning all reg names and vals for other archs as much as
possible in an homogeneous way, but it doesn't seem to be the case here.

With your change our stack traces would now look like: {

ELR:     cff00ff
LR:      ab00
reloc ELR:     fffc00000cff00ff    lr: fffc00000000ab00
x0 : 000000000000000a x1 : 000000000000000a
[...]
x28: 0000000000000000 x29: 0000000000000000

} instead of e.g.: {

elr: 000000000cff00ff lr : 000000000000ab00
elr: fffc00000cff00ff lr : fffc00000000ab00 (reloc)
x0 : 000000000000000a x1 : 000000000000000a
[...]
x28: 0000000000000000 x29: 0000000000000000

}

Regards, 
Karl


More information about the U-Boot mailing list