Last change
on this file since 495 was
444,
checked in by satin@…, 7 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
1.9 KB
|
Rev | Line | |
---|
[444] | 1 | /* FR30 system call emulation code |
---|
| 2 | Copyright (C) 1998, 2010 Free Software Foundation, Inc. |
---|
| 3 | Contributed by Cygnus Solutions. */ |
---|
| 4 | |
---|
| 5 | #include <sys/stat.h> |
---|
| 6 | #include "../syscall.h" |
---|
| 7 | |
---|
| 8 | int |
---|
| 9 | _read (file, ptr, len) |
---|
| 10 | int file; |
---|
| 11 | char * ptr; |
---|
| 12 | int len; |
---|
| 13 | { |
---|
| 14 | asm ("ldi:8 %0, r0" :: "i" (SYS_read) : "r0"); |
---|
| 15 | asm ("int #10"); |
---|
| 16 | |
---|
| 17 | return; |
---|
| 18 | } |
---|
| 19 | |
---|
| 20 | int |
---|
| 21 | _lseek (file, ptr, dir) |
---|
| 22 | int file; |
---|
| 23 | int ptr; |
---|
| 24 | int dir; |
---|
| 25 | { |
---|
| 26 | asm ("ldi:8 %0, r0" :: "i" (SYS_lseek) : "r0"); |
---|
| 27 | asm ("int #10"); |
---|
| 28 | |
---|
| 29 | return; |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | int |
---|
| 33 | _write (file, ptr, len) |
---|
| 34 | int file; |
---|
| 35 | char * ptr; |
---|
| 36 | int len; |
---|
| 37 | { |
---|
| 38 | asm ("ldi:8 %0, r0" :: "i" (SYS_write) : "r0"); |
---|
| 39 | asm ("int #10"); |
---|
| 40 | |
---|
| 41 | return; |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | int |
---|
| 45 | _open (path, flags) |
---|
| 46 | const char * path; |
---|
| 47 | int flags; |
---|
| 48 | { |
---|
| 49 | asm ("ldi:8 %0, r0" :: "i" (SYS_open) : "r0"); |
---|
| 50 | asm ("int #10"); |
---|
| 51 | |
---|
| 52 | return; |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | int |
---|
| 56 | _close (file) |
---|
| 57 | int file; |
---|
| 58 | { |
---|
| 59 | asm ("ldi:8 %0, r0" :: "i" (SYS_close) : "r0"); |
---|
| 60 | asm ("int #10"); |
---|
| 61 | |
---|
| 62 | return 0; |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | void |
---|
| 66 | _exit (n) |
---|
| 67 | int n; |
---|
| 68 | { |
---|
| 69 | asm ("ldi:8 %0, r0" :: "i" (SYS_exit) : "r0"); |
---|
| 70 | asm ("int #10"); |
---|
| 71 | } |
---|
| 72 | |
---|
| 73 | |
---|
| 74 | caddr_t |
---|
| 75 | _sbrk (incr) |
---|
| 76 | int incr; |
---|
| 77 | { |
---|
| 78 | extern char end asm ("_end"); /* Defined by the linker */ |
---|
| 79 | extern int __stack; /* Defined by linker script. */ |
---|
| 80 | static char * heap_end; |
---|
| 81 | char * prev_heap_end; |
---|
| 82 | |
---|
| 83 | if (heap_end == NULL) |
---|
| 84 | heap_end = & end; |
---|
| 85 | |
---|
| 86 | prev_heap_end = heap_end; |
---|
| 87 | #if 0 |
---|
| 88 | if (heap_end + incr > __stack) |
---|
| 89 | { |
---|
| 90 | _write ( 1, "_sbrk: Heap and stack collision\n", 32); |
---|
| 91 | abort (); |
---|
| 92 | } |
---|
| 93 | #endif |
---|
| 94 | heap_end += incr; |
---|
| 95 | |
---|
| 96 | return (caddr_t) prev_heap_end; |
---|
| 97 | } |
---|
| 98 | |
---|
| 99 | int |
---|
| 100 | _fstat (file, st) |
---|
| 101 | int file; |
---|
| 102 | struct stat * st; |
---|
| 103 | { |
---|
| 104 | st->st_mode = S_IFCHR; |
---|
| 105 | return 0; |
---|
| 106 | } |
---|
| 107 | |
---|
| 108 | int |
---|
| 109 | _unlink () |
---|
| 110 | { |
---|
| 111 | return -1; |
---|
| 112 | } |
---|
| 113 | |
---|
| 114 | int |
---|
| 115 | _isatty (fd) |
---|
| 116 | int fd; |
---|
| 117 | { |
---|
| 118 | return 0; |
---|
| 119 | } |
---|
| 120 | |
---|
| 121 | int |
---|
| 122 | _raise () |
---|
| 123 | { |
---|
| 124 | return 0; |
---|
| 125 | } |
---|
| 126 | |
---|
| 127 | int |
---|
| 128 | _times () |
---|
| 129 | { |
---|
| 130 | return 0; |
---|
| 131 | } |
---|
| 132 | |
---|
| 133 | int |
---|
| 134 | _kill (pid, sig) |
---|
| 135 | int pid; |
---|
| 136 | int sig; |
---|
| 137 | { |
---|
| 138 | return 0; |
---|
| 139 | } |
---|
| 140 | |
---|
| 141 | int |
---|
| 142 | _getpid (void) |
---|
| 143 | { |
---|
| 144 | return 0; |
---|
| 145 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.