summaryrefslogtreecommitdiffstats
path: root/tests/tcg/arm/semihosting.c
blob: 33faac9916e11b88c91c1b42b776c26c38b1e164 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
 * linux-user semihosting checks
 *
 * Copyright (c) 2019
 * Written by Alex Bennée <alex.bennee@linaro.org>
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

#include <stdint.h>
#include "semicall.h"

int main(int argc, char *argv[argc])
{
#if defined(__arm__)
    uintptr_t exit_code = 0x20026;
#else
    uintptr_t exit_block[2] = {0x20026, 0};
    uintptr_t exit_code = (uintptr_t) &exit_block;
#endif

    __semi_call(SYS_WRITE0, (uintptr_t) "Hello World");
    __semi_call(SYS_REPORTEXC, exit_code);
    /* if we get here we failed */
    return -1;
}