Call proper Linux system calls proper-like.
This commit is contained in:
parent
bb15c03339
commit
f3bc9ef92a
1 changed files with 16 additions and 0 deletions
|
@ -14,5 +14,21 @@
|
|||
|
||||
.define __syscall
|
||||
__syscall:
|
||||
lw r2, 0(sp) ! syscall number
|
||||
addiu r2, r2, 4000 ! MIPS uses non-standard numbers
|
||||
lw r4, 4(sp)
|
||||
lw r5, 8(sp)
|
||||
lw r6, 12(sp)
|
||||
syscall 0
|
||||
|
||||
beq r7, zero, exit ! branch on success
|
||||
nop
|
||||
|
||||
/* The result (in r2) is the errno. */
|
||||
lui at, ha16[_errno]
|
||||
sw r2, lo16[_errno] (at)
|
||||
li r2, -1
|
||||
exit:
|
||||
jr ra
|
||||
nop
|
||||
|
||||
|
|
Loading…
Reference in a new issue