diff options
Diffstat (limited to 'shared/runtime/semihosting_arm.c')
| -rw-r--r-- | shared/runtime/semihosting_arm.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/shared/runtime/semihosting_arm.c b/shared/runtime/semihosting_arm.c index d44124faa..f4d168f79 100644 --- a/shared/runtime/semihosting_arm.c +++ b/shared/runtime/semihosting_arm.c @@ -36,6 +36,7 @@ #define SYS_WRITE 0x05 #define SYS_READ 0x06 #define SYS_READC 0x07 +#define SYS_EXIT 0x18 // Constants: #define OPEN_MODE_READ (0) // mode "r" @@ -88,6 +89,13 @@ void mp_semihosting_init() { mp_semihosting_stdout = mp_semihosting_open_console(OPEN_MODE_WRITE); } +void mp_semihosting_exit(int status) { + if (status == 0) { + status = 0x20026; + } + mp_semihosting_call(SYS_EXIT, (void *)(uintptr_t)status); +} + int mp_semihosting_rx_char() { return mp_semihosting_call(SYS_READC, NULL); } |
