1 // SPDX-License-Identifier: GPL-2.0+
3 * The 'exception' command can be used for testing exception handling.
11 static int do_unaligned(struct cmd_tbl *cmdtp, int flag, int argc,
15 * The LDRD instruction requires the data source to be four byte aligned
16 * even if strict alignment fault checking is disabled in the system
22 "LDRD r6, r7, [r5]\n");
23 return CMD_RET_FAILURE;
26 static int do_breakpoint(struct cmd_tbl *cmdtp, int flag, int argc,
29 asm volatile ("BKPT #123\n");
30 return CMD_RET_FAILURE;
33 static int do_undefined(struct cmd_tbl *cmdtp, int flag, int argc,
37 * 0xe7f...f. is undefined in ARM mode
38 * 0xde.. is undefined in Thumb mode
40 asm volatile (".word 0xe7f7defb\n");
41 return CMD_RET_FAILURE;
44 static struct cmd_tbl cmd_sub[] = {
45 U_BOOT_CMD_MKENT(breakpoint, CONFIG_SYS_MAXARGS, 1, do_breakpoint,
47 U_BOOT_CMD_MKENT(unaligned, CONFIG_SYS_MAXARGS, 1, do_unaligned,
49 U_BOOT_CMD_MKENT(undefined, CONFIG_SYS_MAXARGS, 1, do_undefined,
53 static char exception_help_text[] =
55 " The following exceptions are available:\n"
56 " breakpoint - prefetch abort\n"
57 " unaligned - data abort\n"
58 " undefined - undefined instruction\n"
61 #include <exception.h>