]> Git Repo - J-u-boot.git/blame - cmd/arm/exception.c
Merge tag 'v2024.07-rc5' into next
[J-u-boot.git] / cmd / arm / exception.c
CommitLineData
dab8788a
HS
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 <[email protected]>
6 */
7
dab8788a
HS
8#include <command.h>
9
09140113
SG
10static int do_unaligned(struct cmd_tbl *cmdtp, int flag, int argc,
11 char *const argv[])
dab8788a
HS
12{
13 /*
14 * The LDRD instruction requires the data source to be four byte aligned
15 * even if strict alignment fault checking is disabled in the system
16 * control register.
17 */
18 asm volatile (
19 "MOV r5, sp\n"
20 "ADD r5, #1\n"
21 "LDRD r6, r7, [r5]\n");
22 return CMD_RET_FAILURE;
23}
24
09140113
SG
25static int do_breakpoint(struct cmd_tbl *cmdtp, int flag, int argc,
26 char *const argv[])
dab8788a
HS
27{
28 asm volatile ("BKPT #123\n");
29 return CMD_RET_FAILURE;
30}
31
09140113
SG
32static int do_undefined(struct cmd_tbl *cmdtp, int flag, int argc,
33 char *const argv[])
dab8788a
HS
34{
35 /*
36 * 0xe7f...f. is undefined in ARM mode
37 * 0xde.. is undefined in Thumb mode
38 */
39 asm volatile (".word 0xe7f7defb\n");
40 return CMD_RET_FAILURE;
41}
42
09140113 43static struct cmd_tbl cmd_sub[] = {
dab8788a
HS
44 U_BOOT_CMD_MKENT(breakpoint, CONFIG_SYS_MAXARGS, 1, do_breakpoint,
45 "", ""),
46 U_BOOT_CMD_MKENT(unaligned, CONFIG_SYS_MAXARGS, 1, do_unaligned,
47 "", ""),
48 U_BOOT_CMD_MKENT(undefined, CONFIG_SYS_MAXARGS, 1, do_undefined,
49 "", ""),
50};
51
52static char exception_help_text[] =
53 "<ex>\n"
54 " The following exceptions are available:\n"
55 " breakpoint - prefetch abort\n"
56 " unaligned - data abort\n"
57 " undefined - undefined instruction\n"
58 ;
59
60#include <exception.h>
This page took 0.126833 seconds and 4 git commands to generate.