Commit 2d0e751a authored by Mark Rutland's avatar Mark Rutland
Browse files

arm64: consistently use bl for C exception entry

In most cases, our exception entry assembly branches to C handlers with
a BL instruction, but in cases where we do not expect to return, we use
B instead.

While this is correct today, it means that backtraces for fatal
exceptions miss the entry assembly (as the LR is stale at the point we
call C code), while non-fatal exceptions have the entry assembly in the
LR. In subsequent patches, we will need the LR to be set in these cases
in order to backtrace reliably.

This patch updates these sites to use a BL, ensuring consistency, and
preparing for backtrace rework. An ASM_BUG() is added after each of
these new BLs, which both catches unexpected returns, and ensures that
the LR value doesn't point to another function label.
Signed-off-by: default avatarMark Rutland <>
Cc: Ard Biesheuvel <>
Cc: Catalin Marinas <>
Cc: James Morse <>
Cc: Will Deacon <>
parent db44e9c5
......@@ -351,7 +351,8 @@ END(vectors)
mov x0, sp
mov x1, #\reason
mrs x2, esr_el1
b bad_mode
bl bad_mode
......@@ -448,14 +449,16 @@ el1_sp_pc:
mrs x0, far_el1
mov x2, sp
b do_sp_pc_abort
bl do_sp_pc_abort
* Undefined instruction
mov x0, sp
b do_undefinstr
bl do_undefinstr
* Debug exception handling
......@@ -473,7 +476,8 @@ el1_inv:
mov x0, sp
mov x2, x1
mov x1, #BAD_SYNC
b bad_mode
bl bad_mode
.align 6
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment