📄 syscalls.s
字号:
# xstormy16 system calls for the simulator#include <syscall.h> .text .globl _exit_exit: mov r1,#SYS_exit .hword 0x0001 bnz r1,#0,syscall_error ret0: .size exit,0b-_exit .globl _open_open: mov r1,#SYS_open .hword 0x0001 bnz r1,#0,syscall_error ret0: .size open,0b-_open .globl _close_close: mov r1,#SYS_close .hword 0x0001 bnz r1,#0,syscall_error ret0: .size close,0b-_close .globl _read_read: mov r1,#SYS_read .hword 0x0001 bnz r1,#0,syscall_error ret0: .size read,0b-_read .globl _write_write: mov r1,#SYS_write .hword 0x0001 bnz r1,#0,syscall_error ret0: .size write,0b-_write .globl _lseek_lseek: mov r1,#SYS_lseek .hword 0x0001 bnz r1,#0,syscall_error ret0: .size lseek,0b-_lseek .globl _unlink_unlink: mov r1,#SYS_unlink .hword 0x0001 bnz r1,#0,syscall_error ret0: .size unlink,0b-_unlink .globl _getpid_getpid: mov r1,#SYS_getpid .hword 0x0001 bnz r1,#0,syscall_error ret0: .size getpid,0b-_getpid .globl _kill_kill: mov r1,#SYS_kill .hword 0x0001 bnz r1,#0,syscall_error ret0: .size kill,0b-_kill .globl _fstat_fstat: mov r1,#SYS_fstat .hword 0x0001 bnz r1,#0,syscall_error ret0: .size fstat,0b-_fstat .globl _chdir_chdir: mov r1,#SYS_chdir .hword 0x0001 bnz r1,#0,syscall_error ret0: .size chdir,0b-_chdir .globl _stat_stat: mov r1,#SYS_stat .hword 0x0001 bnz r1,#0,syscall_error ret0: .size stat,0b-_stat .globl _chmod_chmod: mov r1,#SYS_chmod .hword 0x0001 bnz r1,#0,syscall_error ret0: .size chmod,0b-_chmod .globl _utime_utime: mov r1,#SYS_utime .hword 0x0001 bnz r1,#0,syscall_error ret0: .size utime,0b-_utime .globl _time_time: mov r1,#SYS_time .hword 0x0001 bnz r1,#0,syscall_error ret0: .size time,0b-_time .globl _gettimeofday_gettimeofday: mov r1,#SYS_gettimeofday .hword 0x0001 bnz r1,#0,syscall_error ret0: .size gettimeofday,0b-_gettimeofday .globl _times_times: mov r1,#SYS_times .hword 0x0001 bnz r1,#0,syscall_error ret0: .size times,0b-_times .globl _link_link: mov r1,#SYS_link .hword 0x0001 bnz r1,#0,syscall_error ret0: .size link,0b-_linksyscall_error:# Return value for the syscall is in r2. Save it here, as# _errno will overwrite it with the address of the errno# variable. r0 is the errno. push r2 push r0 callf __errno pop r0 mov.w (r2),r0 pop r2 ret0: .size syscall_error,0b-syscall_error
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -