mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-08 16:41:55 +00:00
panic: Fix unaligned memory access panic
Some target's gcc will detect the address is unaligned and then
expand to byte load sequence, make the address to volatile can
prevent gcc optimize it.
BUG=none
BRANCH=none
TEST=make buildall;
Verified that "crash unaligned" causes a panic on it83xx.
Change-Id: Ieb4f5f8fc65854aefe307fa675fe87d7581452ed
Signed-off-by: Kito Cheng <kito.cheng@gmail.com>
Reviewed-on: https://chromium-review.googlesource.com/374281
Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
@@ -177,8 +177,9 @@ static int command_crash(int argc, char **argv)
|
||||
stack_overflow_recurse(1);
|
||||
#endif
|
||||
} else if (!strcasecmp(argv[1], "unaligned")) {
|
||||
volatile intptr_t unaligned_ptr = 0xcdef;
|
||||
cflush();
|
||||
ccprintf("%08x", *(volatile int *)0xcdef);
|
||||
ccprintf("%08x", *(volatile int *)unaligned_ptr);
|
||||
} else if (!strcasecmp(argv[1], "watchdog")) {
|
||||
while (1)
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user