xref: /openbmc/qemu/tests/tcg/arm/semicall.h (revision 2e1cacfb)
1 /*
2  * Semihosting Tests - ARM Helper
3  *
4  * Copyright (c) 2019, 2024
5  * Written by Alex Bennée <alex.bennee@linaro.org>
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  */
9 
10 uintptr_t __semi_call(uintptr_t type, uintptr_t arg0)
11 {
12     register uintptr_t t asm("r0") = type;
13     register uintptr_t a0 asm("r1") = arg0;
14 #ifdef __thumb__
15 #  define SVC  "svc 0xab"
16 #else
17 #  define SVC  "svc 0x123456"
18 #endif
19     asm(SVC : "=r" (t)
20         : "r" (t), "r" (a0));
21     return t;
22 }
23