ack/plat/linux386/libsys/_syscall.s
David Given c93cb69959 Check in incomplete Linux PowerPC and M68K work.
--HG--
branch : dtrg-experimental-powerpc
2013-05-08 00:48:48 +01:00

46 lines
580 B
ArmAsm

#
! $Source$
! $State$
! $Revision$
! Declare segments (the order is important).
.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .text
EINVAL = 22
! Perform a Linux system call.
.define __syscall
__syscall:
mov eax, 4(esp)
mov ebx, 8(esp)
mov ecx, 12(esp)
mov edx, 16(esp)
int 0x80
or eax, eax
jl 1f
ret
1:
neg eax
! It just so happens that errnos 1-34 are the same in Linux as in the ACK.
cmp eax, 1
jb 2f
cmp eax, 34
ja 2f
mov (_errno), eax
3:
mov eax, -1
ret
2:
! All other errnos become EINVAL for now. FIXME dtrg.
mov (_errno), EINVAL
jmp 3b