1 #include "sys/syscall.h"
7 extern char _start_heap
;
9 extern char _start_bss
;
13 static int argl(long value
)
15 asm("ld r0,%H0" : : "r" (value
));
16 asm("ld r1,%I0" : : "r" (value
));
17 asm("sc %0" : : "i" (SYS_ARG
));
21 static int argw(value
)
23 asm("ld r1,%H0" : : "r" ( value
));
25 asm("sc %0" : : "i" (SYS_ARG
));
28 static int argp(void *value
)
31 asm("ld r0,%H0" : : "r" (value
));
32 asm("ld r1,%I0" : : "r" (value
));
34 asm("ld r1,%H0" : : "r" ( value
));
37 asm("sc %0" : : "i" (SYS_ARG
));
43 #define ARGL(n, value) argl(value)
44 #define ARGW(n, value) argw(value)
45 #define ARGP(n, value) argp(value)
47 #define MACRO(n) asm("sc %0" : : "i" (n));
49 int _read (int fd
, char *buf
,size_t nbytes
)
53 ARGP(2,(void *)(nbytes
));
57 int _write (int fd
, char *buf
, size_t nbytes
)
61 ARGP(2,(void *)(nbytes
));
65 int _open (const char *buf
, int flags
, int mode
)
80 * sbrk -- changes heap size size. Get nbytes more
81 * RAM. We just increment a pointer in what's
82 * left of memory on the board.
84 caddr_t
_sbrk (size_t nbytes
)
86 static char* heap_ptr
= NULL
;
89 if (heap_ptr
== NULL
) {
90 heap_ptr
= (caddr_t
)&_start_heap
;
93 if (heap_ptr
+ nbytes
< &_end_heap
) {
109 off_t
_lseek (int fd
, off_t offset
, int whence
)
117 int _fstat (int fd
, struct stat
*buf
)
134 time_t _time(time_t *timer
)
141 _creat (const char *path
, int mode
)
148 _kill(int pid
, int val
)