From 0080df41b311ef20f9214b386fa4e38ee54aa1a1 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Tue, 17 Jun 2014 17:46:01 -0500 Subject: [PATCH] libpayload: align arm64 with new exception handling model The exception handling was previously updated, however the arm64 changes raced with hat one. Make the arm64 align with the new model. Without these changes compilation will fail. BUG=None BRANCH=None TEST=Can build libpayload for rush. Change-Id: I320b39a57b985d1f87446ea7757955664f8dba8f Signed-off-by: Aaron Durbin Reviewed-on: https://chromium-review.googlesource.com/204402 Reviewed-by: Furquan Shaikh Commit-Queue: Furquan Shaikh --- payloads/libpayload/arch/arm64/exception.c | 15 ++++++++------- .../libpayload/include/arm64/arch/exception.h | 2 ++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/payloads/libpayload/arch/arm64/exception.c b/payloads/libpayload/arch/arm64/exception.c index 988bef9ed4..226f5ca27d 100644 --- a/payloads/libpayload/arch/arm64/exception.c +++ b/payloads/libpayload/arch/arm64/exception.c @@ -36,9 +36,10 @@ extern unsigned int test_exc; struct exception_handler_info { const char *name; - exception_hook hook; }; +static exception_hook hook; +struct exception_state *exception_state; static struct exception_handler_info exceptions[EXC_COUNT] = { [EXC_INV] = { "_invalid_exception" }, [EXC_SYNC] = { "_sync" }, @@ -61,14 +62,14 @@ static void print_regs(struct exception_state *state) void exception_dispatch(struct exception_state *state, int idx); void exception_dispatch(struct exception_state *state, int idx) { + exception_state = state; + if (idx >= EXC_COUNT) { printf("Bad exception index %d.\n", idx); } else { struct exception_handler_info *info = &exceptions[idx]; - if (info->hook) { - info->hook(idx, state); + if (hook && hook(idx)) return; - } if (info->name) printf("exception %s\n", info->name); @@ -89,8 +90,8 @@ void exception_init(void) set_vbar(exception_table); } -void exception_install_hook(int type, exception_hook hook) +void exception_install_hook(exception_hook h) { - die_if(type >= EXC_COUNT, "Out of bounds exception index %d.\n", type); - exceptions[type].hook = hook; + die_if(hook, "Implement support for a list of hooks if you need it."); + hook = h; } diff --git a/payloads/libpayload/include/arm64/arch/exception.h b/payloads/libpayload/include/arm64/arch/exception.h index f4a7552db9..44a4e5998d 100644 --- a/payloads/libpayload/include/arm64/arch/exception.h +++ b/payloads/libpayload/include/arm64/arch/exception.h @@ -41,6 +41,8 @@ struct exception_state uint64_t regs[31]; } __attribute__((packed)); +extern struct exception_state *exception_state; + enum { EXC_INV = 0, EXC_SYNC = 1,