URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Go to most recent revision |
Only display areas with differences |
Details |
Blame |
View Log
Rev 158 |
Rev 816 |
# xstormy16 system calls for the simulator
|
# xstormy16 system calls for the simulator
|
|
|
#include
|
#include
|
|
|
.text
|
.text
|
|
|
.globl _exit
|
.globl _exit
|
_exit:
|
_exit:
|
mov r1,#SYS_exit
|
mov r1,#SYS_exit
|
.hword 0x0001
|
.hword 0x0001
|
bnz r1,#0,syscall_error
|
bnz r1,#0,syscall_error
|
ret
|
ret
|
0: .size exit,0b-_exit
|
0: .size exit,0b-_exit
|
|
|
.globl _open
|
.globl _open
|
_open:
|
_open:
|
mov r1,#SYS_open
|
mov r1,#SYS_open
|
.hword 0x0001
|
.hword 0x0001
|
bnz r1,#0,syscall_error
|
bnz r1,#0,syscall_error
|
ret
|
ret
|
0: .size open,0b-_open
|
0: .size open,0b-_open
|
|
|
.globl _close
|
.globl _close
|
_close:
|
_close:
|
mov r1,#SYS_close
|
mov r1,#SYS_close
|
.hword 0x0001
|
.hword 0x0001
|
bnz r1,#0,syscall_error
|
bnz r1,#0,syscall_error
|
ret
|
ret
|
0: .size close,0b-_close
|
0: .size close,0b-_close
|
|
|
.globl _read
|
.globl _read
|
_read:
|
_read:
|
mov r1,#SYS_read
|
mov r1,#SYS_read
|
.hword 0x0001
|
.hword 0x0001
|
bnz r1,#0,syscall_error
|
bnz r1,#0,syscall_error
|
ret
|
ret
|
0: .size read,0b-_read
|
0: .size read,0b-_read
|
|
|
.globl _write
|
.globl _write
|
_write:
|
_write:
|
mov r1,#SYS_write
|
mov r1,#SYS_write
|
.hword 0x0001
|
.hword 0x0001
|
bnz r1,#0,syscall_error
|
bnz r1,#0,syscall_error
|
ret
|
ret
|
0: .size write,0b-_write
|
0: .size write,0b-_write
|
|
|
.globl _lseek
|
.globl _lseek
|
_lseek:
|
_lseek:
|
mov r1,#SYS_lseek
|
mov r1,#SYS_lseek
|
.hword 0x0001
|
.hword 0x0001
|
bnz r1,#0,syscall_error
|
bnz r1,#0,syscall_error
|
ret
|
ret
|
0: .size lseek,0b-_lseek
|
0: .size lseek,0b-_lseek
|
|
|
.globl _unlink
|
.globl _unlink
|
_unlink:
|
_unlink:
|
mov r1,#SYS_unlink
|
mov r1,#SYS_unlink
|
.hword 0x0001
|
.hword 0x0001
|
bnz r1,#0,syscall_error
|
bnz r1,#0,syscall_error
|
ret
|
ret
|
0: .size unlink,0b-_unlink
|
0: .size unlink,0b-_unlink
|
|
|
.globl _getpid
|
.globl _getpid
|
_getpid:
|
_getpid:
|
mov r1,#SYS_getpid
|
mov r1,#SYS_getpid
|
.hword 0x0001
|
.hword 0x0001
|
bnz r1,#0,syscall_error
|
bnz r1,#0,syscall_error
|
ret
|
ret
|
0: .size getpid,0b-_getpid
|
0: .size getpid,0b-_getpid
|
|
|
.globl _kill
|
.globl _kill
|
_kill:
|
_kill:
|
mov r1,#SYS_kill
|
mov r1,#SYS_kill
|
.hword 0x0001
|
.hword 0x0001
|
bnz r1,#0,syscall_error
|
bnz r1,#0,syscall_error
|
ret
|
ret
|
0: .size kill,0b-_kill
|
0: .size kill,0b-_kill
|
|
|
.globl _fstat
|
.globl _fstat
|
_fstat:
|
_fstat:
|
mov r1,#SYS_fstat
|
mov r1,#SYS_fstat
|
.hword 0x0001
|
.hword 0x0001
|
bnz r1,#0,syscall_error
|
bnz r1,#0,syscall_error
|
ret
|
ret
|
0: .size fstat,0b-_fstat
|
0: .size fstat,0b-_fstat
|
|
|
.globl _chdir
|
.globl _chdir
|
_chdir:
|
_chdir:
|
mov r1,#SYS_chdir
|
mov r1,#SYS_chdir
|
.hword 0x0001
|
.hword 0x0001
|
bnz r1,#0,syscall_error
|
bnz r1,#0,syscall_error
|
ret
|
ret
|
0: .size chdir,0b-_chdir
|
0: .size chdir,0b-_chdir
|
|
|
.globl _stat
|
.globl _stat
|
_stat:
|
_stat:
|
mov r1,#SYS_stat
|
mov r1,#SYS_stat
|
.hword 0x0001
|
.hword 0x0001
|
bnz r1,#0,syscall_error
|
bnz r1,#0,syscall_error
|
ret
|
ret
|
0: .size stat,0b-_stat
|
0: .size stat,0b-_stat
|
|
|
.globl _chmod
|
.globl _chmod
|
_chmod:
|
_chmod:
|
mov r1,#SYS_chmod
|
mov r1,#SYS_chmod
|
.hword 0x0001
|
.hword 0x0001
|
bnz r1,#0,syscall_error
|
bnz r1,#0,syscall_error
|
ret
|
ret
|
0: .size chmod,0b-_chmod
|
0: .size chmod,0b-_chmod
|
|
|
.globl _utime
|
.globl _utime
|
_utime:
|
_utime:
|
mov r1,#SYS_utime
|
mov r1,#SYS_utime
|
.hword 0x0001
|
.hword 0x0001
|
bnz r1,#0,syscall_error
|
bnz r1,#0,syscall_error
|
ret
|
ret
|
0: .size utime,0b-_utime
|
0: .size utime,0b-_utime
|
|
|
.globl _time
|
.globl _time
|
_time:
|
_time:
|
mov r1,#SYS_time
|
mov r1,#SYS_time
|
.hword 0x0001
|
.hword 0x0001
|
bnz r1,#0,syscall_error
|
bnz r1,#0,syscall_error
|
ret
|
ret
|
0: .size time,0b-_time
|
0: .size time,0b-_time
|
|
|
.globl _gettimeofday
|
.globl _gettimeofday
|
_gettimeofday:
|
_gettimeofday:
|
mov r1,#SYS_gettimeofday
|
mov r1,#SYS_gettimeofday
|
.hword 0x0001
|
.hword 0x0001
|
bnz r1,#0,syscall_error
|
bnz r1,#0,syscall_error
|
ret
|
ret
|
0: .size gettimeofday,0b-_gettimeofday
|
0: .size gettimeofday,0b-_gettimeofday
|
|
|
.globl _times
|
.globl _times
|
_times:
|
_times:
|
mov r1,#SYS_times
|
mov r1,#SYS_times
|
.hword 0x0001
|
.hword 0x0001
|
bnz r1,#0,syscall_error
|
bnz r1,#0,syscall_error
|
ret
|
ret
|
0: .size times,0b-_times
|
0: .size times,0b-_times
|
|
|
.globl _link
|
.globl _link
|
_link:
|
_link:
|
mov r1,#SYS_link
|
mov r1,#SYS_link
|
.hword 0x0001
|
.hword 0x0001
|
bnz r1,#0,syscall_error
|
bnz r1,#0,syscall_error
|
ret
|
ret
|
0: .size link,0b-_link
|
0: .size link,0b-_link
|
|
|
syscall_error:
|
syscall_error:
|
# Return value for the syscall is in r2. Save it here, as
|
# Return value for the syscall is in r2. Save it here, as
|
# _errno will overwrite it with the address of the errno
|
# _errno will overwrite it with the address of the errno
|
# variable. r0 is the errno.
|
# variable. r0 is the errno.
|
push r2
|
push r2
|
push r0
|
push r0
|
callf __errno
|
callf __errno
|
pop r0
|
pop r0
|
mov.w (r2),r0
|
mov.w (r2),r0
|
pop r2
|
pop r2
|
ret
|
ret
|
0: .size syscall_error,0b-syscall_error
|
0: .size syscall_error,0b-syscall_error
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.