source: trunk/libs/newlib/src/libgloss/xstormy16/syscalls.S @ 444

Last change on this file since 444 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 2.3 KB
Line 
1# xstormy16 system calls for the simulator
2
3#include <syscall.h>
4
5        .text
6
7        .globl _exit
8_exit:
9        mov r1,#SYS_exit
10        .hword 0x0001
11        bnz r1,#0,syscall_error
12        ret
130:      .size exit,0b-_exit
14
15        .globl _open
16_open:
17        mov r1,#SYS_open
18        .hword 0x0001
19        bnz r1,#0,syscall_error
20        ret
210:      .size open,0b-_open
22
23        .globl _close
24_close:
25        mov r1,#SYS_close
26        .hword 0x0001
27        bnz r1,#0,syscall_error
28        ret
290:      .size close,0b-_close
30
31        .globl _read
32_read:
33        mov r1,#SYS_read
34        .hword 0x0001
35        bnz r1,#0,syscall_error
36        ret
370:      .size read,0b-_read
38
39        .globl _write
40_write:
41        mov r1,#SYS_write
42        .hword 0x0001
43        bnz r1,#0,syscall_error
44        ret
450:      .size write,0b-_write
46
47        .globl _lseek
48_lseek:
49        mov r1,#SYS_lseek
50        .hword 0x0001
51        bnz r1,#0,syscall_error
52        ret
530:      .size lseek,0b-_lseek
54
55        .globl _unlink
56_unlink:
57        mov r1,#SYS_unlink
58        .hword 0x0001
59        bnz r1,#0,syscall_error
60        ret
610:      .size unlink,0b-_unlink
62
63        .globl _getpid
64_getpid:
65        mov r1,#SYS_getpid
66        .hword 0x0001
67        bnz r1,#0,syscall_error
68        ret
690:      .size getpid,0b-_getpid
70
71        .globl _kill
72_kill:
73        mov r1,#SYS_kill
74        .hword 0x0001
75        bnz r1,#0,syscall_error
76        ret
770:      .size kill,0b-_kill
78
79        .globl _fstat
80_fstat:
81        mov r1,#SYS_fstat
82        .hword 0x0001
83        bnz r1,#0,syscall_error
84        ret
850:      .size fstat,0b-_fstat
86
87        .globl _chdir
88_chdir:
89        mov r1,#SYS_chdir
90        .hword 0x0001
91        bnz r1,#0,syscall_error
92        ret
930:      .size chdir,0b-_chdir
94
95        .globl _stat
96_stat:
97        mov r1,#SYS_stat
98        .hword 0x0001
99        bnz r1,#0,syscall_error
100        ret
1010:      .size stat,0b-_stat
102
103        .globl _chmod
104_chmod:
105        mov r1,#SYS_chmod
106        .hword 0x0001
107        bnz r1,#0,syscall_error
108        ret
1090:      .size chmod,0b-_chmod
110
111        .globl _utime
112_utime:
113        mov r1,#SYS_utime
114        .hword 0x0001
115        bnz r1,#0,syscall_error
116        ret
1170:      .size utime,0b-_utime
118
119        .globl _time
120_time:
121        mov r1,#SYS_time
122        .hword 0x0001
123        bnz r1,#0,syscall_error
124        ret
1250:      .size time,0b-_time
126
127        .globl _gettimeofday
128_gettimeofday:
129        mov r1,#SYS_gettimeofday
130        .hword 0x0001
131        bnz r1,#0,syscall_error
132        ret
1330:      .size gettimeofday,0b-_gettimeofday
134
135        .globl _times
136_times:
137        mov r1,#SYS_times
138        .hword 0x0001
139        bnz r1,#0,syscall_error
140        ret
1410:      .size times,0b-_times
142
143        .globl _link
144_link:
145        mov r1,#SYS_link
146        .hword 0x0001
147        bnz r1,#0,syscall_error
148        ret
1490:      .size link,0b-_link
150
151syscall_error:
152# Return value for the syscall is in r2.  Save it here, as
153# _errno will overwrite it with the address of the errno
154# variable.  r0 is the errno.
155        push r2
156        push r0
157        callf __errno
158        pop r0
159        mov.w (r2),r0
160        pop r2
161        ret
1620:      .size syscall_error,0b-syscall_error
Note: See TracBrowser for help on using the repository browser.