From 1c128c7a9f5b4a0908f6ebd50917671ac2656811 Mon Sep 17 00:00:00 2001 From: "Jan (janneke) Nieuwenhuizen" Date: Sun, 30 Aug 2020 12:09:32 +0200 Subject: [PATCH] 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. --- lib/linux/x86-mes-mescc/syscall-internal.c | 12 +++--- lib/linux/x86-mes-mescc/syscall.c | 50 +++++++++++----------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/lib/linux/x86-mes-mescc/syscall-internal.c b/lib/linux/x86-mes-mescc/syscall-internal.c index 451c5ed7..f4bf4bd5 100644 --- a/lib/linux/x86-mes-mescc/syscall-internal.c +++ b/lib/linux/x86-mes-mescc/syscall-internal.c @@ -20,15 +20,15 @@ #include -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); } diff --git a/lib/linux/x86-mes-mescc/syscall.c b/lib/linux/x86-mes-mescc/syscall.c index 5d88cca5..20395650 100644 --- a/lib/linux/x86-mes-mescc/syscall.c +++ b/lib/linux/x86-mes-mescc/syscall.c @@ -21,23 +21,23 @@ #include #include -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;