4 #include "sys/syscall.h"
14 return __trap3 (SYS_read
, file
, ptr
, len
);
23 return __trap3 (SYS_lseek
, file
, ptr
, dir
);
29 asm ("lda %0" : : "r" (c
));
41 return __trap3 (SYS_write
, file
, ptr
, len
);
49 return __trap3 (SYS_close
, file
, 0, 0);
57 extern char end
; /* Defined by the linker */
58 static char *heap_end
;
65 prev_heap_end
= heap_end
;
66 if (heap_end
+ incr
> stack_ptr
)
68 _write (1, "Heap and stack collision\n", 25);
73 return (caddr_t
) prev_heap_end
;
83 st
->st_mode
= S_IFCHR
;
93 return __trap3 (SYS_open
, path
, flags
, 0);
112 return __trap3 (SYS_exit
, n
, 0, 0);
118 return __trap3 (SYS_exit
, 0xdead, 0, 0);
136 _stat (const char *path
, struct stat
*st
)
139 return _trap3 (SYS_stat
, path
, st
, 0);
143 _chmod (const char *path
, short mode
)
145 return _trap3 (SYS_chmod
, path
, mode
);
149 _chown (const char *path
, short owner
, short group
)
151 return _trap3 (SYS_chown
, path
, owner
, group
);
159 return _trap3 (SYS_utime
, path
, times
);
165 return _trap3 (SYS_fork
);
172 return _trap3 (SYS_wait
);
176 _execve (const char *path
, char *const argv
[], char *const envp
[])
178 return _trap3 (SYS_execve
, path
, argv
, envp
);
182 _execv (const char *path
, char *const argv
[])
184 return _trap3 (SYS_execv
, path
, argv
);
190 return _trap3 (SYS_pipe
, fd
);