#include <_ansi.h> #include #include #include #include #include "sys/syscall.h" #include "sys/console.h" int errno; /* This is used by _sbrk. */ register char *stack_ptr asm ("r15"); int _read (int file, char *ptr, int len) { _console_read(&_console_ctx, file, ptr, len); return len; } int _lseek (int file, int ptr, int dir) { return 0; } int _write ( int file, char *ptr, int len) { _console_write(&_console_ctx, file, ptr, len); return len; } int _close (int file) { return 0; } int _link (char *old, char *new) { errno = EMLINK; return -1; } caddr_t _sbrk (int incr) { return -1; } int _fstat (int file, struct stat *st) { /* All files are regarded as character special devices */ st->st_mode = S_IFCHR; return 0; } int _open (const char *path, int flags) { return -1; } int _creat (const char *path, int mode) { return -1; } int _unlink () { errno = ENOENT; return -1; } int _isatty (int fd) { /* Every output stream is a terminal */ return 1; } _exit (n) { return -1; } int _kill (int pid, int sig) { errno = EINVAL; return -1; } int getpid (void) { return 1; } int raise(int sig) { return -1; } int _stat (const char *path, struct stat *st) { st->st_mode = S_IFCHR; return 0; } int _chmod (const char *path, short mode) { return -1; } int _chown (const char *path, short owner, short group) { return -1; } int _utime (path, times) const char *path; char *times; { return -1; } int _fork () { errno = EAGAIN; return -1; } int _wait (statusp) int *statusp; { errno = ECHILD; return -1; } int _execve (const char *path, char *const argv[], char *const envp[]) { errno = ENOMEM; return -1; } int _execv (const char *path, char *const argv[]) { return -1; } int _pipe (int *fd) { return -1; } /* This is only provided because _gettimeofday_r and _times_r are defined in the same module, so we avoid a link error. */ clock_t _times (struct tms *tp) { return -1; } int _gettimeofday (struct timeval *tv, void *tz) { //tv->tv_usec = 0; //tv->tv_sec = __trap34 (SYS_time); return -1; } int __setup_argv_and_call_main () { return main (0, NULL); }