|
@@ -0,0 +1,188 @@
|
|
|
+{
|
|
|
+ $Id$
|
|
|
+ Copyright (c) 2002 by Marco van de Voort
|
|
|
+
|
|
|
+ Syscall functions for i386 *BSD.
|
|
|
+
|
|
|
+ This program is free software; you can redistribute it and/or modify
|
|
|
+ it under the terms of the GNU General Public License as published by
|
|
|
+ the Free Software Foundation; either version 2 of the License, or
|
|
|
+ (at your option) any later version.
|
|
|
+
|
|
|
+ This program is distributed in the hope that it will be useful,
|
|
|
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
+ GNU General Public License for more details.
|
|
|
+
|
|
|
+ You should have received a copy of the GNU General Public License
|
|
|
+ along with this program; if not, write to the Free Software
|
|
|
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
+
|
|
|
+ ****************************************************************************
|
|
|
+
|
|
|
+These functions are the same over all three BSDs, except that some have a
|
|
|
+32-bit Errno, and some a 16-bit}
|
|
|
+
|
|
|
+{$ifdef NetBSD}
|
|
|
+ {$UNDEF ErrnoWord}
|
|
|
+{$endif}
|
|
|
+{$ifdef FreeBSD}
|
|
|
+ {$DEFINE ErrnoWord}
|
|
|
+{$endif}
|
|
|
+
|
|
|
+procedure actualsyscall; assembler; {inline requires a dummy push IIRC}
|
|
|
+ asm
|
|
|
+ int $0x80
|
|
|
+ jb .LErrorcode
|
|
|
+ xor %ebx,%ebx
|
|
|
+ ret
|
|
|
+.LErrorcode:
|
|
|
+ mov %eax,%ebx
|
|
|
+ mov $-1,%eax
|
|
|
+ end;
|
|
|
+
|
|
|
+function Do_SysCall(sysnr:LONGINT):longint; assembler;
|
|
|
+
|
|
|
+asm
|
|
|
+ movl sysnr,%eax
|
|
|
+ call actualsyscall
|
|
|
+{$ifdef ErrnoWord}
|
|
|
+ movw %bx,Errno
|
|
|
+{$else}
|
|
|
+ movl %ebx,Errno
|
|
|
+{$endif}
|
|
|
+end;
|
|
|
+
|
|
|
+function Do_SysCall(sysnr,param1:longint):longint; assembler;
|
|
|
+
|
|
|
+ asm
|
|
|
+ movl sysnr,%eax
|
|
|
+ pushl Param1
|
|
|
+ call actualsyscall
|
|
|
+ addl $4,%esp
|
|
|
+{$ifdef ErrnoWord}
|
|
|
+ movw %bx,Errno
|
|
|
+{$else}
|
|
|
+ movl %ebx,Errno
|
|
|
+{$endif}
|
|
|
+ end;
|
|
|
+
|
|
|
+function Do_SysCall(sysnr,param1:integer):longint; assembler;
|
|
|
+
|
|
|
+ asm
|
|
|
+ movl sysnr,%eax
|
|
|
+ pushw Param1
|
|
|
+ call actualsyscall
|
|
|
+ add $2,%esp
|
|
|
+{$ifdef ErrnoWord}
|
|
|
+ movw %bx,Errno
|
|
|
+{$else}
|
|
|
+ movl %ebx,Errno
|
|
|
+{$endif}
|
|
|
+ end;
|
|
|
+
|
|
|
+function Do_SysCall(sysnr,param1,param2:LONGINT):longint; assembler;
|
|
|
+
|
|
|
+ asm
|
|
|
+ movl sysnr,%eax
|
|
|
+ pushl param2
|
|
|
+ pushl Param1
|
|
|
+ call actualsyscall
|
|
|
+ addl $8,%esp
|
|
|
+{$ifdef ErrnoWord}
|
|
|
+ movw %bx,Errno
|
|
|
+{$else}
|
|
|
+ movl %ebx,Errno
|
|
|
+{$endif}
|
|
|
+ end;
|
|
|
+
|
|
|
+function Do_SysCall(sysnr,param1,param2,param3:LONGINT):longint; assembler;
|
|
|
+
|
|
|
+ asm
|
|
|
+ movl sysnr,%eax
|
|
|
+ pushl param3
|
|
|
+ pushl param2
|
|
|
+ pushl Param1
|
|
|
+ call actualsyscall
|
|
|
+ addl $12,%esp
|
|
|
+{$ifdef ErrnoWord}
|
|
|
+ movw %bx,Errno
|
|
|
+{$else}
|
|
|
+ movl %ebx,Errno
|
|
|
+{$endif}
|
|
|
+end;
|
|
|
+
|
|
|
+function Do_SysCall(sysnr,param1,param2,param3,param4:LONGINT):longint; assembler;
|
|
|
+
|
|
|
+asm
|
|
|
+ movl sysnr,%eax
|
|
|
+ pushl param4
|
|
|
+ pushl param3
|
|
|
+ pushl param2
|
|
|
+ pushl Param1
|
|
|
+ call actualsyscall
|
|
|
+ addl $16,%esp
|
|
|
+{$ifdef ErrnoWord}
|
|
|
+ movw %bx,Errno
|
|
|
+{$else}
|
|
|
+ movl %ebx,Errno
|
|
|
+{$endif}
|
|
|
+end;
|
|
|
+
|
|
|
+
|
|
|
+function Do_SysCall(sysnr,param1,param2,param3,param4,param5:LONGINT):longint; assembler;
|
|
|
+
|
|
|
+ asm
|
|
|
+ movl sysnr,%eax
|
|
|
+ pushl param5
|
|
|
+ pushl param4
|
|
|
+ pushl param3
|
|
|
+ pushl param2
|
|
|
+ pushl Param1
|
|
|
+ call actualsyscall
|
|
|
+ addl $20,%esp
|
|
|
+{$ifdef ErrnoWord}
|
|
|
+ movw %bx,Errno
|
|
|
+{$else}
|
|
|
+ movl %ebx,Errno
|
|
|
+{$endif}
|
|
|
+end;
|
|
|
+
|
|
|
+function Do_SysCall(sysnr,param1,param2,param3,param4,param5,param6:LONGINT):longint; assembler;
|
|
|
+
|
|
|
+asm
|
|
|
+ movl sysnr,%eax
|
|
|
+ pushl param6
|
|
|
+ pushl param5
|
|
|
+ pushl param4
|
|
|
+ pushl param3
|
|
|
+ pushl param2
|
|
|
+ pushl Param1
|
|
|
+ call actualsyscall
|
|
|
+ addl $24,%esp
|
|
|
+{$ifdef ErrnoWord}
|
|
|
+ movw %bx,Errno
|
|
|
+{$else}
|
|
|
+ movl %ebx,Errno
|
|
|
+{$endif}
|
|
|
+end;
|
|
|
+
|
|
|
+function Do_SysCall(sysnr,param1,param2,param3,param4,param5,param6,param7:LONGINT):longint; assembler;
|
|
|
+
|
|
|
+asm
|
|
|
+ movl sysnr,%eax
|
|
|
+ pushl param7
|
|
|
+ pushl param6
|
|
|
+ pushl param5
|
|
|
+ pushl param4
|
|
|
+ pushl param3
|
|
|
+ pushl param2
|
|
|
+ pushl Param1
|
|
|
+ call actualsyscall
|
|
|
+ addl $28,%esp
|
|
|
+{$ifdef ErrnoWord}
|
|
|
+ movw %bx,Errno
|
|
|
+{$else}
|
|
|
+ movl %ebx,Errno
|
|
|
+{$endif}
|
|
|
+end;
|