blob: 6e1691a832c1311fe2f090a7686337c92830e29e [file] [log] [blame]
Andre Przywara8ad3a5d2023-02-07 15:21:04 +00001/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * (C) 2022 Arm Ltd.
4 */
5
6#include <config.h>
7#include <asm/macro.h>
8#include <linux/linkage.h>
9
10.pushsection .text.smh_trap, "ax"
11/* long smh_trap(unsigned int sysnum, void *addr); */
12ENTRY(smh_trap)
13
14#if defined(CONFIG_ARM64)
15 hlt #0xf000
16#elif defined(CONFIG_CPU_V7M)
17 bkpt #0xab
18#elif defined(CONFIG_SYS_THUMB_BUILD)
19 svc #0xab
20#else
Sean Anderson6ae865f2023-10-27 16:40:14 -040021#if CONFIG_SYS_ARM_ARCH < 7
22 /* Before the ARMv7 exception model, svc (swi) clobbers lr */
23 mov r2, lr
24#endif
Andre Przywara8ad3a5d2023-02-07 15:21:04 +000025 svc #0x123456
26#endif
27
28#if defined(CONFIG_ARM64)
29 ret
Sean Anderson6ae865f2023-10-27 16:40:14 -040030#elif CONFIG_SYS_ARM_ARCH < 7
31 bx r2
Andre Przywara8ad3a5d2023-02-07 15:21:04 +000032#else
33 bx lr
34#endif
35
36ENDPROC(smh_trap)
37.popsection