📄 syscall.68k
字号:
******************************************************************************* System calls to OMU from C********************************************************************************* called - syscall(no,arg1,arg2,arg3,arg4); .globl _syscall, _errno_syscall: move.l 4(a7),d0 ;Saves all arguments in movea.l 8(a7),a0 ;apropriate registers move.l 12(a7),d1 movea.l 16(a7),a1 move.l 20(a7),d2 trap #0 ;Does system call bcc noerr ;Checks if error move.l d0,_errno ;Sets errno move.l #-1,d0 ;returns -1noerr: rts ;Returns to calling program******************************************************************************* Switch process call to OMU from C******************************************************************************** called - swtch(proc);* proc = process table entry* .globl _swtch_swtch: move.l 4(a7),d0 ;Saves Proc table pointer in d0 trap #1 ;Does switch rts ;Returns to calling program******************************************************************************* wait Internal kernal wait system call******************************************************************************** called - wait(exit);* Sets *exit to exit status of child process* .globl _wait_wait: move.l #7,d0 ;Wait system call trap #0 ;System call bcc noerrw ;Checks if error move.l d0,_errno ;Sets errno move.l #-1,d0 ;returns -1noerrw: movea.l 4(a7),a1 ;Gets pointer to error status return address move.l d1,(a1) ;Sets error status rts******************************************************************************* fork Internal kernal fork system call******************************************************************************** called - fork();* returns child pid to parent 0 to child* .globl _fork_fork: move.l #2,d0 ;fork system call trap #0 ;System call bra child ;Branch to child process bcc parent ;Checks if error move.l d0,_errno ;Sets errno if error and parent move.l #-1,d0 ;returns -1 rtsparent: move.l #0,d0child: rts******************************************************************************* execve Internal kernal execve system call******************************************************************************** called - execve(name, argv, envp);* .globl _execve_execve: movea.l 4(a7),a0 ;Saves all arguments in move.l 8(a7),d1 ;apropriate registers movea.l 12(a7),a1 move.l #59,d0 ;execve system call trap #0 ;System call bcc execok ;Checks if error move.l d0,_errno ;Sets errno if error move.l #-1,d0 ;returns -1execok: rts
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -