Skip to content

Commit 110e293

Browse files
committed
loader(aarch64): print out ELR on fault
This gives you the program counter at fault-time, which is usually quite useful... Signed-off-by: Julia Vassiliki <julia.vassiliki@unsw.edu.au>
1 parent 1d0d3e4 commit 110e293

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

loader/src/aarch64/exceptions.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,16 @@ void exception_handler(uintptr_t ex)
4040
/* Read ESR/FSR based on the exception level we're at. */
4141
uint64_t esr;
4242
uintptr_t far;
43+
uint64_t elr;
4344

4445
if (is_set(CONFIG_ARM_HYPERVISOR_SUPPORT)) {
4546
asm volatile("mrs %0, ESR_EL2" : "=r"(esr) :: "cc");
4647
asm volatile("mrs %0, FAR_EL2" : "=r"(far) :: "cc");
48+
asm volatile("mrs %0, ELR_EL2" : "=r"(elr) :: "cc");
4749
} else {
4850
asm volatile("mrs %0, ESR_EL1" : "=r"(esr) :: "cc");
4951
asm volatile("mrs %0, FAR_EL1" : "=r"(far) :: "cc");
52+
asm volatile("mrs %0, ELR_EL1" : "=r"(elr) :: "cc");
5053
}
5154

5255
uintptr_t ec = (esr >> 26) & 0x3f;
@@ -68,6 +71,8 @@ void exception_handler(uintptr_t ex)
6871
puthex64(esr & MASK(24));
6972
puts("\n far: ");
7073
puthex64(far);
74+
puts("\n elr: ");
75+
puthex64(elr);
7176
puts("\n");
7277

7378
for (unsigned i = 0; i < 32; i++) {

0 commit comments

Comments
 (0)