1 /* Operating system and traps for mvme187bug, the motorolola BUG
9 #include "sys/systraps.h"
11 static void writechar(int c
) {
12 register int n
asm ("r2");
18 static int readchar(void) {
19 register int n
asm ("r2");
24 int read(int file
, char *ptr
, int len
) {
27 for (todo
= len
; todo
; --todo
) {
34 int lseek(int file
, int ptr
, int dir
) {
38 int write(int file
, char *ptr
, int len
) {
41 for (todo
= len
; todo
; --todo
) {
51 caddr_t
sbrk(int incr
) {
52 extern char end
; /* Defined by the linker */
53 static char *heap_end
;
60 prev_heap_end
= heap_end
;
61 if (heap_end
+ incr
> stack_ptr
)
63 _write (1, "Heap and stack collision\n", 25);
67 return((caddr_t
) prev_heap_end
);
70 int isatty(int file
) {
74 int fstat(int file
, struct stat
*st
) {
75 st
->st_mode
= S_IFCHR
;
79 int stat(char *__restrict filename
, struct stat
*__restrict st
) {
80 st
->st_mode
= S_IFCHR
;
84 int open(const char *path
, int flags
) {
93 int execve(char *name
, char **argv
, char **env
) {
107 int kill(int pid
, int sig
) {
112 int link(char *old
, char *new) {
117 clock_t times(struct tms
*buf
) {
121 int unlink(char *name
) {
126 int wait(int *status
) {
131 /* end of syscalls.c */