qapi/error: Check format string argument in error_*prepend()
[qemu/armbru.git] / tests / tcg / arm / semicall.h
blobd4f6818192d27ff1612c11fac684dcda21ad139d
1 /*
2 * Semihosting Tests
4 * Copyright (c) 2019
5 * Written by Alex Bennée <alex.bennee@linaro.org>
7 * SPDX-License-Identifier: GPL-3.0-or-later
8 */
10 #define SYS_WRITE0 0x04
11 #define SYS_READC 0x07
12 #define SYS_REPORTEXC 0x18
14 uintptr_t __semi_call(uintptr_t type, uintptr_t arg0)
16 #if defined(__arm__)
17 register uintptr_t t asm("r0") = type;
18 register uintptr_t a0 asm("r1") = arg0;
19 #ifdef __thumb__
20 # define SVC "svc 0xab"
21 #else
22 # define SVC "svc 0x123456"
23 #endif
24 asm(SVC : "=r" (t)
25 : "r" (t), "r" (a0));
26 #else
27 register uintptr_t t asm("x0") = type;
28 register uintptr_t a0 asm("x1") = arg0;
29 asm("hlt 0xf000"
30 : "=r" (t)
31 : "r" (t), "r" (a0));
32 #endif
34 return t;