diff options
Diffstat (limited to 'tests/tcg/multiarch/arm-compat-semi/semihosting.c')
-rw-r--r-- | tests/tcg/multiarch/arm-compat-semi/semihosting.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/tcg/multiarch/arm-compat-semi/semihosting.c b/tests/tcg/multiarch/arm-compat-semi/semihosting.c new file mode 100644 index 0000000000..b3fd16cd12 --- /dev/null +++ b/tests/tcg/multiarch/arm-compat-semi/semihosting.c @@ -0,0 +1,29 @@ +/* + * linux-user semihosting checks + * + * Copyright (c) 2019 + * Written by Alex Bennée <alex.bennee@linaro.org> + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#define SYS_WRITE0 0x04 +#define SYS_REPORTEXC 0x18 + +#include <stdint.h> +#include "semicall.h" + +int main(int argc, char *argv[argc]) +{ +#if UINTPTR_MAX == UINT32_MAX + 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; +} |