summaryrefslogtreecommitdiffstats
path: root/ldso
diff options
context:
space:
mode:
authorDavid McCullough <davidm@snapgear.com>2001-06-07 11:54:28 +0000
committerDavid McCullough <davidm@snapgear.com>2001-06-07 11:54:28 +0000
commite9499a8a60154078b834828fe18437dadf0cdf74 (patch)
tree6484bf79dcb3903b3562b4fb8d48271dbaaaf5fb /ldso
parent50bb6aff9a1f747bfe5b0d14ad9c25296f6892e4 (diff)
downloaduClibc-alpine-e9499a8a60154078b834828fe18437dadf0cdf74.tar.bz2
uClibc-alpine-e9499a8a60154078b834828fe18437dadf0cdf74.tar.xz
Changes needed to build the ldso dir for m68k. I haven't tested it,
who knows if it will work, it just compiles cleanly :-)
Diffstat (limited to 'ldso')
-rw-r--r--ldso/ldso/boot1.c2
-rw-r--r--ldso/ldso/ld-uClibc.c2
-rw-r--r--ldso/ldso/ldso.c2
-rw-r--r--ldso/ldso/m68k/dl-syscalls.h205
-rw-r--r--ldso/ldso/m68k/elfinterp.c12
-rw-r--r--ldso/ldso/m68k/ld_syscalls.h205
-rw-r--r--ldso/ldso/m68k/syscalls.h205
7 files changed, 402 insertions, 231 deletions
diff --git a/ldso/ldso/boot1.c b/ldso/ldso/boot1.c
index 2c7092756..52c9bcb4e 100644
--- a/ldso/ldso/boot1.c
+++ b/ldso/ldso/boot1.c
@@ -92,10 +92,10 @@
*/
#include <stdarg.h>
+#include "sysdep.h" /* before elf.h to get ELF_USES_RELOCA right */
#include <elf.h>
#include "linuxelf.h"
#include "link.h"
-#include "sysdep.h"
#include "hash.h"
#include "syscall.h"
#include "string.h"
diff --git a/ldso/ldso/ld-uClibc.c b/ldso/ldso/ld-uClibc.c
index 2c7092756..52c9bcb4e 100644
--- a/ldso/ldso/ld-uClibc.c
+++ b/ldso/ldso/ld-uClibc.c
@@ -92,10 +92,10 @@
*/
#include <stdarg.h>
+#include "sysdep.h" /* before elf.h to get ELF_USES_RELOCA right */
#include <elf.h>
#include "linuxelf.h"
#include "link.h"
-#include "sysdep.h"
#include "hash.h"
#include "syscall.h"
#include "string.h"
diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c
index 2c7092756..52c9bcb4e 100644
--- a/ldso/ldso/ldso.c
+++ b/ldso/ldso/ldso.c
@@ -92,10 +92,10 @@
*/
#include <stdarg.h>
+#include "sysdep.h" /* before elf.h to get ELF_USES_RELOCA right */
#include <elf.h>
#include "linuxelf.h"
#include "link.h"
-#include "sysdep.h"
#include "hash.h"
#include "syscall.h"
#include "string.h"
diff --git a/ldso/ldso/m68k/dl-syscalls.h b/ldso/ldso/m68k/dl-syscalls.h
index df7e36776..7d76c5422 100644
--- a/ldso/ldso/m68k/dl-syscalls.h
+++ b/ldso/ldso/m68k/dl-syscalls.h
@@ -1,12 +1,20 @@
#include <asm/unistd.h>
+#undef __syscall_return
+#undef _syscall0
+#undef _syscall1
+#undef _syscall2
+#undef _syscall3
+#undef _syscall4
+#undef _syscall5
+
/* Here are the macros which define how this platform makes
* system calls. This particular variant does _not_ set
* errno (note how it is disabled in __syscall_return) since
* these will get called before the errno symbol is dynamicly
* linked. */
-#undef __syscall_return
+
#define __syscall_return(type, res) \
do { \
if ((unsigned long)(res) >= (unsigned long)(-125)) { \
@@ -19,88 +27,137 @@ do { \
return (type) (res); \
} while (0)
-#define _syscall0(type,name) \
-type name(void) \
-{ \
-register long __res __asm__ ("%d0") = __NR_##name; \
-__asm__ __volatile__ ("trap #0" \
- : "=g" (__res) \
- : "0" (__res) \
- : "%d0"); \
-__syscall_return(type,__res); \
+#define _syscall0(type, name) \
+type name(void) \
+{ \
+ long __res; \
+ __asm__ __volatile__ ("movel %1, %%d0\n\t" \
+ "trap #0\n\t" \
+ "movel %%d0, %0" \
+ : "=g" (__res) \
+ : "i" (__NR_##name) \
+ : "cc", "%d0"); \
+ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
+ /* errno = -__res; */ \
+ __res = -1; \
+ } \
+ return (type)__res; \
}
-#define _syscall1(type,name,atype,a) \
-type name(atype a) \
-{ \
-register long __res __asm__ ("%d0") = __NR_##name; \
-register long __a __asm__ ("%d1") = (long)(a); \
-__asm__ __volatile__ ("trap #0" \
- : "=d" (__res) \
- : "0" (__res), "d" (__a) \
- : "%d0"); \
-__syscall_return(type,__res); \
+#define _syscall1(type, name, atype, a) \
+type name(atype a) \
+{ \
+ long __res; \
+ __asm__ __volatile__ ("movel %2, %%d1\n\t" \
+ "movel %1, %%d0\n\t" \
+ "trap #0\n\t" \
+ "movel %%d0, %0" \
+ : "=g" (__res) \
+ : "i" (__NR_##name), \
+ "g" ((long)a) \
+ : "cc", "%d0", "%d1"); \
+ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
+ /* errno = -__res; */ \
+ __res = -1; \
+ } \
+ return (type)__res; \
}
-#define _syscall2(type,name,atype,a,btype,b) \
-type name(atype a,btype b) \
-{ \
-register long __res __asm__ ("%d0") = __NR_##name; \
-register long __a __asm__ ("%d1") = (long)(a); \
-register long __b __asm__ ("%d2") = (long)(b); \
-__asm__ __volatile__ ("trap #0" \
- : "=d" (__res) \
- : "0" (__res), "d" (__a), "d" (__b) \
- : "%d0"); \
-__syscall_return(type,__res); \
+#define _syscall2(type, name, atype, a, btype, b) \
+type name(atype a, btype b) \
+{ \
+ long __res; \
+ __asm__ __volatile__ ("movel %3, %%d2\n\t" \
+ "movel %2, %%d1\n\t" \
+ "movel %1, %%d0\n\t" \
+ "trap #0\n\t" \
+ "movel %%d0, %0" \
+ : "=g" (__res) \
+ : "i" (__NR_##name), \
+ "a" ((long)a), \
+ "g" ((long)b) \
+ : "cc", "%d0", "%d1", "%d2"); \
+ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
+ /* errno = -__res; */ \
+ __res = -1; \
+ } \
+ return (type)__res; \
}
-#define _syscall3(type,name,atype,a,btype,b,ctype,c) \
-type name(atype a,btype b,ctype c) \
-{ \
-register long __res __asm__ ("%d0") = __NR_##name; \
-register long __a __asm__ ("%d1") = (long)(a); \
-register long __b __asm__ ("%d2") = (long)(b); \
-register long __c __asm__ ("%d3") = (long)(c); \
-__asm__ __volatile__ ("trap #0" \
- : "=d" (__res) \
- : "0" (__res), "d" (__a), "d" (__b), \
- "d" (__c) \
- : "%d0"); \
-__syscall_return(type,__res); \
+#define _syscall3(type, name, atype, a, btype, b, ctype, c) \
+type name(atype a, btype b, ctype c) \
+{ \
+ long __res; \
+ __asm__ __volatile__ ("movel %4, %%d3\n\t" \
+ "movel %3, %%d2\n\t" \
+ "movel %2, %%d1\n\t" \
+ "movel %1, %%d0\n\t" \
+ "trap #0\n\t" \
+ "movel %%d0, %0" \
+ : "=g" (__res) \
+ : "i" (__NR_##name), \
+ "a" ((long)a), \
+ "a" ((long)b), \
+ "g" ((long)c) \
+ : "cc", "%d0", "%d1", "%d2", "%d3"); \
+ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
+ /* errno = -__res; */ \
+ __res = -1; \
+ } \
+ return (type)__res; \
}
-#define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \
-type name (atype a, btype b, ctype c, dtype d) \
-{ \
-register long __res __asm__ ("%d0") = __NR_##name; \
-register long __a __asm__ ("%d1") = (long)(a); \
-register long __b __asm__ ("%d2") = (long)(b); \
-register long __c __asm__ ("%d3") = (long)(c); \
-register long __d __asm__ ("%d4") = (long)(d); \
-__asm__ __volatile__ ("trap #0" \
- : "=d" (__res) \
- : "0" (__res), "d" (__a), "d" (__b), \
- "d" (__c), "d" (__d) \
- : "%d0"); \
-__syscall_return(type,__res); \
+#define _syscall4(type, name, atype, a, btype, b, ctype, c, dtype, d) \
+type name(atype a, btype b, ctype c, dtype d) \
+{ \
+ long __res; \
+ __asm__ __volatile__ ("movel %5, %%d4\n\t" \
+ "movel %4, %%d3\n\t" \
+ "movel %3, %%d2\n\t" \
+ "movel %2, %%d1\n\t" \
+ "movel %1, %%d0\n\t" \
+ "trap #0\n\t" \
+ "movel %%d0, %0" \
+ : "=g" (__res) \
+ : "i" (__NR_##name), \
+ "a" ((long)a), \
+ "a" ((long)b), \
+ "a" ((long)c), \
+ "g" ((long)d) \
+ : "cc", "%d0", "%d1", "%d2", "%d3", \
+ "%d4"); \
+ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
+ /* errno = -__res; */ \
+ __res = -1; \
+ } \
+ return (type)__res; \
}
-#define _syscall5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
-type name (atype a,btype b,ctype c,dtype d,etype e) \
-{ \
-register long __res __asm__ ("%d0") = __NR_##name; \
-register long __a __asm__ ("%d1") = (long)(a); \
-register long __b __asm__ ("%d2") = (long)(b); \
-register long __c __asm__ ("%d3") = (long)(c); \
-register long __d __asm__ ("%d4") = (long)(d); \
-register long __e __asm__ ("%d5") = (long)(e); \
-__asm__ __volatile__ ("trap #0" \
- : "=d" (__res) \
- : "0" (__res), "d" (__a), "d" (__b), \
- "d" (__c), "d" (__d), "d" (__e) \
- : "%d0"); \
-__syscall_return(type,__res); \
+#define _syscall5(type, name, atype, a, btype, b, ctype, c, dtype, d, etype, e)\
+type name(atype a, btype b, ctype c, dtype d, etype e) \
+{ \
+ long __res; \
+ __asm__ __volatile__ ("movel %6, %%d5\n\t" \
+ "movel %5, %%d4\n\t" \
+ "movel %4, %%d3\n\t" \
+ "movel %3, %%d2\n\t" \
+ "movel %2, %%d1\n\t" \
+ "movel %1, %%d0\n\t" \
+ "trap #0\n\t" \
+ "movel %%d0, %0" \
+ : "=g" (__res) \
+ : "i" (__NR_##name), \
+ "a" ((long)a), \
+ "a" ((long)b), \
+ "a" ((long)c), \
+ "a" ((long)d), \
+ "g" ((long)e) \
+ : "cc", "%d0", "%d1", "%d2", "%d3", \
+ "%d4", "%d5"); \
+ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
+ /* errno = -__res; */ \
+ __res = -1; \
+ } \
+ return (type)__res; \
}
-
diff --git a/ldso/ldso/m68k/elfinterp.c b/ldso/ldso/m68k/elfinterp.c
index b3bfeee1a..2b8566d88 100644
--- a/ldso/ldso/m68k/elfinterp.c
+++ b/ldso/ldso/m68k/elfinterp.c
@@ -118,8 +118,8 @@ _dl_linux_resolver (int dummy1, int dummy2,
}
void
-_dl_parse_lazy_relocation_information (struct elf_resolve *tpnt, int rel_addr,
- int rel_size, int type)
+_dl_parse_lazy_relocation_information (struct elf_resolve *tpnt,
+ unsigned long rel_addr, unsigned long rel_size, int type)
{
int i;
char *strtab;
@@ -171,8 +171,8 @@ _dl_parse_lazy_relocation_information (struct elf_resolve *tpnt, int rel_addr,
}
int
-_dl_parse_relocation_information (struct elf_resolve *tpnt, int rel_addr,
- int rel_size, int type)
+_dl_parse_relocation_information (struct elf_resolve *tpnt,
+ unsigned long rel_addr, unsigned long rel_size, int type)
{
int i;
char *strtab;
@@ -294,8 +294,8 @@ _dl_parse_relocation_information (struct elf_resolve *tpnt, int rel_addr,
at all. */
int
-_dl_parse_copy_information (struct dyn_elf *xpnt, int rel_addr,
- int rel_size, int type)
+_dl_parse_copy_information (struct dyn_elf *xpnt, unsigned long rel_addr,
+ unsigned long rel_size, int type)
{
int i;
char *strtab;
diff --git a/ldso/ldso/m68k/ld_syscalls.h b/ldso/ldso/m68k/ld_syscalls.h
index df7e36776..7d76c5422 100644
--- a/ldso/ldso/m68k/ld_syscalls.h
+++ b/ldso/ldso/m68k/ld_syscalls.h
@@ -1,12 +1,20 @@
#include <asm/unistd.h>
+#undef __syscall_return
+#undef _syscall0
+#undef _syscall1
+#undef _syscall2
+#undef _syscall3
+#undef _syscall4
+#undef _syscall5
+
/* Here are the macros which define how this platform makes
* system calls. This particular variant does _not_ set
* errno (note how it is disabled in __syscall_return) since
* these will get called before the errno symbol is dynamicly
* linked. */
-#undef __syscall_return
+
#define __syscall_return(type, res) \
do { \
if ((unsigned long)(res) >= (unsigned long)(-125)) { \
@@ -19,88 +27,137 @@ do { \
return (type) (res); \
} while (0)
-#define _syscall0(type,name) \
-type name(void) \
-{ \
-register long __res __asm__ ("%d0") = __NR_##name; \
-__asm__ __volatile__ ("trap #0" \
- : "=g" (__res) \
- : "0" (__res) \
- : "%d0"); \
-__syscall_return(type,__res); \
+#define _syscall0(type, name) \
+type name(void) \
+{ \
+ long __res; \
+ __asm__ __volatile__ ("movel %1, %%d0\n\t" \
+ "trap #0\n\t" \
+ "movel %%d0, %0" \
+ : "=g" (__res) \
+ : "i" (__NR_##name) \
+ : "cc", "%d0"); \
+ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
+ /* errno = -__res; */ \
+ __res = -1; \
+ } \
+ return (type)__res; \
}
-#define _syscall1(type,name,atype,a) \
-type name(atype a) \
-{ \
-register long __res __asm__ ("%d0") = __NR_##name; \
-register long __a __asm__ ("%d1") = (long)(a); \
-__asm__ __volatile__ ("trap #0" \
- : "=d" (__res) \
- : "0" (__res), "d" (__a) \
- : "%d0"); \
-__syscall_return(type,__res); \
+#define _syscall1(type, name, atype, a) \
+type name(atype a) \
+{ \
+ long __res; \
+ __asm__ __volatile__ ("movel %2, %%d1\n\t" \
+ "movel %1, %%d0\n\t" \
+ "trap #0\n\t" \
+ "movel %%d0, %0" \
+ : "=g" (__res) \
+ : "i" (__NR_##name), \
+ "g" ((long)a) \
+ : "cc", "%d0", "%d1"); \
+ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
+ /* errno = -__res; */ \
+ __res = -1; \
+ } \
+ return (type)__res; \
}
-#define _syscall2(type,name,atype,a,btype,b) \
-type name(atype a,btype b) \
-{ \
-register long __res __asm__ ("%d0") = __NR_##name; \
-register long __a __asm__ ("%d1") = (long)(a); \
-register long __b __asm__ ("%d2") = (long)(b); \
-__asm__ __volatile__ ("trap #0" \
- : "=d" (__res) \
- : "0" (__res), "d" (__a), "d" (__b) \
- : "%d0"); \
-__syscall_return(type,__res); \
+#define _syscall2(type, name, atype, a, btype, b) \
+type name(atype a, btype b) \
+{ \
+ long __res; \
+ __asm__ __volatile__ ("movel %3, %%d2\n\t" \
+ "movel %2, %%d1\n\t" \
+ "movel %1, %%d0\n\t" \
+ "trap #0\n\t" \
+ "movel %%d0, %0" \
+ : "=g" (__res) \
+ : "i" (__NR_##name), \
+ "a" ((long)a), \
+ "g" ((long)b) \
+ : "cc", "%d0", "%d1", "%d2"); \
+ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
+ /* errno = -__res; */ \
+ __res = -1; \
+ } \
+ return (type)__res; \
}
-#define _syscall3(type,name,atype,a,btype,b,ctype,c) \
-type name(atype a,btype b,ctype c) \
-{ \
-register long __res __asm__ ("%d0") = __NR_##name; \
-register long __a __asm__ ("%d1") = (long)(a); \
-register long __b __asm__ ("%d2") = (long)(b); \
-register long __c __asm__ ("%d3") = (long)(c); \
-__asm__ __volatile__ ("trap #0" \
- : "=d" (__res) \
- : "0" (__res), "d" (__a), "d" (__b), \
- "d" (__c) \
- : "%d0"); \
-__syscall_return(type,__res); \
+#define _syscall3(type, name, atype, a, btype, b, ctype, c) \
+type name(atype a, btype b, ctype c) \
+{ \
+ long __res; \
+ __asm__ __volatile__ ("movel %4, %%d3\n\t" \
+ "movel %3, %%d2\n\t" \
+ "movel %2, %%d1\n\t" \
+ "movel %1, %%d0\n\t" \
+ "trap #0\n\t" \
+ "movel %%d0, %0" \
+ : "=g" (__res) \
+ : "i" (__NR_##name), \
+ "a" ((long)a), \
+ "a" ((long)b), \
+ "g" ((long)c) \
+ : "cc", "%d0", "%d1", "%d2", "%d3"); \
+ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
+ /* errno = -__res; */ \
+ __res = -1; \
+ } \
+ return (type)__res; \
}
-#define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \
-type name (atype a, btype b, ctype c, dtype d) \
-{ \
-register long __res __asm__ ("%d0") = __NR_##name; \
-register long __a __asm__ ("%d1") = (long)(a); \
-register long __b __asm__ ("%d2") = (long)(b); \
-register long __c __asm__ ("%d3") = (long)(c); \
-register long __d __asm__ ("%d4") = (long)(d); \
-__asm__ __volatile__ ("trap #0" \
- : "=d" (__res) \
- : "0" (__res), "d" (__a), "d" (__b), \
- "d" (__c), "d" (__d) \
- : "%d0"); \
-__syscall_return(type,__res); \
+#define _syscall4(type, name, atype, a, btype, b, ctype, c, dtype, d) \
+type name(atype a, btype b, ctype c, dtype d) \
+{ \
+ long __res; \
+ __asm__ __volatile__ ("movel %5, %%d4\n\t" \
+ "movel %4, %%d3\n\t" \
+ "movel %3, %%d2\n\t" \
+ "movel %2, %%d1\n\t" \
+ "movel %1, %%d0\n\t" \
+ "trap #0\n\t" \
+ "movel %%d0, %0" \
+ : "=g" (__res) \
+ : "i" (__NR_##name), \
+ "a" ((long)a), \
+ "a" ((long)b), \
+ "a" ((long)c), \
+ "g" ((long)d) \
+ : "cc", "%d0", "%d1", "%d2", "%d3", \
+ "%d4"); \
+ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
+ /* errno = -__res; */ \
+ __res = -1; \
+ } \
+ return (type)__res; \
}
-#define _syscall5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
-type name (atype a,btype b,ctype c,dtype d,etype e) \
-{ \
-register long __res __asm__ ("%d0") = __NR_##name; \
-register long __a __asm__ ("%d1") = (long)(a); \
-register long __b __asm__ ("%d2") = (long)(b); \
-register long __c __asm__ ("%d3") = (long)(c); \
-register long __d __asm__ ("%d4") = (long)(d); \
-register long __e __asm__ ("%d5") = (long)(e); \
-__asm__ __volatile__ ("trap #0" \
- : "=d" (__res) \
- : "0" (__res), "d" (__a), "d" (__b), \
- "d" (__c), "d" (__d), "d" (__e) \
- : "%d0"); \
-__syscall_return(type,__res); \
+#define _syscall5(type, name, atype, a, btype, b, ctype, c, dtype, d, etype, e)\
+type name(atype a, btype b, ctype c, dtype d, etype e) \
+{ \
+ long __res; \
+ __asm__ __volatile__ ("movel %6, %%d5\n\t" \
+ "movel %5, %%d4\n\t" \
+ "movel %4, %%d3\n\t" \
+ "movel %3, %%d2\n\t" \
+ "movel %2, %%d1\n\t" \
+ "movel %1, %%d0\n\t" \
+ "trap #0\n\t" \
+ "movel %%d0, %0" \
+ : "=g" (__res) \
+ : "i" (__NR_##name), \
+ "a" ((long)a), \
+ "a" ((long)b), \
+ "a" ((long)c), \
+ "a" ((long)d), \
+ "g" ((long)e) \
+ : "cc", "%d0", "%d1", "%d2", "%d3", \
+ "%d4", "%d5"); \
+ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
+ /* errno = -__res; */ \
+ __res = -1; \
+ } \
+ return (type)__res; \
}
-
diff --git a/ldso/ldso/m68k/syscalls.h b/ldso/ldso/m68k/syscalls.h
index df7e36776..7d76c5422 100644
--- a/ldso/ldso/m68k/syscalls.h
+++ b/ldso/ldso/m68k/syscalls.h
@@ -1,12 +1,20 @@
#include <asm/unistd.h>
+#undef __syscall_return
+#undef _syscall0
+#undef _syscall1
+#undef _syscall2
+#undef _syscall3
+#undef _syscall4
+#undef _syscall5
+
/* Here are the macros which define how this platform makes
* system calls. This particular variant does _not_ set
* errno (note how it is disabled in __syscall_return) since
* these will get called before the errno symbol is dynamicly
* linked. */
-#undef __syscall_return
+
#define __syscall_return(type, res) \
do { \
if ((unsigned long)(res) >= (unsigned long)(-125)) { \
@@ -19,88 +27,137 @@ do { \
return (type) (res); \
} while (0)
-#define _syscall0(type,name) \
-type name(void) \
-{ \
-register long __res __asm__ ("%d0") = __NR_##name; \
-__asm__ __volatile__ ("trap #0" \
- : "=g" (__res) \
- : "0" (__res) \
- : "%d0"); \
-__syscall_return(type,__res); \
+#define _syscall0(type, name) \
+type name(void) \
+{ \
+ long __res; \
+ __asm__ __volatile__ ("movel %1, %%d0\n\t" \
+ "trap #0\n\t" \
+ "movel %%d0, %0" \
+ : "=g" (__res) \
+ : "i" (__NR_##name) \
+ : "cc", "%d0"); \
+ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
+ /* errno = -__res; */ \
+ __res = -1; \
+ } \
+ return (type)__res; \
}
-#define _syscall1(type,name,atype,a) \
-type name(atype a) \
-{ \
-register long __res __asm__ ("%d0") = __NR_##name; \
-register long __a __asm__ ("%d1") = (long)(a); \
-__asm__ __volatile__ ("trap #0" \
- : "=d" (__res) \
- : "0" (__res), "d" (__a) \
- : "%d0"); \
-__syscall_return(type,__res); \
+#define _syscall1(type, name, atype, a) \
+type name(atype a) \
+{ \
+ long __res; \
+ __asm__ __volatile__ ("movel %2, %%d1\n\t" \
+ "movel %1, %%d0\n\t" \
+ "trap #0\n\t" \
+ "movel %%d0, %0" \
+ : "=g" (__res) \
+ : "i" (__NR_##name), \
+ "g" ((long)a) \
+ : "cc", "%d0", "%d1"); \
+ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
+ /* errno = -__res; */ \
+ __res = -1; \
+ } \
+ return (type)__res; \
}
-#define _syscall2(type,name,atype,a,btype,b) \
-type name(atype a,btype b) \
-{ \
-register long __res __asm__ ("%d0") = __NR_##name; \
-register long __a __asm__ ("%d1") = (long)(a); \
-register long __b __asm__ ("%d2") = (long)(b); \
-__asm__ __volatile__ ("trap #0" \
- : "=d" (__res) \
- : "0" (__res), "d" (__a), "d" (__b) \
- : "%d0"); \
-__syscall_return(type,__res); \
+#define _syscall2(type, name, atype, a, btype, b) \
+type name(atype a, btype b) \
+{ \
+ long __res; \
+ __asm__ __volatile__ ("movel %3, %%d2\n\t" \
+ "movel %2, %%d1\n\t" \
+ "movel %1, %%d0\n\t" \
+ "trap #0\n\t" \
+ "movel %%d0, %0" \
+ : "=g" (__res) \
+ : "i" (__NR_##name), \
+ "a" ((long)a), \
+ "g" ((long)b) \
+ : "cc", "%d0", "%d1", "%d2"); \
+ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
+ /* errno = -__res; */ \
+ __res = -1; \
+ } \
+ return (type)__res; \
}
-#define _syscall3(type,name,atype,a,btype,b,ctype,c) \
-type name(atype a,btype b,ctype c) \
-{ \
-register long __res __asm__ ("%d0") = __NR_##name; \
-register long __a __asm__ ("%d1") = (long)(a); \
-register long __b __asm__ ("%d2") = (long)(b); \
-register long __c __asm__ ("%d3") = (long)(c); \
-__asm__ __volatile__ ("trap #0" \
- : "=d" (__res) \
- : "0" (__res), "d" (__a), "d" (__b), \
- "d" (__c) \
- : "%d0"); \
-__syscall_return(type,__res); \
+#define _syscall3(type, name, atype, a, btype, b, ctype, c) \
+type name(atype a, btype b, ctype c) \
+{ \
+ long __res; \
+ __asm__ __volatile__ ("movel %4, %%d3\n\t" \
+ "movel %3, %%d2\n\t" \
+ "movel %2, %%d1\n\t" \
+ "movel %1, %%d0\n\t" \
+ "trap #0\n\t" \
+ "movel %%d0, %0" \
+ : "=g" (__res) \
+ : "i" (__NR_##name), \
+ "a" ((long)a), \
+ "a" ((long)b), \
+ "g" ((long)c) \
+ : "cc", "%d0", "%d1", "%d2", "%d3"); \
+ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
+ /* errno = -__res; */ \
+ __res = -1; \
+ } \
+ return (type)__res; \
}
-#define _syscall4(type,name,atype,a,btype,b,ctype,c,dtype,d) \
-type name (atype a, btype b, ctype c, dtype d) \
-{ \
-register long __res __asm__ ("%d0") = __NR_##name; \
-register long __a __asm__ ("%d1") = (long)(a); \
-register long __b __asm__ ("%d2") = (long)(b); \
-register long __c __asm__ ("%d3") = (long)(c); \
-register long __d __asm__ ("%d4") = (long)(d); \
-__asm__ __volatile__ ("trap #0" \
- : "=d" (__res) \
- : "0" (__res), "d" (__a), "d" (__b), \
- "d" (__c), "d" (__d) \
- : "%d0"); \
-__syscall_return(type,__res); \
+#define _syscall4(type, name, atype, a, btype, b, ctype, c, dtype, d) \
+type name(atype a, btype b, ctype c, dtype d) \
+{ \
+ long __res; \
+ __asm__ __volatile__ ("movel %5, %%d4\n\t" \
+ "movel %4, %%d3\n\t" \
+ "movel %3, %%d2\n\t" \
+ "movel %2, %%d1\n\t" \
+ "movel %1, %%d0\n\t" \
+ "trap #0\n\t" \
+ "movel %%d0, %0" \
+ : "=g" (__res) \
+ : "i" (__NR_##name), \
+ "a" ((long)a), \
+ "a" ((long)b), \
+ "a" ((long)c), \
+ "g" ((long)d) \
+ : "cc", "%d0", "%d1", "%d2", "%d3", \
+ "%d4"); \
+ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
+ /* errno = -__res; */ \
+ __res = -1; \
+ } \
+ return (type)__res; \
}
-#define _syscall5(type,name,atype,a,btype,b,ctype,c,dtype,d,etype,e) \
-type name (atype a,btype b,ctype c,dtype d,etype e) \
-{ \
-register long __res __asm__ ("%d0") = __NR_##name; \
-register long __a __asm__ ("%d1") = (long)(a); \
-register long __b __asm__ ("%d2") = (long)(b); \
-register long __c __asm__ ("%d3") = (long)(c); \
-register long __d __asm__ ("%d4") = (long)(d); \
-register long __e __asm__ ("%d5") = (long)(e); \
-__asm__ __volatile__ ("trap #0" \
- : "=d" (__res) \
- : "0" (__res), "d" (__a), "d" (__b), \
- "d" (__c), "d" (__d), "d" (__e) \
- : "%d0"); \
-__syscall_return(type,__res); \
+#define _syscall5(type, name, atype, a, btype, b, ctype, c, dtype, d, etype, e)\
+type name(atype a, btype b, ctype c, dtype d, etype e) \
+{ \
+ long __res; \
+ __asm__ __volatile__ ("movel %6, %%d5\n\t" \
+ "movel %5, %%d4\n\t" \
+ "movel %4, %%d3\n\t" \
+ "movel %3, %%d2\n\t" \
+ "movel %2, %%d1\n\t" \
+ "movel %1, %%d0\n\t" \
+ "trap #0\n\t" \
+ "movel %%d0, %0" \
+ : "=g" (__res) \
+ : "i" (__NR_##name), \
+ "a" ((long)a), \
+ "a" ((long)b), \
+ "a" ((long)c), \
+ "a" ((long)d), \
+ "g" ((long)e) \
+ : "cc", "%d0", "%d1", "%d2", "%d3", \
+ "%d4", "%d5"); \
+ if ((unsigned long)(__res) >= (unsigned long)(-125)) { \
+ /* errno = -__res; */ \
+ __res = -1; \
+ } \
+ return (type)__res; \
}
-