Welcome to mirror list, hosted at ThFree Co, Russian Federation.

semihost-sys_exit.c « riscv « libgloss - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 626fb6aebf2a5a0e5d2c44f2b77dfb6a3d5bfd1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
 * Copyright (C) 2020 Embecosm Limited
 * SPDX-License-Identifier: BSD-2-Clause
 */
#include <machine/syscall.h>
#include "semihost_syscall.h"

#define ADP_Stopped_ApplicationExit 0x20026

/* Exit a program without cleaning up files.  */
void
_exit (int exit_status)
{
#if __riscv_xlen == 32
  syscall_errno (SEMIHOST_exit, (long *) ADP_Stopped_ApplicationExit);
#else
  /* The semihosting exit operation only allows 64-bit targets to report the
     exit code.  */
  long data_block[] = {ADP_Stopped_ApplicationExit, exit_status};
  syscall_errno (SEMIHOST_exit, data_block);
#endif
  while (1);
}