Heinrich Schuchardt | dab8788 | 2018-12-26 17:20:35 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * The 'exception' command can be used for testing exception handling. |
| 4 | * |
| 5 | * Copyright (c) 2018, Heinrich Schuchardt <xypron.glpk@gmx.de> |
| 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <command.h> |
| 10 | |
Simon Glass | 0914011 | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 11 | static int do_undefined(struct cmd_tbl *cmdtp, int flag, int argc, |
| 12 | char *const argv[]) |
Heinrich Schuchardt | dab8788 | 2018-12-26 17:20:35 +0100 | [diff] [blame] | 13 | { |
| 14 | /* |
| 15 | * 0xe7f...f. is undefined in ARM mode |
| 16 | * 0xde.. is undefined in Thumb mode |
| 17 | */ |
| 18 | asm volatile (".word 0xe7f7defb\n"); |
| 19 | return CMD_RET_FAILURE; |
| 20 | } |
| 21 | |
Simon Glass | 0914011 | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 22 | static struct cmd_tbl cmd_sub[] = { |
Heinrich Schuchardt | dab8788 | 2018-12-26 17:20:35 +0100 | [diff] [blame] | 23 | U_BOOT_CMD_MKENT(undefined, CONFIG_SYS_MAXARGS, 1, do_undefined, |
| 24 | "", ""), |
| 25 | }; |
| 26 | |
| 27 | static char exception_help_text[] = |
| 28 | "<ex>\n" |
| 29 | " The following exceptions are available:\n" |
| 30 | " undefined - undefined instruction\n" |
| 31 | ; |
| 32 | |
| 33 | #include <exception.h> |