libpayload: ARM: Don't leave alignment checking on after the exception test

Currently, the exception handling code on ARM in libpayload turns on alignment
checks as an easy way to generate an exception for testing purposes. It was
leaving it on which disabled unaligned accesses for other, unlreated code
running later. This change adjusts the code so the original value of the
alignment bit is restored after the test exception.

Built and booted into depthcharge on pit with an unaligned accesses added
after the call to exception_init in the depthcharge's main. Before this
change, the access caused an exception. After this change, the access
completed successfully.

Change-Id: If92cab3cc8eabca7c5b0560ce88a8796a27fe3b2
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/59372
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Reviewed-on: http://review.coreboot.org/4255
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Tested-by: build bot (Jenkins)
This commit is contained in:
Gabe Black 2013-06-19 20:48:06 -07:00 committed by Alexandru Gagniuc
parent cfe77beea4
commit 6149776e73
1 changed files with 5 additions and 3 deletions

View File

@ -143,9 +143,8 @@ void exception_init(void)
sctlr &= ~sctlr_te; sctlr &= ~sctlr_te;
/* Set V=0 in SCTLR so VBAR points to the exception vector table. */ /* Set V=0 in SCTLR so VBAR points to the exception vector table. */
sctlr &= ~sctlr_v; sctlr &= ~sctlr_v;
/* Enforce alignment. */ /* Enforce alignment temporarily. */
sctlr |= sctlr_a; set_sctlr(sctlr | sctlr_a);
set_sctlr(sctlr);
extern uint32_t exception_table[]; extern uint32_t exception_table[];
set_vbar((uintptr_t)exception_table); set_vbar((uintptr_t)exception_table);
@ -153,4 +152,7 @@ void exception_init(void)
test_abort = 1; test_abort = 1;
exception_test(); exception_test();
test_abort = 0; test_abort = 0;
/* Restore alignment settings. */
set_sctlr(sctlr);
} }