Cygwin: mmap: use 64K pages for bookkeeping, second attempt
[newlib-cygwin.git] / newlib / libc / sys / m88kbug / syscalls.c
blob954dcf6b11c4cfddbdef131b22ebfbb5313534da
1 /* Operating system and traps for mvme187bug, the motorolola BUG
2 monitor for m88k */
4 #include <sys/types.h>
5 #include <sys/stat.h>
6 #include <sys/times.h>
7 #include <errno.h>
9 #include "sys/systraps.h"
11 static void writechar(int c) {
12 register int n asm ("r2");
13 n = c;
14 SYSTRAP(OUTCHR);
15 return;
18 static int readchar(void) {
19 register int n asm ("r2");
20 SYSTRAP(INCHR);
21 return(n);
24 int read(int file, char *ptr, int len) {
25 int todo;
27 for (todo = len; todo; --todo) {
28 *ptr++ = readchar();
31 return(len);
34 int lseek(int file, int ptr, int dir) {
35 return 0;
38 int write(int file, char *ptr, int len) {
39 int todo;
41 for (todo = len; todo; --todo) {
42 writechar(*ptr++);
44 return(len);
47 int close(int file) {
48 return(-1);
51 caddr_t sbrk(int incr) {
52 extern char end; /* Defined by the linker */
53 static char *heap_end;
54 char *prev_heap_end;
56 if (heap_end == 0)
58 heap_end = &end;
60 prev_heap_end = heap_end;
61 if (heap_end + incr > stack_ptr)
63 _write (1, "Heap and stack collision\n", 25);
64 abort ();
66 heap_end += incr;
67 return((caddr_t) prev_heap_end);
70 int isatty(int file) {
71 return(1);
74 int fstat(int file, struct stat *st) {
75 st->st_mode = S_IFCHR;
76 return(0);
79 int stat(char *__restrict filename, struct stat *__restrict st) {
80 st->st_mode = S_IFCHR;
81 return(0);
84 int open(const char *path, int flags) {
85 return(0);
89 int _exit() {
90 SYSTRAP(RETURN);
93 int execve(char *name, char **argv, char **env) {
94 errno = ENOMEM;
95 return(-1);
98 int fork() {
99 errno = EAGAIN;
100 return(-1);
103 int getpid() {
104 return(1);
107 int kill(int pid, int sig) {
108 errno = EINVAL;
109 return(-1);
112 int link(char *old, char *new) {
113 errno = EMLINK;
114 return(-1);
117 clock_t times(struct tms *buf) {
118 return(-1);
121 int unlink(char *name) {
122 errno = ENOENT;
123 return(-1);
126 int wait(int *status) {
127 errno = ECHILD;
128 return(-1);
131 /* end of syscalls.c */