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>
static int
__sys_call_internal (int sys_call)
static long
__sys_call_internal (long sys_call)
{
asm ("mov____0x8(%ebp),%eax !8");
asm ("int____$0x80");
}
static int
__sys_call2_internal (int sys_call, int one, int two)
static long
__sys_call2_internal (long sys_call, long one, long two)
{
asm ("mov____0x8(%ebp),%eax !8");
asm ("mov____0x8(%ebp),%ebx !12");
@ -40,9 +40,9 @@ __sys_call2_internal (int sys_call, int one, int two)
int
__raise (int signum)
{
int pid = __sys_call_internal (SYS_getpid);
int pid = (int) __sys_call_internal (SYS_getpid);
if (pid < 0)
return pid;
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 <linux/x86/syscall.h>
int
__sys_call (int sys_call)
long
__sys_call (long sys_call)
{
asm ("mov____0x8(%ebp),%eax !8");
asm ("int____$0x80");
}
int
__sys_call1 (int sys_call, int one)
long
__sys_call1 (long sys_call, long one)
{
asm ("mov____0x8(%ebp),%eax !8");
asm ("mov____0x8(%ebp),%ebx !12");
asm ("int____$0x80");
}
int
__sys_call2 (int sys_call, int one, int two)
long
__sys_call2 (long sys_call, long one, long two)
{
asm ("mov____0x8(%ebp),%eax !8");
asm ("mov____0x8(%ebp),%ebx !12");
@ -45,8 +45,8 @@ __sys_call2 (int sys_call, int one, int two)
asm ("int____$0x80");
}
int
__sys_call3 (int sys_call, int one, int two, int three)
long
__sys_call3 (long sys_call, long one, long two, long three)
{
asm ("mov____0x8(%ebp),%eax !8");
asm ("mov____0x8(%ebp),%ebx !12");
@ -55,8 +55,8 @@ __sys_call3 (int sys_call, int one, int two, int three)
asm ("int____$0x80");
}
int
__sys_call4 (int sys_call, int one, int two, int three, int four)
long
__sys_call4 (long sys_call, long one, long two, long three, long four)
{
asm ("mov____0x8(%ebp),%eax !8");
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");
}
int
_sys_call (int sys_call)
long
_sys_call (long sys_call)
{
int r = __sys_call (sys_call);
long r = __sys_call (sys_call);
if (r < 0)
{
errno = -r;
@ -80,10 +80,10 @@ _sys_call (int sys_call)
return r;
}
int
_sys_call1 (int sys_call, int one)
long
_sys_call1 (long sys_call, long one)
{
int r = __sys_call1 (sys_call, one);
long r = __sys_call1 (sys_call, one);
if (r < 0)
{
errno = -r;
@ -94,10 +94,10 @@ _sys_call1 (int sys_call, int one)
return r;
}
int
_sys_call2 (int sys_call, int one, int two)
long
_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)
{
errno = -r;
@ -108,10 +108,10 @@ _sys_call2 (int sys_call, int one, int two)
return r;
}
int
_sys_call3 (int sys_call, int one, int two, int three)
long
_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)
{
errno = -r;
@ -122,10 +122,10 @@ _sys_call3 (int sys_call, int one, int two, int three)
return r;
}
int
_sys_call4 (int sys_call, int one, int two, int three, int four)
long
_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)
{
errno = -r;