fixed more binutils issues (newer gcc/libc)
[zpugcc/jano.git] / toolchain / gcc / libgloss / xstormy16 / syscalls.m4
blobab71fc6d5ccd1c467467a036f266686787bcafe9
1 # xstormy16 system calls for the simulator
3 #include <syscall.h>
5         .text
7 define(`syscall',`.globl _`'$1
8 _`'$1`':
9         mov r1,#SYS_$1
10         .hword 0x0001
11         bnz r1,#0,syscall_error
12         ret
13 0:      .size $1,0b-_$1
14 ')dnl
15         syscall(exit)
16         syscall(open)
17         syscall(close)
18         syscall(read)
19         syscall(write)
20         syscall(lseek)
21         syscall(unlink)
22         syscall(getpid)
23         syscall(kill)
24         syscall(fstat)
25         syscall(chdir)
26         syscall(stat)
27         syscall(chmod)
28         syscall(utime)
29         syscall(time)
30         syscall(gettimeofday)
31         syscall(times)
32         syscall(link)
33 dnl
34 syscall_error:
35         push r0
36         callf __errno
37         pop r0
38         mov.w (r2),r0
39         ret
40 0:      .size syscall_error,0b-syscall_error