Andre Przywara | 8ad3a5d | 2023-02-07 15:21:04 +0000 | [diff] [blame] | 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); */ |
| 12 | ENTRY(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 Anderson | 6ae865f | 2023-10-27 16:40:14 -0400 | [diff] [blame] | 21 | #if CONFIG_SYS_ARM_ARCH < 7 |
| 22 | /* Before the ARMv7 exception model, svc (swi) clobbers lr */ |
| 23 | mov r2, lr |
| 24 | #endif |
Andre Przywara | 8ad3a5d | 2023-02-07 15:21:04 +0000 | [diff] [blame] | 25 | svc #0x123456 |
| 26 | #endif |
| 27 | |
| 28 | #if defined(CONFIG_ARM64) |
| 29 | ret |
Sean Anderson | 6ae865f | 2023-10-27 16:40:14 -0400 | [diff] [blame] | 30 | #elif CONFIG_SYS_ARM_ARCH < 7 |
| 31 | bx r2 |
Andre Przywara | 8ad3a5d | 2023-02-07 15:21:04 +0000 | [diff] [blame] | 32 | #else |
| 33 | bx lr |
| 34 | #endif |
| 35 | |
| 36 | ENDPROC(smh_trap) |
| 37 | .popsection |