libpayload: Make it possible to install callbacks for particular exceptions.

To support a GDB stub, it will be necessary to trap various exceptions which
will be used to implement breakpoints, single stepping, etc.

BUG=None
TEST=Built and booted on Link with hooks installed and saw that they
triggered when exceptions occurred. Built and booted on nyan.
BRANCH=None

Original-Change-Id: Iab659365864a3055159a50b8f6e5c44290d3ba2b
Original-Signed-off-by: Gabe Black <gabeblack@google.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/179602
Original-Reviewed-by: Gabe Black <gabeblack@chromium.org>
Original-Tested-by: Gabe Black <gabeblack@chromium.org>
Original-Commit-Queue: Gabe Black <gabeblack@chromium.org>
(cherry picked from commit 8db0897b1ddad600e247cb4df147c757a8187626)
Signed-off-by: Marc Jones <marc.jones@se-eng.com>

Change-Id: I5e7f724b99988cd259909dd3bd01166fa52317ec
Reviewed-on: http://review.coreboot.org/7656
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
This commit is contained in:
Gabe Black
2013-12-11 00:23:15 -08:00
committed by Marc Jones
parent c09cf0b7e1
commit 20cdb2439f
8 changed files with 237 additions and 162 deletions

View File

@ -31,6 +31,9 @@
.global exception_stack_end
exception_stack_end:
.long 0
.global exception_handler_state_handoff
exception_handler_state_handoff:
.long 0
/* Some temporary variables which are used while saving exception state. */
vector:
@ -134,11 +137,13 @@ exception_common:
pushl old_eax
/*
* Call the C exception handler. It will find the exception state on
* the exception stack. Not passing parameters means we don't have to
* worry about what ABI is being used.
* Call the C exception handler. It will find the exception state
* using the exception_handler_state_handoff global pointer. Not
* passing parameters means we don't have to worry about what ABI
* is being used.
*/
call exception_handler
mov %esp, exception_handler_state_handoff
call exception_dispatch
/*
* Restore state from the exception state structure, including any