diff mbox series

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

Message ID 20180123024711.19768-1-peng.fan@nxp.com
State Changes Requested
Delegated to: Tom Rini
Headers show
Series [U-Boot] arm64 :show_regs: show the real hardware register even after relocation | expand

Commit Message

Peng Fan Jan. 23, 2018, 2:47 a.m. UTC
Not only show the calculated value after relocation, also show
the real hardware register value.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reported-by: Karl Beldan <karl.beldan@gmail.com>
---
 arch/arm/lib/interrupts_64.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Comments

Karl Beldan Jan. 23, 2018, 8:44 p.m. UTC | #1
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@nxp.com>
> Reported-by: Karl Beldan <karl.beldan@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
diff mbox series

Patch

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",
+		       regs->elr - gd->reloc_off,
+		       regs->regs[30] - gd->reloc_off);
 	}
+
 	for (i = 0; i < 29; i += 2)
 		printf("x%-2d: %016lx x%-2d: %016lx\n",
 		       i, regs->regs[i], i+1, regs->regs[i+1]);