1 /*
2  * linux-user semihosting checks
3  *
4  * Copyright (c) 2019
5  * Written by Alex Bennée <alex.bennee@linaro.org>
6  *
7  * SPDX-License-Identifier: GPL-3.0-or-later
8  */
9 
10 #define SYS_WRITE0      0x04
11 #define SYS_REPORTEXC   0x18
12 
13 #include <stdint.h>
14 #include "semicall.h"
15 
16 int main(int argc, char *argv[argc])
17 {
18 #if UINTPTR_MAX == UINT32_MAX
19     uintptr_t exit_code = 0x20026;
20 #else
21     uintptr_t exit_block[2] = {0x20026, 0};
22     uintptr_t exit_code = (uintptr_t) &exit_block;
23 #endif
24 
25     __semi_call(SYS_WRITE0, (uintptr_t) "Hello World");
26     __semi_call(SYS_REPORTEXC, exit_code);
27     /* if we get here we failed */
28     return -1;
29 }
30