2013-05-07 23:48:48 +00:00
|
|
|
#
|
|
|
|
! $Source: /cvsroot/tack/Ack/plat/linux386/libsys/_syscall.s,v $
|
|
|
|
! $State: Exp $
|
|
|
|
! $Revision: 1.1 $
|
|
|
|
|
|
|
|
! Declare segments (the order is important).
|
|
|
|
|
|
|
|
.sect .text
|
|
|
|
.sect .rom
|
|
|
|
.sect .data
|
|
|
|
.sect .bss
|
|
|
|
|
|
|
|
.sect .text
|
|
|
|
|
2018-01-12 01:04:27 +00:00
|
|
|
#define EINVAL 22
|
2013-05-07 23:48:48 +00:00
|
|
|
|
|
|
|
! Perform a Linux system call.
|
|
|
|
|
|
|
|
.define __syscall
|
|
|
|
__syscall:
|
|
|
|
lwz r0, 0(sp)
|
|
|
|
lwz r3, 4(sp)
|
|
|
|
lwz r4, 8(sp)
|
|
|
|
lwz r5, 12(sp)
|
|
|
|
sc 0
|
2018-01-12 01:04:27 +00:00
|
|
|
bnslr
|
|
|
|
|
2013-05-07 23:48:48 +00:00
|
|
|
! On error, r3 contains the errno.
|
|
|
|
! It just so happens that errnos 1-34 are the same in Linux as in ACK.
|
2018-01-12 01:04:27 +00:00
|
|
|
cmpwi r3, 1
|
|
|
|
blt 2f
|
|
|
|
cmpwi r3, 34
|
|
|
|
bgt 2f
|
|
|
|
|
2013-05-07 23:48:48 +00:00
|
|
|
3:
|
2018-01-12 01:04:27 +00:00
|
|
|
lis r4, ha16[_errno]
|
|
|
|
stw r3, lo16[_errno](r4)
|
|
|
|
li r3, -1
|
|
|
|
blr
|
|
|
|
|
2013-05-07 23:48:48 +00:00
|
|
|
2:
|
2018-01-12 01:04:27 +00:00
|
|
|
li r3, EINVAL
|
2013-05-07 23:48:48 +00:00
|
|
|
b 3b
|