libpayload arm64: Make exceptions work

BUG=chrome-os-partner:31634
BRANCH=None
TEST=test_exc generates and handles exceptions properly

Change-Id: If3ecab93be6d02942b52960ec97edc687bedf64b
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: bba2caae0bd436ba9e5215f5d8606ce8c4987c98
Original-Change-Id: I4abe8a0e426eab2532852179dbb32505353cd0a1
Original-Signed-off-by: Furquan Shaikh <furquan@google.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/214609
Original-Tested-by: Furquan Shaikh <furquan@chromium.org>
Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Original-Commit-Queue: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: http://review.coreboot.org/8783
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Furquan Shaikh
2014-08-27 21:43:36 -07:00
committed by Patrick Georgi
parent 02efc9413b
commit 3b1ee0387c
5 changed files with 89 additions and 61 deletions

View File

@@ -35,11 +35,13 @@
* Move exception id into x1
* Branch to exception_handler
*/
.macro eentry id
stp x30, xzr, [sp, #-16]!
bl exception_prologue
mov x1, \id
bl exception_handler
.macro eentry lbl id
.align 7
\lbl:
stp x30, xzr, [sp, #-16]!
bl exception_prologue
mov x1, \id
bl exception_handler
.endm
/* Exception table has 16 entries and each of 128 bytes
@@ -51,37 +53,22 @@
.global exception_table
exception_table:
.align 7
sync_el0:
eentry #0
.align 7
irq_el0:
eentry #0
.align 7
fiq_el0:
eentry #0
.align 7
serror_el0:
eentry #0
.align 7
sync_elx:
eentry #1
.align 7
irq_elx:
eentry #2
.align 7
fiq_elx:
eentry #3
.align 7
serror_elx:
eentry #4
eentry sync_sp0,#0
eentry irq_sp0,#1
eentry fiq_sp0,#2
eentry serror_sp0,#3
eentry sync_spx,#4
eentry irq_spx,#5
eentry fiq_spx,#6
eentry serror_spx,#7
eentry sync_elx_64,#8
eentry irq_elx_64,#9
eentry fiq_elx_64,#10
eentry serror_elx_64,#11
eentry sync_elx_32,#12
eentry irq_elx_32,#13
eentry fiq_elx_32,#14
eentry serror_elx_32,#15
exception_prologue:
/* Save all registers x0-x29 */
@@ -119,6 +106,8 @@ exception_handler:
/* Pop return address saved on stack */
ldp x0, x1, [sp], #16
msr elr_el3, x0
msr esr_el3, x1
/* Pop exception reason saved on stack, followed by regs x0-x30 */
ldp x0, x1, [sp], #16
ldp x2, x3, [sp], #16