mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-22 23:17:28 +08:00
ddb614993a
Without this, when building with recent gcc, we'll see errors when compiling for --target mmix the first being: CC libc/sys/mmixware/libc_a-chmod.o In file included from /x/newlib/libc/sys/mmixware/chmod.c:17: /x/newlib/libc/sys/mmixware/chmod.c: In function 'chmod': /x/newlib/libc/sys/mmixware/sys/syscall.h:139:6: error: implicit declaration \ of function 'sprintf' [-Wimplicit-function-declaration] 139 | sprintf (buf, "UNIMPLEMENTED %s in %s\n", __FUNCTION__, __FILE__); \ Other warnings also quelled. * libc/sys/mmixware/sys/syscall.h: Include stdio.h, string.h and unistd.h. * libc/sys/mmixware/_exit.c: Call __unreachable after simulator exit. * libc/sys/mmixware/chown.c (chown): Match declaration in unistd.h. * libc/sys/mmixware/getpid.c (_getpid): Ditto. * libc/sys/mmixware/kill.c (_kill): Ditto. * libc/sys/mmixware/link.c (_link): Ditto. * libc/sys/mmixware/read.c (_read): Ditto. * libc/sys/mmixware/sbrk.c (_sbrk): Ditto. * libc/sys/mmixware/unlink.c (_unlink): Ditto. * libc/sys/mmixware/write.c (_write): Ditto.
32 lines
1.0 KiB
C
32 lines
1.0 KiB
C
/* _exit for MMIXware.
|
|
|
|
Copyright (C) 2001, 2023 Hans-Peter Nilsson
|
|
|
|
Permission to use, copy, modify, and distribute this software is
|
|
freely granted, provided that the above copyright notice, this notice
|
|
and the following disclaimer are preserved with no changes.
|
|
|
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
|
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
PURPOSE. */
|
|
|
|
#include <_ansi.h>
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#include "sys/syscall.h"
|
|
|
|
void _exit (int n)
|
|
{
|
|
/* The return status is passed on at exit from the simulator by all
|
|
but the oldest versions of Knuth's mmixware simulator. Beware,
|
|
"TRAP 0,0,0" is the instruction corresponding to (int32_t) 0 and
|
|
the value 0 in $255 is common enough that a program crash jumping
|
|
to e.g. uninitialized memory will look like "exit (0)". */
|
|
__asm__ ("SET $255,%0\n\tTRAP 0,0,0"
|
|
: /* No outputs. */
|
|
: "r" (n)
|
|
: "memory");
|
|
__unreachable ();
|
|
}
|