Cygwin: lockf: Fix adding a new lock over multiple locks
[newlib-cygwin.git] / libgloss / riscv / semihost-sys_exit.c
blob626fb6aebf2a5a0e5d2c44f2b77dfb6a3d5bfd1c
1 /*
2 * Copyright (C) 2020 Embecosm Limited
3 * SPDX-License-Identifier: BSD-2-Clause
4 */
5 #include <machine/syscall.h>
6 #include "semihost_syscall.h"
8 #define ADP_Stopped_ApplicationExit 0x20026
10 /* Exit a program without cleaning up files. */
11 void
12 _exit (int exit_status)
14 #if __riscv_xlen == 32
15 syscall_errno (SEMIHOST_exit, (long *) ADP_Stopped_ApplicationExit);
16 #else
17 /* The semihosting exit operation only allows 64-bit targets to report the
18 exit code. */
19 long data_block[] = {ADP_Stopped_ApplicationExit, exit_status};
20 syscall_errno (SEMIHOST_exit, data_block);
21 #endif
22 while (1);