1/* 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
21#if CONFIG_SYS_ARM_ARCH < 7
22	/* Before the ARMv7 exception model, svc (swi) clobbers lr */
23	mov	r2, lr
24#endif
25	svc	#0x123456
26#endif
27
28#if defined(CONFIG_ARM64)
29	ret
30#elif CONFIG_SYS_ARM_ARCH < 7
31	bx	r2
32#else
33	bx	lr
34#endif
35
36ENDPROC(smh_trap)
37.popsection
38