libpayload arm64: Initialize exception stack

Initialize exception stack to be able to handle exceptions properly

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

Change-Id: I4dc83ff32c1665e22127bf0b1e6d4c6b45c07a4a
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/214608
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Commit-Queue: Furquan Shaikh <furquan@chromium.org>
This commit is contained in:
Furquan Shaikh 2014-08-27 21:40:23 -07:00 committed by chrome-internal-fetch
commit 99157687c5
2 changed files with 15 additions and 9 deletions

View file

@ -38,24 +38,23 @@ ENTRY(_entry)
ldr x1, 1f
str x0, [x1]
/* TODO: disable interrupts */
/* Setup exception stack */
ldr x1, 3f
msr SPSel, #1
isb
/* TODO: Clear BSS */
mov sp, x1
/* Setup new stack */
ldr x1, 2f
mov sp, x1
msr SPSel, #0
isb
/* TODO: Save old stack pointer and link register */
mov sp, x1
/* Let's rock. */
bl start_main
/* %r0 has the return value - pass it on unmolested */
/* TODO: restore old stack pointer and link register */
/* Return to the original context. */
ret
ENDPROC(_entry)
@ -64,3 +63,5 @@ ENDPROC(_entry)
.quad cb_header_ptr
2:
.quad _stack
3:
.quad _exc_stack

View file

@ -82,6 +82,11 @@ SECTIONS
. += STACK_SIZE;
. = ALIGN(16);
_stack = .;
_exc_estack = .;
. += STACK_SIZE;
. = ALIGN(16);
_exc_stack = .;
}
_end = .;