Skip to contentSkip to conversation

arm64 :show_regs: show the real hardware register even after relocation

PATCH New Peng Fan 2 participants 2 messages Jan 23, 2018 Arm (32-bit)

lore
Share & tools
lore

Peng Fan

author
#0 lore raw

PATCH 1/1 arm64 :show_regs: show the real hardware register even after relocation

Not only show the calculated value after relocation, also show the real hardware register value.

---
 arch/arm/lib/interrupts_64.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
arch/arm/lib/interrupts_64.c +6 -5
index cbcfeec2b0..843d9fcd54 100644
@@ -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]);
Signature · 1 line
2.14.1
#1 lore raw

PATCH 1/1 arm64 :show_regs: show the real hardware register even after relocation

Quoted 16 lines · Peng Fan

Not only show the calculated value after relocation, also show the real hardware register value.

---
 arch/arm/lib/interrupts_64.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
arch/arm/lib/interrupts_64.c +0 -0
index cbcfeec2b0..843d9fcd54 100644
@@ -30,13 +30,14 @@ void show_regs(struct pt_regs *regs)
 {
 	int i;

arch/arm/lib/interrupts_64.c void show_regs(struct pt_regs *regs) · line 36

Quoted 10 lines
arch/arm/lib/interrupts_64.c +3 -5
 
+	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