diff options
author | Furquan Shaikh <furquan@google.com> | 2014-09-08 18:04:18 -0700 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-03-28 07:04:45 +0100 |
commit | 4aa761616b38c63f0402c2a01cea26fdff6f78a7 (patch) | |
tree | 59dca35fec694062adcfab5776137585b3494301 /src/arch/arm64/armv8/exception.c | |
parent | 668316bdccdb0372c7e450398ad1c81a9205d158 (diff) |
arm64: Make exceptions use the transition library
Transition library acts as a common interface for handling exceptions. The only
thing that needs to be implemented by exception.c is the exc_dispatch routine to
handle the exceptions as required.
BUG=chrome-os-partner:30785
BRANCH=None
TEST=Compiles successfully and exceptions are tested using test_exc
Change-Id: I90b4861909189adfe8449b9d4590965e6b743c00
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: b83c9404407dd4dd2dda4e4eaed0b443f0f58425
Original-Change-Id: Ibb643d7ea2f9aabbc66439549ea2168fd66ced5e
Original-Signed-off-by: Furquan Shaikh <furquan@google.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/217143
Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Original-Tested-by: Furquan Shaikh <furquan@chromium.org>
Original-Commit-Queue: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: http://review.coreboot.org/9071
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/arch/arm64/armv8/exception.c')
-rw-r--r-- | src/arch/arm64/armv8/exception.c | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/src/arch/arm64/armv8/exception.c b/src/arch/arm64/armv8/exception.c index d9a63c3a81..0aef0e5457 100644 --- a/src/arch/arm64/armv8/exception.c +++ b/src/arch/arm64/armv8/exception.c @@ -31,6 +31,7 @@ #include <types.h> #include <arch/cache.h> #include <arch/exception.h> +#include <arch/transition.h> #include <console/console.h> #include <arch/lib_helpers.h> @@ -80,24 +81,28 @@ static struct exception_handler_info exceptions[EXC_COUNT] = { [EXC_SERROR_ELX_32] = {"_serror_elx_32"}, }; -static void print_regs(struct exception_state *state) +static void print_regs(struct exc_state *exc_state) { int i; - uint64_t far_el3; - - far_el3 = raw_read_far_el3(); - - printk(BIOS_DEBUG, "ELR = 0x%016llx\n", state->elr); - printk(BIOS_DEBUG, "ESR = 0x%08llx\n", state->esr); - printk(BIOS_DEBUG, "FAR_EL3 = 0x%016llx\n", far_el3); - for (i = 0; i < 31; i++) - printk(BIOS_DEBUG, "X%02d = 0x%016llx\n", i, state->regs[i]); + struct elx_state *elx = &exc_state->elx; + struct regs *regs = &exc_state->regs; + + uint64_t elx_esr = raw_read_esr_current(); + uint64_t elx_far = raw_read_far_current(); + + printk(BIOS_DEBUG, "ELR = 0x%016llx\n", elx->elr); + printk(BIOS_DEBUG, "ESR = 0x%016llx\n", elx_esr); + printk(BIOS_DEBUG, "SPSR = 0x%08llx\n", elx->spsr); + printk(BIOS_DEBUG, "FAR = 0x%016llx\n", elx_far); + for (i = X0_INDEX; i < XMAX_INDEX; i++) + printk(BIOS_DEBUG, "X%02d = 0x%016llx\n", i, regs->x[i]); } -void exception_dispatch(struct exception_state *state, int idx) +void exc_dispatch(struct exc_state *exc_state, uint64_t idx) { if (idx >= EXC_COUNT) { - printk(BIOS_DEBUG, "Bad exception index %d.\n", idx); + printk(BIOS_DEBUG, "Bad exception index %lx.\n", + (unsigned long)idx); } else { struct exception_handler_info *info = &exceptions[idx]; @@ -106,14 +111,17 @@ void exception_dispatch(struct exception_state *state, int idx) else printk(BIOS_DEBUG, "exception _not_used.\n"); } - print_regs(state); + print_regs(exc_state); if (test_exc) { - state->elr += 4; + exc_state->elx.elr += 4; + raw_write_elr_current(exc_state->elx.elr); test_exc = 0; - printk(BIOS_DEBUG, "new ELR = 0x%016llx\n", state->elr); + printk(BIOS_DEBUG, "new ELR = 0x%016llx\n", exc_state->elx.elr); } else die("exception"); + + exc_exit(&exc_state->regs); } static uint64_t test_exception(void) @@ -129,8 +137,7 @@ static uint64_t test_exception(void) void exception_hwinit(void) { - extern void *exception_table; - set_vbar(&exception_table); + exc_set_vbar(); } void exception_init(void) |