mescc: Mes C Library: x86: Use long for syscalls.

The Linux signature uses long, also this allows for making
_sys_call and friends architecture-independent.

* lib/linux/x86-mes-mescc/syscall-internal.c (__sys_call_internal,
__sys_call2_internal): Use long.  Update callers.
* lib/linux/x86-mes-mescc/syscall.c (__sys_call, __sys_call1,
__sys_call2, __sys_call3, __sys_call4, _sys_call, _sys_call1,
_sys_call2, _sys_call3, _sys_call4): Likewise.
This commit is contained in:
Jan (janneke) Nieuwenhuizen 2020-08-30 12:09:32 +02:00
parent 5f8a424328
commit 1c128c7a9f
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
2 changed files with 31 additions and 31 deletions

View file

@ -20,15 +20,15 @@
#include <linux/x86/syscall.h> #include <linux/x86/syscall.h>
static int static long
__sys_call_internal (int sys_call) __sys_call_internal (long sys_call)
{ {
asm ("mov____0x8(%ebp),%eax !8"); asm ("mov____0x8(%ebp),%eax !8");
asm ("int____$0x80"); asm ("int____$0x80");
} }
static int static long
__sys_call2_internal (int sys_call, int one, int two) __sys_call2_internal (long sys_call, long one, long two)
{ {
asm ("mov____0x8(%ebp),%eax !8"); asm ("mov____0x8(%ebp),%eax !8");
asm ("mov____0x8(%ebp),%ebx !12"); asm ("mov____0x8(%ebp),%ebx !12");
@ -40,9 +40,9 @@ __sys_call2_internal (int sys_call, int one, int two)
int int
__raise (int signum) __raise (int signum)
{ {
int pid = __sys_call_internal (SYS_getpid); int pid = (int) __sys_call_internal (SYS_getpid);
if (pid < 0) if (pid < 0)
return pid; return pid;
else else
return __sys_call2_internal (SYS_kill, pid, signum); return (int) __sys_call2_internal (SYS_kill, pid, signum);
} }

View file

@ -21,23 +21,23 @@
#include <errno.h> #include <errno.h>
#include <linux/x86/syscall.h> #include <linux/x86/syscall.h>
int long
__sys_call (int sys_call) __sys_call (long sys_call)
{ {
asm ("mov____0x8(%ebp),%eax !8"); asm ("mov____0x8(%ebp),%eax !8");
asm ("int____$0x80"); asm ("int____$0x80");
} }
int long
__sys_call1 (int sys_call, int one) __sys_call1 (long sys_call, long one)
{ {
asm ("mov____0x8(%ebp),%eax !8"); asm ("mov____0x8(%ebp),%eax !8");
asm ("mov____0x8(%ebp),%ebx !12"); asm ("mov____0x8(%ebp),%ebx !12");
asm ("int____$0x80"); asm ("int____$0x80");
} }
int long
__sys_call2 (int sys_call, int one, int two) __sys_call2 (long sys_call, long one, long two)
{ {
asm ("mov____0x8(%ebp),%eax !8"); asm ("mov____0x8(%ebp),%eax !8");
asm ("mov____0x8(%ebp),%ebx !12"); asm ("mov____0x8(%ebp),%ebx !12");
@ -45,8 +45,8 @@ __sys_call2 (int sys_call, int one, int two)
asm ("int____$0x80"); asm ("int____$0x80");
} }
int long
__sys_call3 (int sys_call, int one, int two, int three) __sys_call3 (long sys_call, long one, long two, long three)
{ {
asm ("mov____0x8(%ebp),%eax !8"); asm ("mov____0x8(%ebp),%eax !8");
asm ("mov____0x8(%ebp),%ebx !12"); asm ("mov____0x8(%ebp),%ebx !12");
@ -55,8 +55,8 @@ __sys_call3 (int sys_call, int one, int two, int three)
asm ("int____$0x80"); asm ("int____$0x80");
} }
int long
__sys_call4 (int sys_call, int one, int two, int three, int four) __sys_call4 (long sys_call, long one, long two, long three, long four)
{ {
asm ("mov____0x8(%ebp),%eax !8"); asm ("mov____0x8(%ebp),%eax !8");
asm ("mov____0x8(%ebp),%ebx !12"); asm ("mov____0x8(%ebp),%ebx !12");
@ -66,10 +66,10 @@ __sys_call4 (int sys_call, int one, int two, int three, int four)
asm ("int____$0x80"); asm ("int____$0x80");
} }
int long
_sys_call (int sys_call) _sys_call (long sys_call)
{ {
int r = __sys_call (sys_call); long r = __sys_call (sys_call);
if (r < 0) if (r < 0)
{ {
errno = -r; errno = -r;
@ -80,10 +80,10 @@ _sys_call (int sys_call)
return r; return r;
} }
int long
_sys_call1 (int sys_call, int one) _sys_call1 (long sys_call, long one)
{ {
int r = __sys_call1 (sys_call, one); long r = __sys_call1 (sys_call, one);
if (r < 0) if (r < 0)
{ {
errno = -r; errno = -r;
@ -94,10 +94,10 @@ _sys_call1 (int sys_call, int one)
return r; return r;
} }
int long
_sys_call2 (int sys_call, int one, int two) _sys_call2 (long sys_call, long one, long two)
{ {
int r = __sys_call2 (sys_call, one, two); long r = __sys_call2 (sys_call, one, two);
if (r < 0) if (r < 0)
{ {
errno = -r; errno = -r;
@ -108,10 +108,10 @@ _sys_call2 (int sys_call, int one, int two)
return r; return r;
} }
int long
_sys_call3 (int sys_call, int one, int two, int three) _sys_call3 (long sys_call, long one, long two, long three)
{ {
int r = __sys_call3 (sys_call, one, two, three); long r = __sys_call3 (sys_call, one, two, three);
if (r < 0) if (r < 0)
{ {
errno = -r; errno = -r;
@ -122,10 +122,10 @@ _sys_call3 (int sys_call, int one, int two, int three)
return r; return r;
} }
int long
_sys_call4 (int sys_call, int one, int two, int three, int four) _sys_call4 (long sys_call, long one, long two, long three, long four)
{ {
int r = __sys_call4 (sys_call, one, two, three, four); long r = __sys_call4 (sys_call, one, two, three, four);
if (r < 0) if (r < 0)
{ {
errno = -r; errno = -r;