From: Lluís Vilanova <vilan...@ac.upc.edu>

This fixes double-definitions in linux-user builds when using the UST
tracing backend (which indirectly includes the system's "syscall.h").

Signed-off-by: Lluís Vilanova <vilan...@ac.upc.edu>
Reviewed-by: Peter Maydell <peter.mayd...@linaro.org>
Signed-off-by: Riku Voipio <riku.voi...@linaro.org>
---
 linux-user/aarch64/syscall.h           |  13 --
 linux-user/aarch64/target_syscall.h    |  18 +++
 linux-user/alpha/syscall.h             | 257 --------------------------------
 linux-user/alpha/target_syscall.h      | 262 +++++++++++++++++++++++++++++++++
 linux-user/arm/syscall.h               |  50 -------
 linux-user/arm/target_syscall.h        |  54 +++++++
 linux-user/cris/syscall.h              |  46 ------
 linux-user/cris/target_syscall.h       |  46 ++++++
 linux-user/i386/syscall.h              | 152 -------------------
 linux-user/i386/target_syscall.h       | 157 ++++++++++++++++++++
 linux-user/m68k/syscall.h              |  25 ----
 linux-user/m68k/target_syscall.h       |  29 ++++
 linux-user/microblaze/syscall.h        |  56 -------
 linux-user/microblaze/target_syscall.h |  56 +++++++
 linux-user/mips/syscall.h              | 233 -----------------------------
 linux-user/mips/target_syscall.h       | 237 +++++++++++++++++++++++++++++
 linux-user/mips64/syscall.h            | 230 -----------------------------
 linux-user/mips64/target_syscall.h     | 234 +++++++++++++++++++++++++++++
 linux-user/openrisc/syscall.h          |  29 ----
 linux-user/openrisc/target_syscall.h   |  34 +++++
 linux-user/ppc/syscall.h               |  75 ----------
 linux-user/ppc/target_syscall.h        |  80 ++++++++++
 linux-user/qemu.h                      |   2 +-
 linux-user/s390x/syscall.h             |  29 ----
 linux-user/s390x/target_syscall.h      |  34 +++++
 linux-user/sh4/syscall.h               |  17 ---
 linux-user/sh4/target_syscall.h        |  22 +++
 linux-user/sparc/syscall.h             |  20 ---
 linux-user/sparc/target_syscall.h      |  25 ++++
 linux-user/sparc64/syscall.h           |  21 ---
 linux-user/sparc64/target_syscall.h    |  26 ++++
 linux-user/tilegx/syscall.h            |  43 ------
 linux-user/tilegx/target_syscall.h     |  43 ++++++
 linux-user/unicore32/syscall.h         |  60 --------
 linux-user/unicore32/target_syscall.h  |  60 ++++++++
 linux-user/x86_64/syscall.h            | 102 -------------
 linux-user/x86_64/target_syscall.h     | 107 ++++++++++++++
 37 files changed, 1525 insertions(+), 1459 deletions(-)
 delete mode 100644 linux-user/aarch64/syscall.h
 create mode 100644 linux-user/aarch64/target_syscall.h
 delete mode 100644 linux-user/alpha/syscall.h
 create mode 100644 linux-user/alpha/target_syscall.h
 delete mode 100644 linux-user/arm/syscall.h
 create mode 100644 linux-user/arm/target_syscall.h
 delete mode 100644 linux-user/cris/syscall.h
 create mode 100644 linux-user/cris/target_syscall.h
 delete mode 100644 linux-user/i386/syscall.h
 create mode 100644 linux-user/i386/target_syscall.h
 delete mode 100644 linux-user/m68k/syscall.h
 create mode 100644 linux-user/m68k/target_syscall.h
 delete mode 100644 linux-user/microblaze/syscall.h
 create mode 100644 linux-user/microblaze/target_syscall.h
 delete mode 100644 linux-user/mips/syscall.h
 create mode 100644 linux-user/mips/target_syscall.h
 delete mode 100644 linux-user/mips64/syscall.h
 create mode 100644 linux-user/mips64/target_syscall.h
 delete mode 100644 linux-user/openrisc/syscall.h
 create mode 100644 linux-user/openrisc/target_syscall.h
 delete mode 100644 linux-user/ppc/syscall.h
 create mode 100644 linux-user/ppc/target_syscall.h
 delete mode 100644 linux-user/s390x/syscall.h
 create mode 100644 linux-user/s390x/target_syscall.h
 delete mode 100644 linux-user/sh4/syscall.h
 create mode 100644 linux-user/sh4/target_syscall.h
 delete mode 100644 linux-user/sparc/syscall.h
 create mode 100644 linux-user/sparc/target_syscall.h
 delete mode 100644 linux-user/sparc64/syscall.h
 create mode 100644 linux-user/sparc64/target_syscall.h
 delete mode 100644 linux-user/tilegx/syscall.h
 create mode 100644 linux-user/tilegx/target_syscall.h
 delete mode 100644 linux-user/unicore32/syscall.h
 create mode 100644 linux-user/unicore32/target_syscall.h
 delete mode 100644 linux-user/x86_64/syscall.h
 create mode 100644 linux-user/x86_64/target_syscall.h

diff --git a/linux-user/aarch64/syscall.h b/linux-user/aarch64/syscall.h
deleted file mode 100644
index dc72a15..0000000
--- a/linux-user/aarch64/syscall.h
+++ /dev/null
@@ -1,13 +0,0 @@
-struct target_pt_regs {
-    uint64_t        regs[31];
-    uint64_t        sp;
-    uint64_t        pc;
-    uint64_t        pstate;
-};
-
-#define UNAME_MACHINE "aarch64"
-#define UNAME_MINIMUM_RELEASE "3.8.0"
-#define TARGET_CLONE_BACKWARDS
-#define TARGET_MINSIGSTKSZ       2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE  2
diff --git a/linux-user/aarch64/target_syscall.h 
b/linux-user/aarch64/target_syscall.h
new file mode 100644
index 0000000..f458018
--- /dev/null
+++ b/linux-user/aarch64/target_syscall.h
@@ -0,0 +1,18 @@
+#ifndef TARGET_SYSCALL_H
+#define TARGET_SYSCALL_H
+
+struct target_pt_regs {
+    uint64_t        regs[31];
+    uint64_t        sp;
+    uint64_t        pc;
+    uint64_t        pstate;
+};
+
+#define UNAME_MACHINE "aarch64"
+#define UNAME_MINIMUM_RELEASE "3.8.0"
+#define TARGET_CLONE_BACKWARDS
+#define TARGET_MINSIGSTKSZ       2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE  2
+
+#endif  /* TARGET_SYSCALL_H */
diff --git a/linux-user/alpha/syscall.h b/linux-user/alpha/syscall.h
deleted file mode 100644
index 245cff2..0000000
--- a/linux-user/alpha/syscall.h
+++ /dev/null
@@ -1,257 +0,0 @@
-/* default linux values for the selectors */
-#define __USER_DS      (1)
-
-struct target_pt_regs {
-       abi_ulong r0;
-       abi_ulong r1;
-       abi_ulong r2;
-       abi_ulong r3;
-       abi_ulong r4;
-       abi_ulong r5;
-       abi_ulong r6;
-       abi_ulong r7;
-       abi_ulong r8;
-       abi_ulong r19;
-       abi_ulong r20;
-       abi_ulong r21;
-       abi_ulong r22;
-       abi_ulong r23;
-       abi_ulong r24;
-       abi_ulong r25;
-       abi_ulong r26;
-       abi_ulong r27;
-       abi_ulong r28;
-       abi_ulong hae;
-/* JRP - These are the values provided to a0-a2 by PALcode */
-       abi_ulong trap_a0;
-       abi_ulong trap_a1;
-       abi_ulong trap_a2;
-/* These are saved by PAL-code: */
-       abi_ulong ps;
-       abi_ulong pc;
-       abi_ulong gp;
-       abi_ulong r16;
-       abi_ulong r17;
-       abi_ulong r18;
-/* Those is needed by qemu to temporary store the user stack pointer */
-        abi_ulong usp;
-        abi_ulong unique;
-};
-
-#define UNAME_MACHINE "alpha"
-#define UNAME_MINIMUM_RELEASE "2.6.32"
-
-#undef TARGET_EDEADLK
-#define TARGET_EDEADLK         11
-#undef TARGET_EAGAIN
-#define TARGET_EAGAIN          35
-#undef TARGET_EINPROGRESS
-#define TARGET_EINPROGRESS     36
-#undef TARGET_EALREADY
-#define TARGET_EALREADY                37
-#undef TARGET_ENOTSOCK
-#define TARGET_ENOTSOCK                38
-#undef TARGET_EDESTADDRREQ
-#define TARGET_EDESTADDRREQ    39
-#undef TARGET_EMSGSIZE
-#define TARGET_EMSGSIZE                40
-#undef TARGET_EPROTOTYPE
-#define TARGET_EPROTOTYPE      41
-#undef TARGET_ENOPROTOOPT
-#define TARGET_ENOPROTOOPT     42
-#undef TARGET_EPROTONOSUPPORT
-#define TARGET_EPROTONOSUPPORT 43
-#undef TARGET_ESOCKTNOSUPPORT
-#define TARGET_ESOCKTNOSUPPORT 44
-#undef TARGET_EOPNOTSUPP
-#define TARGET_EOPNOTSUPP      45
-#undef TARGET_EPFNOSUPPORT
-#define TARGET_EPFNOSUPPORT    46
-#undef TARGET_EAFNOSUPPORT
-#define TARGET_EAFNOSUPPORT    47
-#undef TARGET_EADDRINUSE
-#define TARGET_EADDRINUSE      48
-#undef TARGET_EADDRNOTAVAIL
-#define TARGET_EADDRNOTAVAIL   49
-#undef TARGET_ENETDOWN
-#define TARGET_ENETDOWN                50
-#undef TARGET_ENETUNREACH
-#define TARGET_ENETUNREACH     51
-#undef TARGET_ENETRESET
-#define TARGET_ENETRESET       52
-#undef TARGET_ECONNABORTED
-#define TARGET_ECONNABORTED    53
-#undef TARGET_ECONNRESET
-#define TARGET_ECONNRESET      54
-#undef TARGET_ENOBUFS
-#define TARGET_ENOBUFS         55
-#undef TARGET_EISCONN
-#define TARGET_EISCONN         56
-#undef TARGET_ENOTCONN
-#define TARGET_ENOTCONN                57
-#undef TARGET_ESHUTDOWN
-#define TARGET_ESHUTDOWN       58
-#undef TARGET_ETOOMANYREFS
-#define TARGET_ETOOMANYREFS    59
-#undef TARGET_ETIMEDOUT
-#define TARGET_ETIMEDOUT       60
-#undef TARGET_ECONNREFUSED
-#define TARGET_ECONNREFUSED    61
-#undef TARGET_ELOOP
-#define TARGET_ELOOP           62
-#undef TARGET_ENAMETOOLONG
-#define TARGET_ENAMETOOLONG    63
-#undef TARGET_EHOSTDOWN
-#define TARGET_EHOSTDOWN       64
-#undef TARGET_EHOSTUNREACH
-#define TARGET_EHOSTUNREACH    65
-#undef TARGET_ENOTEMPTY
-#define TARGET_ENOTEMPTY       66
-// Unused                      67
-#undef TARGET_EUSERS
-#define TARGET_EUSERS          68
-#undef TARGET_EDQUOT
-#define TARGET_EDQUOT          69
-#undef TARGET_ESTALE
-#define TARGET_ESTALE          70
-#undef TARGET_EREMOTE
-#define TARGET_EREMOTE         71
-// Unused                      72-76
-#undef TARGET_ENOLCK
-#define TARGET_ENOLCK          77
-#undef TARGET_ENOSYS
-#define TARGET_ENOSYS          78
-// Unused                      79
-#undef TARGET_ENOMSG
-#define TARGET_ENOMSG          80
-#undef TARGET_EIDRM
-#define TARGET_EIDRM           81
-#undef TARGET_ENOSR
-#define TARGET_ENOSR           82
-#undef TARGET_ETIME
-#define TARGET_ETIME           83
-#undef TARGET_EBADMSG
-#define TARGET_EBADMSG         84
-#undef TARGET_EPROTO
-#define TARGET_EPROTO          85
-#undef TARGET_ENODATA
-#define TARGET_ENODATA         86
-#undef TARGET_ENOSTR
-#define TARGET_ENOSTR          87
-#undef TARGET_ECHRNG
-#define TARGET_ECHRNG          88
-#undef TARGET_EL2NSYNC
-#define TARGET_EL2NSYNC                89
-#undef TARGET_EL3HLT
-#define TARGET_EL3HLT          90
-#undef TARGET_EL3RST
-#define TARGET_EL3RST          91
-#undef TARGET_ENOPKG
-#define TARGET_ENOPKG          92
-#undef TARGET_ELNRNG
-#define TARGET_ELNRNG          93
-#undef TARGET_EUNATCH
-#define TARGET_EUNATCH         94
-#undef TARGET_ENOCSI
-#define TARGET_ENOCSI          95
-#undef TARGET_EL2HLT
-#define TARGET_EL2HLT          96
-#undef TARGET_EBADE
-#define TARGET_EBADE           97
-#undef TARGET_EBADR
-#define TARGET_EBADR           98
-#undef TARGET_EXFULL
-#define TARGET_EXFULL          99
-#undef TARGET_ENOANO
-#define TARGET_ENOANO          100
-#undef TARGET_EBADRQC
-#define TARGET_EBADRQC         101
-#undef TARGET_EBADSLT
-#define TARGET_EBADSLT         102
-// Unused                      103
-#undef TARGET_EBFONT
-#define TARGET_EBFONT          104
-#undef TARGET_ENONET
-#define TARGET_ENONET          105
-#undef TARGET_ENOLINK
-#define TARGET_ENOLINK         106
-#undef TARGET_EADV
-#define TARGET_EADV            107
-#undef TARGET_ESRMNT
-#define TARGET_ESRMNT          108
-#undef TARGET_ECOMM
-#define TARGET_ECOMM           109
-#undef TARGET_EMULTIHOP
-#define TARGET_EMULTIHOP       110
-#undef TARGET_EDOTDOT
-#define TARGET_EDOTDOT         111
-#undef TARGET_EOVERFLOW
-#define TARGET_EOVERFLOW       112
-#undef TARGET_ENOTUNIQ
-#define TARGET_ENOTUNIQ                113
-#undef TARGET_EBADFD
-#define TARGET_EBADFD          114
-#undef TARGET_EREMCHG
-#define TARGET_EREMCHG         115
-#undef TARGET_EILSEQ
-#define TARGET_EILSEQ          116
-
-// Same as default             117-121
-
-#undef TARGET_ELIBACC
-#define TARGET_ELIBACC         122
-#undef TARGET_ELIBBAD
-#define TARGET_ELIBBAD         123
-#undef TARGET_ELIBSCN
-#define TARGET_ELIBSCN         124
-#undef TARGET_ELIBMAX
-#define TARGET_ELIBMAX         125
-#undef TARGET_ELIBEXEC
-#define TARGET_ELIBEXEC                126
-#undef TARGET_ERESTART
-#define TARGET_ERESTART                127
-#undef TARGET_ESTRPIPE
-#define TARGET_ESTRPIPE                128
-#undef TARGET_ENOMEDIUM
-#define TARGET_ENOMEDIUM       129
-#undef TARGET_EMEDIUMTYPE
-#define TARGET_EMEDIUMTYPE     130
-#undef TARGET_ECANCELED
-#define TARGET_ECANCELED       131
-#undef TARGET_ENOKEY
-#define TARGET_ENOKEY          132
-#undef TARGET_EKEYEXPIRED
-#define TARGET_EKEYEXPIRED     133
-#undef TARGET_EKEYREVOKED
-#define TARGET_EKEYREVOKED     134
-#undef TARGET_EKEYREJECTED
-#define TARGET_EKEYREJECTED    135
-#undef TARGET_EOWNERDEAD
-#define TARGET_EOWNERDEAD      136
-#undef TARGET_ENOTRECOVERABLE
-#define TARGET_ENOTRECOVERABLE 137
-#undef TARGET_ERFKILL
-#define TARGET_ERFKILL         138
-
-// For sys_osf_getsysinfo
-#define TARGET_GSI_UACPROC             8
-#define TARGET_GSI_IEEE_FP_CONTROL     45
-#define TARGET_GSI_IEEE_STATE_AT_SIGNAL        46
-#define TARGET_GSI_PROC_TYPE           60
-#define TARGET_GSI_GET_HWRPB           101
-
-// For sys_ofs_setsysinfo
-#define TARGET_SSI_NVPAIRS             1
-#define TARGET_SSI_IEEE_FP_CONTROL     14
-#define TARGET_SSI_IEEE_STATE_AT_SIGNAL        15
-#define TARGET_SSI_IEEE_IGNORE_STATE_AT_SIGNAL 16
-#define TARGET_SSI_IEEE_RAISE_EXCEPTION        1001
-
-#define TARGET_SSIN_UACPROC            6
-
-#define TARGET_UAC_NOPRINT             1
-#define TARGET_UAC_NOFIX               2
-#define TARGET_UAC_SIGBUS              4
-#define TARGET_MINSIGSTKSZ              4096
-#define TARGET_MLOCKALL_MCL_CURRENT     0x2000
-#define TARGET_MLOCKALL_MCL_FUTURE      0x4000
diff --git a/linux-user/alpha/target_syscall.h 
b/linux-user/alpha/target_syscall.h
new file mode 100644
index 0000000..3db4b16
--- /dev/null
+++ b/linux-user/alpha/target_syscall.h
@@ -0,0 +1,262 @@
+#ifndef TARGET_SYSCALL_H
+#define TARGET_SYSCALL_H
+
+/* default linux values for the selectors */
+#define __USER_DS      (1)
+
+struct target_pt_regs {
+       abi_ulong r0;
+       abi_ulong r1;
+       abi_ulong r2;
+       abi_ulong r3;
+       abi_ulong r4;
+       abi_ulong r5;
+       abi_ulong r6;
+       abi_ulong r7;
+       abi_ulong r8;
+       abi_ulong r19;
+       abi_ulong r20;
+       abi_ulong r21;
+       abi_ulong r22;
+       abi_ulong r23;
+       abi_ulong r24;
+       abi_ulong r25;
+       abi_ulong r26;
+       abi_ulong r27;
+       abi_ulong r28;
+       abi_ulong hae;
+/* JRP - These are the values provided to a0-a2 by PALcode */
+       abi_ulong trap_a0;
+       abi_ulong trap_a1;
+       abi_ulong trap_a2;
+/* These are saved by PAL-code: */
+       abi_ulong ps;
+       abi_ulong pc;
+       abi_ulong gp;
+       abi_ulong r16;
+       abi_ulong r17;
+       abi_ulong r18;
+/* Those is needed by qemu to temporary store the user stack pointer */
+        abi_ulong usp;
+        abi_ulong unique;
+};
+
+#define UNAME_MACHINE "alpha"
+#define UNAME_MINIMUM_RELEASE "2.6.32"
+
+#undef TARGET_EDEADLK
+#define TARGET_EDEADLK         11
+#undef TARGET_EAGAIN
+#define TARGET_EAGAIN          35
+#undef TARGET_EINPROGRESS
+#define TARGET_EINPROGRESS     36
+#undef TARGET_EALREADY
+#define TARGET_EALREADY                37
+#undef TARGET_ENOTSOCK
+#define TARGET_ENOTSOCK                38
+#undef TARGET_EDESTADDRREQ
+#define TARGET_EDESTADDRREQ    39
+#undef TARGET_EMSGSIZE
+#define TARGET_EMSGSIZE                40
+#undef TARGET_EPROTOTYPE
+#define TARGET_EPROTOTYPE      41
+#undef TARGET_ENOPROTOOPT
+#define TARGET_ENOPROTOOPT     42
+#undef TARGET_EPROTONOSUPPORT
+#define TARGET_EPROTONOSUPPORT 43
+#undef TARGET_ESOCKTNOSUPPORT
+#define TARGET_ESOCKTNOSUPPORT 44
+#undef TARGET_EOPNOTSUPP
+#define TARGET_EOPNOTSUPP      45
+#undef TARGET_EPFNOSUPPORT
+#define TARGET_EPFNOSUPPORT    46
+#undef TARGET_EAFNOSUPPORT
+#define TARGET_EAFNOSUPPORT    47
+#undef TARGET_EADDRINUSE
+#define TARGET_EADDRINUSE      48
+#undef TARGET_EADDRNOTAVAIL
+#define TARGET_EADDRNOTAVAIL   49
+#undef TARGET_ENETDOWN
+#define TARGET_ENETDOWN                50
+#undef TARGET_ENETUNREACH
+#define TARGET_ENETUNREACH     51
+#undef TARGET_ENETRESET
+#define TARGET_ENETRESET       52
+#undef TARGET_ECONNABORTED
+#define TARGET_ECONNABORTED    53
+#undef TARGET_ECONNRESET
+#define TARGET_ECONNRESET      54
+#undef TARGET_ENOBUFS
+#define TARGET_ENOBUFS         55
+#undef TARGET_EISCONN
+#define TARGET_EISCONN         56
+#undef TARGET_ENOTCONN
+#define TARGET_ENOTCONN                57
+#undef TARGET_ESHUTDOWN
+#define TARGET_ESHUTDOWN       58
+#undef TARGET_ETOOMANYREFS
+#define TARGET_ETOOMANYREFS    59
+#undef TARGET_ETIMEDOUT
+#define TARGET_ETIMEDOUT       60
+#undef TARGET_ECONNREFUSED
+#define TARGET_ECONNREFUSED    61
+#undef TARGET_ELOOP
+#define TARGET_ELOOP           62
+#undef TARGET_ENAMETOOLONG
+#define TARGET_ENAMETOOLONG    63
+#undef TARGET_EHOSTDOWN
+#define TARGET_EHOSTDOWN       64
+#undef TARGET_EHOSTUNREACH
+#define TARGET_EHOSTUNREACH    65
+#undef TARGET_ENOTEMPTY
+#define TARGET_ENOTEMPTY       66
+// Unused                      67
+#undef TARGET_EUSERS
+#define TARGET_EUSERS          68
+#undef TARGET_EDQUOT
+#define TARGET_EDQUOT          69
+#undef TARGET_ESTALE
+#define TARGET_ESTALE          70
+#undef TARGET_EREMOTE
+#define TARGET_EREMOTE         71
+// Unused                      72-76
+#undef TARGET_ENOLCK
+#define TARGET_ENOLCK          77
+#undef TARGET_ENOSYS
+#define TARGET_ENOSYS          78
+// Unused                      79
+#undef TARGET_ENOMSG
+#define TARGET_ENOMSG          80
+#undef TARGET_EIDRM
+#define TARGET_EIDRM           81
+#undef TARGET_ENOSR
+#define TARGET_ENOSR           82
+#undef TARGET_ETIME
+#define TARGET_ETIME           83
+#undef TARGET_EBADMSG
+#define TARGET_EBADMSG         84
+#undef TARGET_EPROTO
+#define TARGET_EPROTO          85
+#undef TARGET_ENODATA
+#define TARGET_ENODATA         86
+#undef TARGET_ENOSTR
+#define TARGET_ENOSTR          87
+#undef TARGET_ECHRNG
+#define TARGET_ECHRNG          88
+#undef TARGET_EL2NSYNC
+#define TARGET_EL2NSYNC                89
+#undef TARGET_EL3HLT
+#define TARGET_EL3HLT          90
+#undef TARGET_EL3RST
+#define TARGET_EL3RST          91
+#undef TARGET_ENOPKG
+#define TARGET_ENOPKG          92
+#undef TARGET_ELNRNG
+#define TARGET_ELNRNG          93
+#undef TARGET_EUNATCH
+#define TARGET_EUNATCH         94
+#undef TARGET_ENOCSI
+#define TARGET_ENOCSI          95
+#undef TARGET_EL2HLT
+#define TARGET_EL2HLT          96
+#undef TARGET_EBADE
+#define TARGET_EBADE           97
+#undef TARGET_EBADR
+#define TARGET_EBADR           98
+#undef TARGET_EXFULL
+#define TARGET_EXFULL          99
+#undef TARGET_ENOANO
+#define TARGET_ENOANO          100
+#undef TARGET_EBADRQC
+#define TARGET_EBADRQC         101
+#undef TARGET_EBADSLT
+#define TARGET_EBADSLT         102
+// Unused                      103
+#undef TARGET_EBFONT
+#define TARGET_EBFONT          104
+#undef TARGET_ENONET
+#define TARGET_ENONET          105
+#undef TARGET_ENOLINK
+#define TARGET_ENOLINK         106
+#undef TARGET_EADV
+#define TARGET_EADV            107
+#undef TARGET_ESRMNT
+#define TARGET_ESRMNT          108
+#undef TARGET_ECOMM
+#define TARGET_ECOMM           109
+#undef TARGET_EMULTIHOP
+#define TARGET_EMULTIHOP       110
+#undef TARGET_EDOTDOT
+#define TARGET_EDOTDOT         111
+#undef TARGET_EOVERFLOW
+#define TARGET_EOVERFLOW       112
+#undef TARGET_ENOTUNIQ
+#define TARGET_ENOTUNIQ                113
+#undef TARGET_EBADFD
+#define TARGET_EBADFD          114
+#undef TARGET_EREMCHG
+#define TARGET_EREMCHG         115
+#undef TARGET_EILSEQ
+#define TARGET_EILSEQ          116
+
+// Same as default             117-121
+
+#undef TARGET_ELIBACC
+#define TARGET_ELIBACC         122
+#undef TARGET_ELIBBAD
+#define TARGET_ELIBBAD         123
+#undef TARGET_ELIBSCN
+#define TARGET_ELIBSCN         124
+#undef TARGET_ELIBMAX
+#define TARGET_ELIBMAX         125
+#undef TARGET_ELIBEXEC
+#define TARGET_ELIBEXEC                126
+#undef TARGET_ERESTART
+#define TARGET_ERESTART                127
+#undef TARGET_ESTRPIPE
+#define TARGET_ESTRPIPE                128
+#undef TARGET_ENOMEDIUM
+#define TARGET_ENOMEDIUM       129
+#undef TARGET_EMEDIUMTYPE
+#define TARGET_EMEDIUMTYPE     130
+#undef TARGET_ECANCELED
+#define TARGET_ECANCELED       131
+#undef TARGET_ENOKEY
+#define TARGET_ENOKEY          132
+#undef TARGET_EKEYEXPIRED
+#define TARGET_EKEYEXPIRED     133
+#undef TARGET_EKEYREVOKED
+#define TARGET_EKEYREVOKED     134
+#undef TARGET_EKEYREJECTED
+#define TARGET_EKEYREJECTED    135
+#undef TARGET_EOWNERDEAD
+#define TARGET_EOWNERDEAD      136
+#undef TARGET_ENOTRECOVERABLE
+#define TARGET_ENOTRECOVERABLE 137
+#undef TARGET_ERFKILL
+#define TARGET_ERFKILL         138
+
+// For sys_osf_getsysinfo
+#define TARGET_GSI_UACPROC             8
+#define TARGET_GSI_IEEE_FP_CONTROL     45
+#define TARGET_GSI_IEEE_STATE_AT_SIGNAL        46
+#define TARGET_GSI_PROC_TYPE           60
+#define TARGET_GSI_GET_HWRPB           101
+
+// For sys_ofs_setsysinfo
+#define TARGET_SSI_NVPAIRS             1
+#define TARGET_SSI_IEEE_FP_CONTROL     14
+#define TARGET_SSI_IEEE_STATE_AT_SIGNAL        15
+#define TARGET_SSI_IEEE_IGNORE_STATE_AT_SIGNAL 16
+#define TARGET_SSI_IEEE_RAISE_EXCEPTION        1001
+
+#define TARGET_SSIN_UACPROC            6
+
+#define TARGET_UAC_NOPRINT             1
+#define TARGET_UAC_NOFIX               2
+#define TARGET_UAC_SIGBUS              4
+#define TARGET_MINSIGSTKSZ              4096
+#define TARGET_MLOCKALL_MCL_CURRENT     0x2000
+#define TARGET_MLOCKALL_MCL_FUTURE      0x4000
+
+#endif  /* TARGET_SYSCALL_H */
diff --git a/linux-user/arm/syscall.h b/linux-user/arm/syscall.h
deleted file mode 100644
index 3844a96..0000000
--- a/linux-user/arm/syscall.h
+++ /dev/null
@@ -1,50 +0,0 @@
-
-/* this struct defines the way the registers are stored on the
-   stack during a system call. */
-
-struct target_pt_regs {
-    abi_long uregs[18];
-};
-
-#define ARM_cpsr       uregs[16]
-#define ARM_pc         uregs[15]
-#define ARM_lr         uregs[14]
-#define ARM_sp         uregs[13]
-#define ARM_ip         uregs[12]
-#define ARM_fp         uregs[11]
-#define ARM_r10                uregs[10]
-#define ARM_r9         uregs[9]
-#define ARM_r8         uregs[8]
-#define ARM_r7         uregs[7]
-#define ARM_r6         uregs[6]
-#define ARM_r5         uregs[5]
-#define ARM_r4         uregs[4]
-#define ARM_r3         uregs[3]
-#define ARM_r2         uregs[2]
-#define ARM_r1         uregs[1]
-#define ARM_r0         uregs[0]
-#define ARM_ORIG_r0    uregs[17]
-
-#define ARM_SYSCALL_BASE       0x900000
-#define ARM_THUMB_SYSCALL      0
-
-#define ARM_NR_BASE      0xf0000
-#define ARM_NR_breakpoint (ARM_NR_BASE + 1)
-#define ARM_NR_cacheflush (ARM_NR_BASE + 2)
-#define ARM_NR_set_tls   (ARM_NR_BASE + 5)
-
-#define ARM_NR_semihosting       0x123456
-#define ARM_NR_thumb_semihosting  0xAB
-
-#if defined(TARGET_WORDS_BIGENDIAN)
-#define UNAME_MACHINE "armv5teb"
-#else
-#define UNAME_MACHINE "armv5tel"
-#endif
-#define UNAME_MINIMUM_RELEASE "2.6.32"
-
-#define TARGET_CLONE_BACKWARDS
-
-#define TARGET_MINSIGSTKSZ 2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE  2
diff --git a/linux-user/arm/target_syscall.h b/linux-user/arm/target_syscall.h
new file mode 100644
index 0000000..ea863db
--- /dev/null
+++ b/linux-user/arm/target_syscall.h
@@ -0,0 +1,54 @@
+#ifndef TARGET_SYSCALL_H
+#define TARGET_SYSCALL_H
+
+/* this struct defines the way the registers are stored on the
+   stack during a system call. */
+
+struct target_pt_regs {
+    abi_long uregs[18];
+};
+
+#define ARM_cpsr       uregs[16]
+#define ARM_pc         uregs[15]
+#define ARM_lr         uregs[14]
+#define ARM_sp         uregs[13]
+#define ARM_ip         uregs[12]
+#define ARM_fp         uregs[11]
+#define ARM_r10                uregs[10]
+#define ARM_r9         uregs[9]
+#define ARM_r8         uregs[8]
+#define ARM_r7         uregs[7]
+#define ARM_r6         uregs[6]
+#define ARM_r5         uregs[5]
+#define ARM_r4         uregs[4]
+#define ARM_r3         uregs[3]
+#define ARM_r2         uregs[2]
+#define ARM_r1         uregs[1]
+#define ARM_r0         uregs[0]
+#define ARM_ORIG_r0    uregs[17]
+
+#define ARM_SYSCALL_BASE       0x900000
+#define ARM_THUMB_SYSCALL      0
+
+#define ARM_NR_BASE      0xf0000
+#define ARM_NR_breakpoint (ARM_NR_BASE + 1)
+#define ARM_NR_cacheflush (ARM_NR_BASE + 2)
+#define ARM_NR_set_tls   (ARM_NR_BASE + 5)
+
+#define ARM_NR_semihosting       0x123456
+#define ARM_NR_thumb_semihosting  0xAB
+
+#if defined(TARGET_WORDS_BIGENDIAN)
+#define UNAME_MACHINE "armv5teb"
+#else
+#define UNAME_MACHINE "armv5tel"
+#endif
+#define UNAME_MINIMUM_RELEASE "2.6.32"
+
+#define TARGET_CLONE_BACKWARDS
+
+#define TARGET_MINSIGSTKSZ 2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE  2
+
+#endif  /* TARGET_SYSCALL_H */
diff --git a/linux-user/cris/syscall.h b/linux-user/cris/syscall.h
deleted file mode 100644
index 2957b0d..0000000
--- a/linux-user/cris/syscall.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef CRIS_SYSCALL_H
-#define CRIS_SYSCALL_H 1
-
-#define UNAME_MACHINE "cris"
-#define UNAME_MINIMUM_RELEASE "2.6.32"
-
-/* pt_regs not only specifices the format in the user-struct during
- * ptrace but is also the frame format used in the kernel prologue/epilogues
- * themselves
- */
-
-struct target_pt_regs {
-        unsigned long orig_r10;
-        /* pushed by movem r13, [sp] in SAVE_ALL. */
-        unsigned long r0;
-        unsigned long r1;
-        unsigned long r2;
-        unsigned long r3;
-        unsigned long r4;
-        unsigned long r5;
-        unsigned long r6;
-        unsigned long r7;
-        unsigned long r8;
-        unsigned long r9;
-        unsigned long r10;
-        unsigned long r11;
-        unsigned long r12;
-        unsigned long r13;
-        unsigned long acr;
-        unsigned long srs;
-        unsigned long mof;
-        unsigned long spc;
-        unsigned long ccs;
-        unsigned long srp;
-        unsigned long erp; /* This is actually the debugged process' PC */
-        /* For debugging purposes; saved only when needed. */
-        unsigned long exs;
-        unsigned long eda;
-};
-
-#define TARGET_CLONE_BACKWARDS2
-#define TARGET_MINSIGSTKSZ 2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE  2
-
-#endif
diff --git a/linux-user/cris/target_syscall.h b/linux-user/cris/target_syscall.h
new file mode 100644
index 0000000..2957b0d
--- /dev/null
+++ b/linux-user/cris/target_syscall.h
@@ -0,0 +1,46 @@
+#ifndef CRIS_SYSCALL_H
+#define CRIS_SYSCALL_H 1
+
+#define UNAME_MACHINE "cris"
+#define UNAME_MINIMUM_RELEASE "2.6.32"
+
+/* pt_regs not only specifices the format in the user-struct during
+ * ptrace but is also the frame format used in the kernel prologue/epilogues
+ * themselves
+ */
+
+struct target_pt_regs {
+        unsigned long orig_r10;
+        /* pushed by movem r13, [sp] in SAVE_ALL. */
+        unsigned long r0;
+        unsigned long r1;
+        unsigned long r2;
+        unsigned long r3;
+        unsigned long r4;
+        unsigned long r5;
+        unsigned long r6;
+        unsigned long r7;
+        unsigned long r8;
+        unsigned long r9;
+        unsigned long r10;
+        unsigned long r11;
+        unsigned long r12;
+        unsigned long r13;
+        unsigned long acr;
+        unsigned long srs;
+        unsigned long mof;
+        unsigned long spc;
+        unsigned long ccs;
+        unsigned long srp;
+        unsigned long erp; /* This is actually the debugged process' PC */
+        /* For debugging purposes; saved only when needed. */
+        unsigned long exs;
+        unsigned long eda;
+};
+
+#define TARGET_CLONE_BACKWARDS2
+#define TARGET_MINSIGSTKSZ 2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE  2
+
+#endif
diff --git a/linux-user/i386/syscall.h b/linux-user/i386/syscall.h
deleted file mode 100644
index 906aaac..0000000
--- a/linux-user/i386/syscall.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/* default linux values for the selectors */
-#define __USER_CS      (0x23)
-#define __USER_DS      (0x2B)
-
-struct target_pt_regs {
-       long ebx;
-       long ecx;
-       long edx;
-       long esi;
-       long edi;
-       long ebp;
-       long eax;
-       int  xds;
-       int  xes;
-       long orig_eax;
-       long eip;
-       int  xcs;
-       long eflags;
-       long esp;
-       int  xss;
-};
-
-/* ioctls */
-
-#define TARGET_LDT_ENTRIES      8192
-#define TARGET_LDT_ENTRY_SIZE  8
-
-#define TARGET_GDT_ENTRIES             9
-#define TARGET_GDT_ENTRY_TLS_ENTRIES   3
-#define TARGET_GDT_ENTRY_TLS_MIN       6
-#define TARGET_GDT_ENTRY_TLS_MAX       (TARGET_GDT_ENTRY_TLS_MIN + 
TARGET_GDT_ENTRY_TLS_ENTRIES - 1)
-
-struct target_modify_ldt_ldt_s {
-    unsigned int  entry_number;
-    abi_ulong base_addr;
-    unsigned int limit;
-    unsigned int flags;
-};
-
-/* vm86 defines */
-
-#define TARGET_BIOSSEG         0x0f000
-
-#define TARGET_CPU_086         0
-#define TARGET_CPU_186         1
-#define TARGET_CPU_286         2
-#define TARGET_CPU_386         3
-#define TARGET_CPU_486         4
-#define TARGET_CPU_586         5
-
-#define TARGET_VM86_SIGNAL     0       /* return due to signal */
-#define TARGET_VM86_UNKNOWN    1       /* unhandled GP fault - IO-instruction 
or similar */
-#define TARGET_VM86_INTx       2       /* int3/int x instruction (ARG = x) */
-#define TARGET_VM86_STI        3       /* sti/popf/iret instruction enabled 
virtual interrupts */
-
-/*
- * Additional return values when invoking new vm86()
- */
-#define TARGET_VM86_PICRETURN  4       /* return due to pending PIC request */
-#define TARGET_VM86_TRAP       6       /* return due to DOS-debugger request */
-
-/*
- * function codes when invoking new vm86()
- */
-#define TARGET_VM86_PLUS_INSTALL_CHECK 0
-#define TARGET_VM86_ENTER              1
-#define TARGET_VM86_ENTER_NO_BYPASS    2
-#define        TARGET_VM86_REQUEST_IRQ 3
-#define TARGET_VM86_FREE_IRQ           4
-#define TARGET_VM86_GET_IRQ_BITS       5
-#define TARGET_VM86_GET_AND_RESET_IRQ  6
-
-/*
- * This is the stack-layout seen by the user space program when we have
- * done a translation of "SAVE_ALL" from vm86 mode. The real kernel layout
- * is 'kernel_vm86_regs' (see below).
- */
-
-struct target_vm86_regs {
-/*
- * normal regs, with special meaning for the segment descriptors..
- */
-       abi_long ebx;
-       abi_long ecx;
-       abi_long edx;
-       abi_long esi;
-       abi_long edi;
-       abi_long ebp;
-       abi_long eax;
-       abi_long __null_ds;
-       abi_long __null_es;
-       abi_long __null_fs;
-       abi_long __null_gs;
-       abi_long orig_eax;
-       abi_long eip;
-       unsigned short cs, __csh;
-       abi_long eflags;
-       abi_long esp;
-       unsigned short ss, __ssh;
-/*
- * these are specific to v86 mode:
- */
-       unsigned short es, __esh;
-       unsigned short ds, __dsh;
-       unsigned short fs, __fsh;
-       unsigned short gs, __gsh;
-};
-
-struct target_revectored_struct {
-       abi_ulong __map[8];                     /* 256 bits */
-};
-
-struct target_vm86_struct {
-       struct target_vm86_regs regs;
-       abi_ulong flags;
-       abi_ulong screen_bitmap;
-       abi_ulong cpu_type;
-       struct target_revectored_struct int_revectored;
-       struct target_revectored_struct int21_revectored;
-};
-
-/*
- * flags masks
- */
-#define TARGET_VM86_SCREEN_BITMAP      0x0001
-
-struct target_vm86plus_info_struct {
-        abi_ulong flags;
-#define TARGET_force_return_for_pic (1 << 0)
-#define TARGET_vm86dbg_active       (1 << 1)  /* for debugger */
-#define TARGET_vm86dbg_TFpendig     (1 << 2)  /* for debugger */
-#define TARGET_is_vm86pus           (1 << 31) /* for vm86 internal use */
-       unsigned char vm86dbg_intxxtab[32];   /* for debugger */
-};
-
-struct target_vm86plus_struct {
-       struct target_vm86_regs regs;
-       abi_ulong flags;
-       abi_ulong screen_bitmap;
-       abi_ulong cpu_type;
-       struct target_revectored_struct int_revectored;
-       struct target_revectored_struct int21_revectored;
-       struct target_vm86plus_info_struct vm86plus;
-};
-
-#define UNAME_MACHINE "i686"
-#define UNAME_MINIMUM_RELEASE "2.6.32"
-
-#define TARGET_CLONE_BACKWARDS
-#define TARGET_MINSIGSTKSZ 2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE  2
diff --git a/linux-user/i386/target_syscall.h b/linux-user/i386/target_syscall.h
new file mode 100644
index 0000000..0ac84dc
--- /dev/null
+++ b/linux-user/i386/target_syscall.h
@@ -0,0 +1,157 @@
+#ifndef TARGET_SYSCALL_H
+#define TARGET_SYSCALL_H
+
+/* default linux values for the selectors */
+#define __USER_CS      (0x23)
+#define __USER_DS      (0x2B)
+
+struct target_pt_regs {
+       long ebx;
+       long ecx;
+       long edx;
+       long esi;
+       long edi;
+       long ebp;
+       long eax;
+       int  xds;
+       int  xes;
+       long orig_eax;
+       long eip;
+       int  xcs;
+       long eflags;
+       long esp;
+       int  xss;
+};
+
+/* ioctls */
+
+#define TARGET_LDT_ENTRIES      8192
+#define TARGET_LDT_ENTRY_SIZE  8
+
+#define TARGET_GDT_ENTRIES             9
+#define TARGET_GDT_ENTRY_TLS_ENTRIES   3
+#define TARGET_GDT_ENTRY_TLS_MIN       6
+#define TARGET_GDT_ENTRY_TLS_MAX       (TARGET_GDT_ENTRY_TLS_MIN + 
TARGET_GDT_ENTRY_TLS_ENTRIES - 1)
+
+struct target_modify_ldt_ldt_s {
+    unsigned int  entry_number;
+    abi_ulong base_addr;
+    unsigned int limit;
+    unsigned int flags;
+};
+
+/* vm86 defines */
+
+#define TARGET_BIOSSEG         0x0f000
+
+#define TARGET_CPU_086         0
+#define TARGET_CPU_186         1
+#define TARGET_CPU_286         2
+#define TARGET_CPU_386         3
+#define TARGET_CPU_486         4
+#define TARGET_CPU_586         5
+
+#define TARGET_VM86_SIGNAL     0       /* return due to signal */
+#define TARGET_VM86_UNKNOWN    1       /* unhandled GP fault - IO-instruction 
or similar */
+#define TARGET_VM86_INTx       2       /* int3/int x instruction (ARG = x) */
+#define TARGET_VM86_STI        3       /* sti/popf/iret instruction enabled 
virtual interrupts */
+
+/*
+ * Additional return values when invoking new vm86()
+ */
+#define TARGET_VM86_PICRETURN  4       /* return due to pending PIC request */
+#define TARGET_VM86_TRAP       6       /* return due to DOS-debugger request */
+
+/*
+ * function codes when invoking new vm86()
+ */
+#define TARGET_VM86_PLUS_INSTALL_CHECK 0
+#define TARGET_VM86_ENTER              1
+#define TARGET_VM86_ENTER_NO_BYPASS    2
+#define        TARGET_VM86_REQUEST_IRQ 3
+#define TARGET_VM86_FREE_IRQ           4
+#define TARGET_VM86_GET_IRQ_BITS       5
+#define TARGET_VM86_GET_AND_RESET_IRQ  6
+
+/*
+ * This is the stack-layout seen by the user space program when we have
+ * done a translation of "SAVE_ALL" from vm86 mode. The real kernel layout
+ * is 'kernel_vm86_regs' (see below).
+ */
+
+struct target_vm86_regs {
+/*
+ * normal regs, with special meaning for the segment descriptors..
+ */
+       abi_long ebx;
+       abi_long ecx;
+       abi_long edx;
+       abi_long esi;
+       abi_long edi;
+       abi_long ebp;
+       abi_long eax;
+       abi_long __null_ds;
+       abi_long __null_es;
+       abi_long __null_fs;
+       abi_long __null_gs;
+       abi_long orig_eax;
+       abi_long eip;
+       unsigned short cs, __csh;
+       abi_long eflags;
+       abi_long esp;
+       unsigned short ss, __ssh;
+/*
+ * these are specific to v86 mode:
+ */
+       unsigned short es, __esh;
+       unsigned short ds, __dsh;
+       unsigned short fs, __fsh;
+       unsigned short gs, __gsh;
+};
+
+struct target_revectored_struct {
+       abi_ulong __map[8];                     /* 256 bits */
+};
+
+struct target_vm86_struct {
+       struct target_vm86_regs regs;
+       abi_ulong flags;
+       abi_ulong screen_bitmap;
+       abi_ulong cpu_type;
+       struct target_revectored_struct int_revectored;
+       struct target_revectored_struct int21_revectored;
+};
+
+/*
+ * flags masks
+ */
+#define TARGET_VM86_SCREEN_BITMAP      0x0001
+
+struct target_vm86plus_info_struct {
+        abi_ulong flags;
+#define TARGET_force_return_for_pic (1 << 0)
+#define TARGET_vm86dbg_active       (1 << 1)  /* for debugger */
+#define TARGET_vm86dbg_TFpendig     (1 << 2)  /* for debugger */
+#define TARGET_is_vm86pus           (1 << 31) /* for vm86 internal use */
+       unsigned char vm86dbg_intxxtab[32];   /* for debugger */
+};
+
+struct target_vm86plus_struct {
+       struct target_vm86_regs regs;
+       abi_ulong flags;
+       abi_ulong screen_bitmap;
+       abi_ulong cpu_type;
+       struct target_revectored_struct int_revectored;
+       struct target_revectored_struct int21_revectored;
+       struct target_vm86plus_info_struct vm86plus;
+};
+
+#define UNAME_MACHINE "i686"
+#define UNAME_MINIMUM_RELEASE "2.6.32"
+
+#define TARGET_CLONE_BACKWARDS
+#define TARGET_MINSIGSTKSZ 2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE  2
+
+#endif  /* TARGET_SYSCALL_H */
diff --git a/linux-user/m68k/syscall.h b/linux-user/m68k/syscall.h
deleted file mode 100644
index 9218493..0000000
--- a/linux-user/m68k/syscall.h
+++ /dev/null
@@ -1,25 +0,0 @@
-
-/* this struct defines the way the registers are stored on the
-   stack during a system call. */
-
-struct target_pt_regs {
-    abi_long d1, d2, d3, d4, d5, d6, d7;
-    abi_long a0, a1, a2, a3, a4, a5, a6;
-    abi_ulong d0;
-    abi_ulong usp;
-    abi_ulong orig_d0;
-    int16_t stkadj;
-    uint16_t sr;
-    abi_ulong pc;
-    uint16_t fntvex;
-    uint16_t __fill;
-};
-
-#define UNAME_MACHINE "m68k"
-#define UNAME_MINIMUM_RELEASE "2.6.32"
-
-#define TARGET_MINSIGSTKSZ 2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE  2
-
-void do_m68k_simcall(CPUM68KState *, int);
diff --git a/linux-user/m68k/target_syscall.h b/linux-user/m68k/target_syscall.h
new file mode 100644
index 0000000..97a4cc0
--- /dev/null
+++ b/linux-user/m68k/target_syscall.h
@@ -0,0 +1,29 @@
+#ifndef TARGET_SYSCALL_H
+#define TARGET_SYSCALL_H
+
+/* this struct defines the way the registers are stored on the
+   stack during a system call. */
+
+struct target_pt_regs {
+    abi_long d1, d2, d3, d4, d5, d6, d7;
+    abi_long a0, a1, a2, a3, a4, a5, a6;
+    abi_ulong d0;
+    abi_ulong usp;
+    abi_ulong orig_d0;
+    int16_t stkadj;
+    uint16_t sr;
+    abi_ulong pc;
+    uint16_t fntvex;
+    uint16_t __fill;
+};
+
+#define UNAME_MACHINE "m68k"
+#define UNAME_MINIMUM_RELEASE "2.6.32"
+
+#define TARGET_MINSIGSTKSZ 2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE  2
+
+void do_m68k_simcall(CPUM68KState *, int);
+
+#endif  /* TARGET_SYSCALL_H */
diff --git a/linux-user/microblaze/syscall.h b/linux-user/microblaze/syscall.h
deleted file mode 100644
index 3c1ed27..0000000
--- a/linux-user/microblaze/syscall.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef MICROBLAZE_SYSCALLS_H
-#define MICROBLAZE_SYSCALLS_H 1
-
-#define UNAME_MACHINE "microblaze"
-#define UNAME_MINIMUM_RELEASE "2.6.32"
-
-/* We use microblaze_reg_t to keep things similar to the kernel sources.  */
-typedef uint32_t microblaze_reg_t;
-
-struct target_pt_regs {
-        microblaze_reg_t r0;
-        microblaze_reg_t r1;
-        microblaze_reg_t r2;
-        microblaze_reg_t r3;
-        microblaze_reg_t r4;
-        microblaze_reg_t r5;
-        microblaze_reg_t r6;
-        microblaze_reg_t r7;
-        microblaze_reg_t r8;
-        microblaze_reg_t r9;
-        microblaze_reg_t r10;
-        microblaze_reg_t r11;
-        microblaze_reg_t r12;
-        microblaze_reg_t r13;
-        microblaze_reg_t r14;
-        microblaze_reg_t r15;
-        microblaze_reg_t r16;
-        microblaze_reg_t r17;
-        microblaze_reg_t r18;
-        microblaze_reg_t r19;
-        microblaze_reg_t r20;
-        microblaze_reg_t r21;
-        microblaze_reg_t r22;
-        microblaze_reg_t r23;
-        microblaze_reg_t r24;
-        microblaze_reg_t r25;
-        microblaze_reg_t r26;
-        microblaze_reg_t r27;
-        microblaze_reg_t r28;
-        microblaze_reg_t r29;
-        microblaze_reg_t r30;
-        microblaze_reg_t r31;
-        microblaze_reg_t pc;
-        microblaze_reg_t msr;
-        microblaze_reg_t ear;
-        microblaze_reg_t esr;
-        microblaze_reg_t fsr;
-        uint32_t kernel_mode;
-};
-
-#define TARGET_CLONE_BACKWARDS
-#define TARGET_MINSIGSTKSZ      2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE  2
-
-#endif
diff --git a/linux-user/microblaze/target_syscall.h 
b/linux-user/microblaze/target_syscall.h
new file mode 100644
index 0000000..3c1ed27
--- /dev/null
+++ b/linux-user/microblaze/target_syscall.h
@@ -0,0 +1,56 @@
+#ifndef MICROBLAZE_SYSCALLS_H
+#define MICROBLAZE_SYSCALLS_H 1
+
+#define UNAME_MACHINE "microblaze"
+#define UNAME_MINIMUM_RELEASE "2.6.32"
+
+/* We use microblaze_reg_t to keep things similar to the kernel sources.  */
+typedef uint32_t microblaze_reg_t;
+
+struct target_pt_regs {
+        microblaze_reg_t r0;
+        microblaze_reg_t r1;
+        microblaze_reg_t r2;
+        microblaze_reg_t r3;
+        microblaze_reg_t r4;
+        microblaze_reg_t r5;
+        microblaze_reg_t r6;
+        microblaze_reg_t r7;
+        microblaze_reg_t r8;
+        microblaze_reg_t r9;
+        microblaze_reg_t r10;
+        microblaze_reg_t r11;
+        microblaze_reg_t r12;
+        microblaze_reg_t r13;
+        microblaze_reg_t r14;
+        microblaze_reg_t r15;
+        microblaze_reg_t r16;
+        microblaze_reg_t r17;
+        microblaze_reg_t r18;
+        microblaze_reg_t r19;
+        microblaze_reg_t r20;
+        microblaze_reg_t r21;
+        microblaze_reg_t r22;
+        microblaze_reg_t r23;
+        microblaze_reg_t r24;
+        microblaze_reg_t r25;
+        microblaze_reg_t r26;
+        microblaze_reg_t r27;
+        microblaze_reg_t r28;
+        microblaze_reg_t r29;
+        microblaze_reg_t r30;
+        microblaze_reg_t r31;
+        microblaze_reg_t pc;
+        microblaze_reg_t msr;
+        microblaze_reg_t ear;
+        microblaze_reg_t esr;
+        microblaze_reg_t fsr;
+        uint32_t kernel_mode;
+};
+
+#define TARGET_CLONE_BACKWARDS
+#define TARGET_MINSIGSTKSZ      2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE  2
+
+#endif
diff --git a/linux-user/mips/syscall.h b/linux-user/mips/syscall.h
deleted file mode 100644
index 35ca23b..0000000
--- a/linux-user/mips/syscall.h
+++ /dev/null
@@ -1,233 +0,0 @@
-
-/* this struct defines the way the registers are stored on the
-   stack during a system call. */
-
-struct target_pt_regs {
-       /* Pad bytes for argument save space on the stack. */
-       abi_ulong pad0[6];
-
-       /* Saved main processor registers. */
-       abi_ulong regs[32];
-
-       /* Saved special registers. */
-       abi_ulong cp0_status;
-       abi_ulong lo;
-       abi_ulong hi;
-       abi_ulong cp0_badvaddr;
-       abi_ulong cp0_cause;
-       abi_ulong cp0_epc;
-};
-
-/* Target errno definitions taken from asm-mips/errno.h */
-#undef TARGET_ENOMSG
-#define TARGET_ENOMSG          35      /* Identifier removed */
-#undef TARGET_EIDRM
-#define TARGET_EIDRM           36      /* Identifier removed */
-#undef TARGET_ECHRNG
-#define TARGET_ECHRNG          37      /* Channel number out of range */
-#undef TARGET_EL2NSYNC
-#define TARGET_EL2NSYNC        38      /* Level 2 not synchronized */
-#undef TARGET_EL3HLT
-#define TARGET_EL3HLT          39      /* Level 3 halted */
-#undef TARGET_EL3RST
-#define TARGET_EL3RST          40      /* Level 3 reset */
-#undef TARGET_ELNRNG
-#define TARGET_ELNRNG          41      /* Link number out of range */
-#undef TARGET_EUNATCH
-#define TARGET_EUNATCH         42      /* Protocol driver not attached */
-#undef TARGET_ENOCSI
-#define TARGET_ENOCSI          43      /* No CSI structure available */
-#undef TARGET_EL2HLT
-#define TARGET_EL2HLT          44      /* Level 2 halted */
-#undef TARGET_EDEADLK
-#define TARGET_EDEADLK         45      /* Resource deadlock would occur */
-#undef TARGET_ENOLCK
-#define TARGET_ENOLCK          46      /* No record locks available */
-#undef TARGET_EBADE
-#define TARGET_EBADE           50      /* Invalid exchange */
-#undef TARGET_EBADR
-#define TARGET_EBADR           51      /* Invalid request descriptor */
-#undef TARGET_EXFULL
-#define TARGET_EXFULL          52      /* TARGET_Exchange full */
-#undef TARGET_ENOANO
-#define TARGET_ENOANO          53      /* No anode */
-#undef TARGET_EBADRQC
-#define TARGET_EBADRQC         54      /* Invalid request code */
-#undef TARGET_EBADSLT
-#define TARGET_EBADSLT         55      /* Invalid slot */
-#undef TARGET_EDEADLOCK
-#define TARGET_EDEADLOCK       56      /* File locking deadlock error */
-#undef TARGET_EBFONT
-#define TARGET_EBFONT          59      /* Bad font file format */
-#undef TARGET_ENOSTR
-#define TARGET_ENOSTR          60      /* Device not a stream */
-#undef TARGET_ENODATA
-#define TARGET_ENODATA         61      /* No data available */
-#undef TARGET_ETIME
-#define TARGET_ETIME           62      /* Timer expired */
-#undef TARGET_ENOSR
-#define TARGET_ENOSR           63      /* Out of streams resources */
-#undef TARGET_ENONET
-#define TARGET_ENONET          64      /* Machine is not on the network */
-#undef TARGET_ENOPKG
-#define TARGET_ENOPKG          65      /* Package not installed */
-#undef TARGET_EREMOTE
-#define TARGET_EREMOTE         66      /* Object is remote */
-#undef TARGET_ENOLINK
-#define TARGET_ENOLINK         67      /* Link has been severed */
-#undef TARGET_EADV
-#define TARGET_EADV            68      /* Advertise error */
-#undef TARGET_ESRMNT
-#define TARGET_ESRMNT          69      /* Srmount error */
-#undef TARGET_ECOMM
-#define TARGET_ECOMM           70      /* Communication error on send */
-#undef TARGET_EPROTO
-#define TARGET_EPROTO          71      /* Protocol error */
-#undef TARGET_EDOTDOT
-#define TARGET_EDOTDOT         73      /* RFS specific error */
-#undef TARGET_EMULTIHOP
-#define TARGET_EMULTIHOP       74      /* Multihop attempted */
-#undef TARGET_EBADMSG
-#define TARGET_EBADMSG         77      /* Not a data message */
-#undef TARGET_ENAMETOOLONG
-#define TARGET_ENAMETOOLONG    78      /* File name too long */
-#undef TARGET_EOVERFLOW
-#define TARGET_EOVERFLOW       79      /* Value too large for defined data 
type */
-#undef TARGET_ENOTUNIQ
-#define TARGET_ENOTUNIQ        80      /* Name not unique on network */
-#undef TARGET_EBADFD
-#define TARGET_EBADFD          81      /* File descriptor in bad state */
-#undef TARGET_EREMCHG
-#define TARGET_EREMCHG         82      /* Remote address changed */
-#undef TARGET_ELIBACC
-#define TARGET_ELIBACC         83      /* Can not access a needed shared 
library */
-#undef TARGET_ELIBBAD
-#define TARGET_ELIBBAD         84      /* Accessing a corrupted shared library 
*/
-#undef TARGET_ELIBSCN
-#define TARGET_ELIBSCN         85      /* .lib section in a.out corrupted */
-#undef TARGET_ELIBMAX
-#define TARGET_ELIBMAX         86      /* Attempting to link in too many 
shared libraries */
-#undef TARGET_ELIBEXEC
-#define TARGET_ELIBEXEC        87      /* Cannot exec a shared library 
directly */
-#undef TARGET_EILSEQ
-#define TARGET_EILSEQ          88      /* Illegal byte sequence */
-#undef TARGET_ENOSYS
-#define TARGET_ENOSYS          89      /* Function not implemented */
-#undef TARGET_ELOOP
-#define TARGET_ELOOP           90      /* Too many symbolic links encountered 
*/
-#undef TARGET_ERESTART
-#define TARGET_ERESTART        91      /* Interrupted system call should be 
restarted */
-#undef TARGET_ESTRPIPE
-#define TARGET_ESTRPIPE        92      /* Streams pipe error */
-#undef TARGET_ENOTEMPTY
-#define TARGET_ENOTEMPTY       93      /* Directory not empty */
-#undef TARGET_EUSERS
-#define TARGET_EUSERS          94      /* Too many users */
-#undef TARGET_ENOTSOCK
-#define TARGET_ENOTSOCK        95      /* Socket operation on non-socket */
-#undef TARGET_EDESTADDRREQ
-#define TARGET_EDESTADDRREQ    96      /* Destination address required */
-#undef TARGET_EMSGSIZE
-#define TARGET_EMSGSIZE        97      /* Message too long */
-#undef TARGET_EPROTOTYPE
-#define TARGET_EPROTOTYPE      98      /* Protocol wrong type for socket */
-#undef TARGET_ENOPROTOOPT
-#define TARGET_ENOPROTOOPT     99      /* Protocol not available */
-#undef TARGET_EPROTONOSUPPORT
-#define TARGET_EPROTONOSUPPORT 120     /* Protocol not supported */
-#undef TARGET_ESOCKTNOSUPPORT
-#define TARGET_ESOCKTNOSUPPORT 121     /* Socket type not supported */
-#undef TARGET_EOPNOTSUPP
-#define TARGET_EOPNOTSUPP      122     /* Operation not supported on transport 
endpoint */
-#undef TARGET_EPFNOSUPPORT
-#define TARGET_EPFNOSUPPORT    123     /* Protocol family not supported */
-#undef TARGET_EAFNOSUPPORT
-#define TARGET_EAFNOSUPPORT    124     /* Address family not supported by 
protocol */
-#undef TARGET_EADDRINUSE
-#define TARGET_EADDRINUSE      125     /* Address already in use */
-#undef TARGET_EADDRNOTAVAIL
-#define TARGET_EADDRNOTAVAIL   126     /* Cannot assign requested address */
-#undef TARGET_ENETDOWN
-#define TARGET_ENETDOWN        127     /* Network is down */
-#undef TARGET_ENETUNREACH
-#define TARGET_ENETUNREACH     128     /* Network is unreachable */
-#undef TARGET_ENETRESET
-#define TARGET_ENETRESET       129     /* Network dropped connection because 
of reset */
-#undef TARGET_ECONNABORTED
-#define TARGET_ECONNABORTED    130     /* Software caused connection abort */
-#undef TARGET_ECONNRESET
-#define TARGET_ECONNRESET      131     /* Connection reset by peer */
-#undef TARGET_ENOBUFS
-#define TARGET_ENOBUFS         132     /* No buffer space available */
-#undef TARGET_EISCONN
-#define TARGET_EISCONN         133     /* Transport endpoint is already 
connected */
-#undef TARGET_ENOTCONN
-#define TARGET_ENOTCONN        134     /* Transport endpoint is not connected 
*/
-#undef TARGET_EUCLEAN
-#define TARGET_EUCLEAN         135     /* Structure needs cleaning */
-#undef TARGET_ENOTNAM
-#define TARGET_ENOTNAM         137     /* Not a XENIX named type file */
-#undef TARGET_ENAVAIL
-#define TARGET_ENAVAIL         138     /* No XENIX semaphores available */
-#undef TARGET_EISNAM
-#define TARGET_EISNAM          139     /* Is a named type file */
-#undef TARGET_EREMOTEIO
-#define TARGET_EREMOTEIO       140     /* Remote I/O error */
-#undef TARGET_EINIT
-#define TARGET_EINIT           141     /* Reserved */
-#undef TARGET_EREMDEV
-#define TARGET_EREMDEV         142     /* TARGET_Error 142 */
-#undef TARGET_ESHUTDOWN
-#define TARGET_ESHUTDOWN       143     /* Cannot send after transport endpoint 
shutdown */
-#undef TARGET_ETOOMANYREFS
-#define TARGET_ETOOMANYREFS    144     /* Too many references: cannot splice */
-#undef TARGET_ETIMEDOUT
-#define TARGET_ETIMEDOUT       145     /* Connection timed out */
-#undef TARGET_ECONNREFUSED
-#define TARGET_ECONNREFUSED    146     /* Connection refused */
-#undef TARGET_EHOSTDOWN
-#define TARGET_EHOSTDOWN       147     /* Host is down */
-#undef TARGET_EHOSTUNREACH
-#define TARGET_EHOSTUNREACH    148     /* No route to host */
-#undef TARGET_EALREADY
-#define TARGET_EALREADY        149     /* Operation already in progress */
-#undef TARGET_EINPROGRESS
-#define TARGET_EINPROGRESS     150     /* Operation now in progress */
-#undef TARGET_ESTALE
-#define TARGET_ESTALE          151     /* Stale NFS file handle */
-#undef TARGET_ECANCELED
-#define TARGET_ECANCELED       158     /* AIO operation canceled */
-/*
- * These error are Linux extensions.
- */
-#undef TARGET_ENOMEDIUM
-#define TARGET_ENOMEDIUM       159     /* No medium found */
-#undef TARGET_EMEDIUMTYPE
-#define TARGET_EMEDIUMTYPE     160     /* Wrong medium type */
-#undef TARGET_ENOKEY
-#define TARGET_ENOKEY          161     /* Required key not available */
-#undef TARGET_EKEYEXPIRED
-#define TARGET_EKEYEXPIRED     162     /* Key has expired */
-#undef TARGET_EKEYREVOKED
-#define TARGET_EKEYREVOKED     163     /* Key has been revoked */
-#undef TARGET_EKEYREJECTED
-#define TARGET_EKEYREJECTED    164     /* Key was rejected by service */
-
-/* for robust mutexes */
-#undef TARGET_EOWNERDEAD
-#define TARGET_EOWNERDEAD      165     /* Owner died */
-#undef TARGET_ENOTRECOVERABLE
-#define TARGET_ENOTRECOVERABLE 166     /* State not recoverable */
-
-
-
-/* Nasty hack: define a fake errno value for use by sigreturn.  */
-#define TARGET_QEMU_ESIGRETURN 255
-
-#define UNAME_MACHINE "mips"
-#define UNAME_MINIMUM_RELEASE "2.6.32"
-
-#define TARGET_CLONE_BACKWARDS
-#define TARGET_MINSIGSTKSZ 2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE  2
diff --git a/linux-user/mips/target_syscall.h b/linux-user/mips/target_syscall.h
new file mode 100644
index 0000000..68db160
--- /dev/null
+++ b/linux-user/mips/target_syscall.h
@@ -0,0 +1,237 @@
+#ifndef TARGET_SYSCALL_H
+#define TARGET_SYSCALL_H
+
+/* this struct defines the way the registers are stored on the
+   stack during a system call. */
+
+struct target_pt_regs {
+       /* Pad bytes for argument save space on the stack. */
+       abi_ulong pad0[6];
+
+       /* Saved main processor registers. */
+       abi_ulong regs[32];
+
+       /* Saved special registers. */
+       abi_ulong cp0_status;
+       abi_ulong lo;
+       abi_ulong hi;
+       abi_ulong cp0_badvaddr;
+       abi_ulong cp0_cause;
+       abi_ulong cp0_epc;
+};
+
+/* Target errno definitions taken from asm-mips/errno.h */
+#undef TARGET_ENOMSG
+#define TARGET_ENOMSG          35      /* Identifier removed */
+#undef TARGET_EIDRM
+#define TARGET_EIDRM           36      /* Identifier removed */
+#undef TARGET_ECHRNG
+#define TARGET_ECHRNG          37      /* Channel number out of range */
+#undef TARGET_EL2NSYNC
+#define TARGET_EL2NSYNC        38      /* Level 2 not synchronized */
+#undef TARGET_EL3HLT
+#define TARGET_EL3HLT          39      /* Level 3 halted */
+#undef TARGET_EL3RST
+#define TARGET_EL3RST          40      /* Level 3 reset */
+#undef TARGET_ELNRNG
+#define TARGET_ELNRNG          41      /* Link number out of range */
+#undef TARGET_EUNATCH
+#define TARGET_EUNATCH         42      /* Protocol driver not attached */
+#undef TARGET_ENOCSI
+#define TARGET_ENOCSI          43      /* No CSI structure available */
+#undef TARGET_EL2HLT
+#define TARGET_EL2HLT          44      /* Level 2 halted */
+#undef TARGET_EDEADLK
+#define TARGET_EDEADLK         45      /* Resource deadlock would occur */
+#undef TARGET_ENOLCK
+#define TARGET_ENOLCK          46      /* No record locks available */
+#undef TARGET_EBADE
+#define TARGET_EBADE           50      /* Invalid exchange */
+#undef TARGET_EBADR
+#define TARGET_EBADR           51      /* Invalid request descriptor */
+#undef TARGET_EXFULL
+#define TARGET_EXFULL          52      /* TARGET_Exchange full */
+#undef TARGET_ENOANO
+#define TARGET_ENOANO          53      /* No anode */
+#undef TARGET_EBADRQC
+#define TARGET_EBADRQC         54      /* Invalid request code */
+#undef TARGET_EBADSLT
+#define TARGET_EBADSLT         55      /* Invalid slot */
+#undef TARGET_EDEADLOCK
+#define TARGET_EDEADLOCK       56      /* File locking deadlock error */
+#undef TARGET_EBFONT
+#define TARGET_EBFONT          59      /* Bad font file format */
+#undef TARGET_ENOSTR
+#define TARGET_ENOSTR          60      /* Device not a stream */
+#undef TARGET_ENODATA
+#define TARGET_ENODATA         61      /* No data available */
+#undef TARGET_ETIME
+#define TARGET_ETIME           62      /* Timer expired */
+#undef TARGET_ENOSR
+#define TARGET_ENOSR           63      /* Out of streams resources */
+#undef TARGET_ENONET
+#define TARGET_ENONET          64      /* Machine is not on the network */
+#undef TARGET_ENOPKG
+#define TARGET_ENOPKG          65      /* Package not installed */
+#undef TARGET_EREMOTE
+#define TARGET_EREMOTE         66      /* Object is remote */
+#undef TARGET_ENOLINK
+#define TARGET_ENOLINK         67      /* Link has been severed */
+#undef TARGET_EADV
+#define TARGET_EADV            68      /* Advertise error */
+#undef TARGET_ESRMNT
+#define TARGET_ESRMNT          69      /* Srmount error */
+#undef TARGET_ECOMM
+#define TARGET_ECOMM           70      /* Communication error on send */
+#undef TARGET_EPROTO
+#define TARGET_EPROTO          71      /* Protocol error */
+#undef TARGET_EDOTDOT
+#define TARGET_EDOTDOT         73      /* RFS specific error */
+#undef TARGET_EMULTIHOP
+#define TARGET_EMULTIHOP       74      /* Multihop attempted */
+#undef TARGET_EBADMSG
+#define TARGET_EBADMSG         77      /* Not a data message */
+#undef TARGET_ENAMETOOLONG
+#define TARGET_ENAMETOOLONG    78      /* File name too long */
+#undef TARGET_EOVERFLOW
+#define TARGET_EOVERFLOW       79      /* Value too large for defined data 
type */
+#undef TARGET_ENOTUNIQ
+#define TARGET_ENOTUNIQ        80      /* Name not unique on network */
+#undef TARGET_EBADFD
+#define TARGET_EBADFD          81      /* File descriptor in bad state */
+#undef TARGET_EREMCHG
+#define TARGET_EREMCHG         82      /* Remote address changed */
+#undef TARGET_ELIBACC
+#define TARGET_ELIBACC         83      /* Can not access a needed shared 
library */
+#undef TARGET_ELIBBAD
+#define TARGET_ELIBBAD         84      /* Accessing a corrupted shared library 
*/
+#undef TARGET_ELIBSCN
+#define TARGET_ELIBSCN         85      /* .lib section in a.out corrupted */
+#undef TARGET_ELIBMAX
+#define TARGET_ELIBMAX         86      /* Attempting to link in too many 
shared libraries */
+#undef TARGET_ELIBEXEC
+#define TARGET_ELIBEXEC        87      /* Cannot exec a shared library 
directly */
+#undef TARGET_EILSEQ
+#define TARGET_EILSEQ          88      /* Illegal byte sequence */
+#undef TARGET_ENOSYS
+#define TARGET_ENOSYS          89      /* Function not implemented */
+#undef TARGET_ELOOP
+#define TARGET_ELOOP           90      /* Too many symbolic links encountered 
*/
+#undef TARGET_ERESTART
+#define TARGET_ERESTART        91      /* Interrupted system call should be 
restarted */
+#undef TARGET_ESTRPIPE
+#define TARGET_ESTRPIPE        92      /* Streams pipe error */
+#undef TARGET_ENOTEMPTY
+#define TARGET_ENOTEMPTY       93      /* Directory not empty */
+#undef TARGET_EUSERS
+#define TARGET_EUSERS          94      /* Too many users */
+#undef TARGET_ENOTSOCK
+#define TARGET_ENOTSOCK        95      /* Socket operation on non-socket */
+#undef TARGET_EDESTADDRREQ
+#define TARGET_EDESTADDRREQ    96      /* Destination address required */
+#undef TARGET_EMSGSIZE
+#define TARGET_EMSGSIZE        97      /* Message too long */
+#undef TARGET_EPROTOTYPE
+#define TARGET_EPROTOTYPE      98      /* Protocol wrong type for socket */
+#undef TARGET_ENOPROTOOPT
+#define TARGET_ENOPROTOOPT     99      /* Protocol not available */
+#undef TARGET_EPROTONOSUPPORT
+#define TARGET_EPROTONOSUPPORT 120     /* Protocol not supported */
+#undef TARGET_ESOCKTNOSUPPORT
+#define TARGET_ESOCKTNOSUPPORT 121     /* Socket type not supported */
+#undef TARGET_EOPNOTSUPP
+#define TARGET_EOPNOTSUPP      122     /* Operation not supported on transport 
endpoint */
+#undef TARGET_EPFNOSUPPORT
+#define TARGET_EPFNOSUPPORT    123     /* Protocol family not supported */
+#undef TARGET_EAFNOSUPPORT
+#define TARGET_EAFNOSUPPORT    124     /* Address family not supported by 
protocol */
+#undef TARGET_EADDRINUSE
+#define TARGET_EADDRINUSE      125     /* Address already in use */
+#undef TARGET_EADDRNOTAVAIL
+#define TARGET_EADDRNOTAVAIL   126     /* Cannot assign requested address */
+#undef TARGET_ENETDOWN
+#define TARGET_ENETDOWN        127     /* Network is down */
+#undef TARGET_ENETUNREACH
+#define TARGET_ENETUNREACH     128     /* Network is unreachable */
+#undef TARGET_ENETRESET
+#define TARGET_ENETRESET       129     /* Network dropped connection because 
of reset */
+#undef TARGET_ECONNABORTED
+#define TARGET_ECONNABORTED    130     /* Software caused connection abort */
+#undef TARGET_ECONNRESET
+#define TARGET_ECONNRESET      131     /* Connection reset by peer */
+#undef TARGET_ENOBUFS
+#define TARGET_ENOBUFS         132     /* No buffer space available */
+#undef TARGET_EISCONN
+#define TARGET_EISCONN         133     /* Transport endpoint is already 
connected */
+#undef TARGET_ENOTCONN
+#define TARGET_ENOTCONN        134     /* Transport endpoint is not connected 
*/
+#undef TARGET_EUCLEAN
+#define TARGET_EUCLEAN         135     /* Structure needs cleaning */
+#undef TARGET_ENOTNAM
+#define TARGET_ENOTNAM         137     /* Not a XENIX named type file */
+#undef TARGET_ENAVAIL
+#define TARGET_ENAVAIL         138     /* No XENIX semaphores available */
+#undef TARGET_EISNAM
+#define TARGET_EISNAM          139     /* Is a named type file */
+#undef TARGET_EREMOTEIO
+#define TARGET_EREMOTEIO       140     /* Remote I/O error */
+#undef TARGET_EINIT
+#define TARGET_EINIT           141     /* Reserved */
+#undef TARGET_EREMDEV
+#define TARGET_EREMDEV         142     /* TARGET_Error 142 */
+#undef TARGET_ESHUTDOWN
+#define TARGET_ESHUTDOWN       143     /* Cannot send after transport endpoint 
shutdown */
+#undef TARGET_ETOOMANYREFS
+#define TARGET_ETOOMANYREFS    144     /* Too many references: cannot splice */
+#undef TARGET_ETIMEDOUT
+#define TARGET_ETIMEDOUT       145     /* Connection timed out */
+#undef TARGET_ECONNREFUSED
+#define TARGET_ECONNREFUSED    146     /* Connection refused */
+#undef TARGET_EHOSTDOWN
+#define TARGET_EHOSTDOWN       147     /* Host is down */
+#undef TARGET_EHOSTUNREACH
+#define TARGET_EHOSTUNREACH    148     /* No route to host */
+#undef TARGET_EALREADY
+#define TARGET_EALREADY        149     /* Operation already in progress */
+#undef TARGET_EINPROGRESS
+#define TARGET_EINPROGRESS     150     /* Operation now in progress */
+#undef TARGET_ESTALE
+#define TARGET_ESTALE          151     /* Stale NFS file handle */
+#undef TARGET_ECANCELED
+#define TARGET_ECANCELED       158     /* AIO operation canceled */
+/*
+ * These error are Linux extensions.
+ */
+#undef TARGET_ENOMEDIUM
+#define TARGET_ENOMEDIUM       159     /* No medium found */
+#undef TARGET_EMEDIUMTYPE
+#define TARGET_EMEDIUMTYPE     160     /* Wrong medium type */
+#undef TARGET_ENOKEY
+#define TARGET_ENOKEY          161     /* Required key not available */
+#undef TARGET_EKEYEXPIRED
+#define TARGET_EKEYEXPIRED     162     /* Key has expired */
+#undef TARGET_EKEYREVOKED
+#define TARGET_EKEYREVOKED     163     /* Key has been revoked */
+#undef TARGET_EKEYREJECTED
+#define TARGET_EKEYREJECTED    164     /* Key was rejected by service */
+
+/* for robust mutexes */
+#undef TARGET_EOWNERDEAD
+#define TARGET_EOWNERDEAD      165     /* Owner died */
+#undef TARGET_ENOTRECOVERABLE
+#define TARGET_ENOTRECOVERABLE 166     /* State not recoverable */
+
+
+
+/* Nasty hack: define a fake errno value for use by sigreturn.  */
+#define TARGET_QEMU_ESIGRETURN 255
+
+#define UNAME_MACHINE "mips"
+#define UNAME_MINIMUM_RELEASE "2.6.32"
+
+#define TARGET_CLONE_BACKWARDS
+#define TARGET_MINSIGSTKSZ 2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE  2
+
+#endif  /* TARGET_SYSCALL_H */
diff --git a/linux-user/mips64/syscall.h b/linux-user/mips64/syscall.h
deleted file mode 100644
index 6733107..0000000
--- a/linux-user/mips64/syscall.h
+++ /dev/null
@@ -1,230 +0,0 @@
-
-/* this struct defines the way the registers are stored on the
-   stack during a system call. */
-
-struct target_pt_regs {
-        /* Saved main processor registers. */
-        target_ulong regs[32];
-
-        /* Saved special registers. */
-        target_ulong cp0_status;
-        target_ulong lo;
-        target_ulong hi;
-        target_ulong cp0_badvaddr;
-        target_ulong cp0_cause;
-        target_ulong cp0_epc;
-};
-
-/* Target errno definitions taken from asm-mips/errno.h */
-#undef TARGET_ENOMSG
-#define TARGET_ENOMSG          35      /* Identifier removed */
-#undef TARGET_EIDRM
-#define TARGET_EIDRM           36      /* Identifier removed */
-#undef TARGET_ECHRNG
-#define TARGET_ECHRNG          37      /* Channel number out of range */
-#undef TARGET_EL2NSYNC
-#define TARGET_EL2NSYNC        38      /* Level 2 not synchronized */
-#undef TARGET_EL3HLT
-#define TARGET_EL3HLT          39      /* Level 3 halted */
-#undef TARGET_EL3RST
-#define TARGET_EL3RST          40      /* Level 3 reset */
-#undef TARGET_ELNRNG
-#define TARGET_ELNRNG          41      /* Link number out of range */
-#undef TARGET_EUNATCH
-#define TARGET_EUNATCH         42      /* Protocol driver not attached */
-#undef TARGET_ENOCSI
-#define TARGET_ENOCSI          43      /* No CSI structure available */
-#undef TARGET_EL2HLT
-#define TARGET_EL2HLT          44      /* Level 2 halted */
-#undef TARGET_EDEADLK
-#define TARGET_EDEADLK         45      /* Resource deadlock would occur */
-#undef TARGET_ENOLCK
-#define TARGET_ENOLCK          46      /* No record locks available */
-#undef TARGET_EBADE
-#define TARGET_EBADE           50      /* Invalid exchange */
-#undef TARGET_EBADR
-#define TARGET_EBADR           51      /* Invalid request descriptor */
-#undef TARGET_EXFULL
-#define TARGET_EXFULL          52      /* TARGET_Exchange full */
-#undef TARGET_ENOANO
-#define TARGET_ENOANO          53      /* No anode */
-#undef TARGET_EBADRQC
-#define TARGET_EBADRQC         54      /* Invalid request code */
-#undef TARGET_EBADSLT
-#define TARGET_EBADSLT         55      /* Invalid slot */
-#undef TARGET_EDEADLOCK
-#define TARGET_EDEADLOCK       56      /* File locking deadlock error */
-#undef TARGET_EBFONT
-#define TARGET_EBFONT          59      /* Bad font file format */
-#undef TARGET_ENOSTR
-#define TARGET_ENOSTR          60      /* Device not a stream */
-#undef TARGET_ENODATA
-#define TARGET_ENODATA         61      /* No data available */
-#undef TARGET_ETIME
-#define TARGET_ETIME           62      /* Timer expired */
-#undef TARGET_ENOSR
-#define TARGET_ENOSR           63      /* Out of streams resources */
-#undef TARGET_ENONET
-#define TARGET_ENONET          64      /* Machine is not on the network */
-#undef TARGET_ENOPKG
-#define TARGET_ENOPKG          65      /* Package not installed */
-#undef TARGET_EREMOTE
-#define TARGET_EREMOTE         66      /* Object is remote */
-#undef TARGET_ENOLINK
-#define TARGET_ENOLINK         67      /* Link has been severed */
-#undef TARGET_EADV
-#define TARGET_EADV            68      /* Advertise error */
-#undef TARGET_ESRMNT
-#define TARGET_ESRMNT          69      /* Srmount error */
-#undef TARGET_ECOMM
-#define TARGET_ECOMM           70      /* Communication error on send */
-#undef TARGET_EPROTO
-#define TARGET_EPROTO          71      /* Protocol error */
-#undef TARGET_EDOTDOT
-#define TARGET_EDOTDOT         73      /* RFS specific error */
-#undef TARGET_EMULTIHOP
-#define TARGET_EMULTIHOP       74      /* Multihop attempted */
-#undef TARGET_EBADMSG
-#define TARGET_EBADMSG         77      /* Not a data message */
-#undef TARGET_ENAMETOOLONG
-#define TARGET_ENAMETOOLONG    78      /* File name too long */
-#undef TARGET_EOVERFLOW
-#define TARGET_EOVERFLOW       79      /* Value too large for defined data 
type */
-#undef TARGET_ENOTUNIQ
-#define TARGET_ENOTUNIQ        80      /* Name not unique on network */
-#undef TARGET_EBADFD
-#define TARGET_EBADFD          81      /* File descriptor in bad state */
-#undef TARGET_EREMCHG
-#define TARGET_EREMCHG         82      /* Remote address changed */
-#undef TARGET_ELIBACC
-#define TARGET_ELIBACC         83      /* Can not access a needed shared 
library */
-#undef TARGET_ELIBBAD
-#define TARGET_ELIBBAD         84      /* Accessing a corrupted shared library 
*/
-#undef TARGET_ELIBSCN
-#define TARGET_ELIBSCN         85      /* .lib section in a.out corrupted */
-#undef TARGET_ELIBMAX
-#define TARGET_ELIBMAX         86      /* Attempting to link in too many 
shared libraries */
-#undef TARGET_ELIBEXEC
-#define TARGET_ELIBEXEC        87      /* Cannot exec a shared library 
directly */
-#undef TARGET_EILSEQ
-#define TARGET_EILSEQ          88      /* Illegal byte sequence */
-#undef TARGET_ENOSYS
-#define TARGET_ENOSYS          89      /* Function not implemented */
-#undef TARGET_ELOOP
-#define TARGET_ELOOP           90      /* Too many symbolic links encountered 
*/
-#undef TARGET_ERESTART
-#define TARGET_ERESTART        91      /* Interrupted system call should be 
restarted */
-#undef TARGET_ESTRPIPE
-#define TARGET_ESTRPIPE        92      /* Streams pipe error */
-#undef TARGET_ENOTEMPTY
-#define TARGET_ENOTEMPTY       93      /* Directory not empty */
-#undef TARGET_EUSERS
-#define TARGET_EUSERS          94      /* Too many users */
-#undef TARGET_ENOTSOCK
-#define TARGET_ENOTSOCK        95      /* Socket operation on non-socket */
-#undef TARGET_EDESTADDRREQ
-#define TARGET_EDESTADDRREQ    96      /* Destination address required */
-#undef TARGET_EMSGSIZE
-#define TARGET_EMSGSIZE        97      /* Message too long */
-#undef TARGET_EPROTOTYPE
-#define TARGET_EPROTOTYPE      98      /* Protocol wrong type for socket */
-#undef TARGET_ENOPROTOOPT
-#define TARGET_ENOPROTOOPT     99      /* Protocol not available */
-#undef TARGET_EPROTONOSUPPORT
-#define TARGET_EPROTONOSUPPORT 120     /* Protocol not supported */
-#undef TARGET_ESOCKTNOSUPPORT
-#define TARGET_ESOCKTNOSUPPORT 121     /* Socket type not supported */
-#undef TARGET_EOPNOTSUPP
-#define TARGET_EOPNOTSUPP      122     /* Operation not supported on transport 
endpoint */
-#undef TARGET_EPFNOSUPPORT
-#define TARGET_EPFNOSUPPORT    123     /* Protocol family not supported */
-#undef TARGET_EAFNOSUPPORT
-#define TARGET_EAFNOSUPPORT    124     /* Address family not supported by 
protocol */
-#undef TARGET_EADDRINUSE
-#define TARGET_EADDRINUSE      125     /* Address already in use */
-#undef TARGET_EADDRNOTAVAIL
-#define TARGET_EADDRNOTAVAIL   126     /* Cannot assign requested address */
-#undef TARGET_ENETDOWN
-#define TARGET_ENETDOWN        127     /* Network is down */
-#undef TARGET_ENETUNREACH
-#define TARGET_ENETUNREACH     128     /* Network is unreachable */
-#undef TARGET_ENETRESET
-#define TARGET_ENETRESET       129     /* Network dropped connection because 
of reset */
-#undef TARGET_ECONNABORTED
-#define TARGET_ECONNABORTED    130     /* Software caused connection abort */
-#undef TARGET_ECONNRESET
-#define TARGET_ECONNRESET      131     /* Connection reset by peer */
-#undef TARGET_ENOBUFS
-#define TARGET_ENOBUFS         132     /* No buffer space available */
-#undef TARGET_EISCONN
-#define TARGET_EISCONN         133     /* Transport endpoint is already 
connected */
-#undef TARGET_ENOTCONN
-#define TARGET_ENOTCONN        134     /* Transport endpoint is not connected 
*/
-#undef TARGET_EUCLEAN
-#define TARGET_EUCLEAN         135     /* Structure needs cleaning */
-#undef TARGET_ENOTNAM
-#define TARGET_ENOTNAM         137     /* Not a XENIX named type file */
-#undef TARGET_ENAVAIL
-#define TARGET_ENAVAIL         138     /* No XENIX semaphores available */
-#undef TARGET_EISNAM
-#define TARGET_EISNAM          139     /* Is a named type file */
-#undef TARGET_EREMOTEIO
-#define TARGET_EREMOTEIO       140     /* Remote I/O error */
-#undef TARGET_EINIT
-#define TARGET_EINIT           141     /* Reserved */
-#undef TARGET_EREMDEV
-#define TARGET_EREMDEV         142     /* TARGET_Error 142 */
-#undef TARGET_ESHUTDOWN
-#define TARGET_ESHUTDOWN       143     /* Cannot send after transport endpoint 
shutdown */
-#undef TARGET_ETOOMANYREFS
-#define TARGET_ETOOMANYREFS    144     /* Too many references: cannot splice */
-#undef TARGET_ETIMEDOUT
-#define TARGET_ETIMEDOUT       145     /* Connection timed out */
-#undef TARGET_ECONNREFUSED
-#define TARGET_ECONNREFUSED    146     /* Connection refused */
-#undef TARGET_EHOSTDOWN
-#define TARGET_EHOSTDOWN       147     /* Host is down */
-#undef TARGET_EHOSTUNREACH
-#define TARGET_EHOSTUNREACH    148     /* No route to host */
-#undef TARGET_EALREADY
-#define TARGET_EALREADY        149     /* Operation already in progress */
-#undef TARGET_EINPROGRESS
-#define TARGET_EINPROGRESS     150     /* Operation now in progress */
-#undef TARGET_ESTALE
-#define TARGET_ESTALE          151     /* Stale NFS file handle */
-#undef TARGET_ECANCELED
-#define TARGET_ECANCELED       158     /* AIO operation canceled */
-/*
- * These error are Linux extensions.
- */
-#undef TARGET_ENOMEDIUM
-#define TARGET_ENOMEDIUM       159     /* No medium found */
-#undef TARGET_EMEDIUMTYPE
-#define TARGET_EMEDIUMTYPE     160     /* Wrong medium type */
-#undef TARGET_ENOKEY
-#define TARGET_ENOKEY          161     /* Required key not available */
-#undef TARGET_EKEYEXPIRED
-#define TARGET_EKEYEXPIRED     162     /* Key has expired */
-#undef TARGET_EKEYREVOKED
-#define TARGET_EKEYREVOKED     163     /* Key has been revoked */
-#undef TARGET_EKEYREJECTED
-#define TARGET_EKEYREJECTED    164     /* Key was rejected by service */
-
-/* for robust mutexes */
-#undef TARGET_EOWNERDEAD
-#define TARGET_EOWNERDEAD      165     /* Owner died */
-#undef TARGET_ENOTRECOVERABLE
-#define TARGET_ENOTRECOVERABLE 166     /* State not recoverable */
-
-
-
-/* Nasty hack: define a fake errno value for use by sigreturn. */
-#define TARGET_QEMU_ESIGRETURN 255
-
-#define UNAME_MACHINE "mips64"
-#define UNAME_MINIMUM_RELEASE "2.6.32"
-
-#define TARGET_CLONE_BACKWARDS
-#define TARGET_MINSIGSTKSZ      2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE  2
diff --git a/linux-user/mips64/target_syscall.h 
b/linux-user/mips64/target_syscall.h
new file mode 100644
index 0000000..0e0c2d2
--- /dev/null
+++ b/linux-user/mips64/target_syscall.h
@@ -0,0 +1,234 @@
+#ifndef TARGET_SYSCALL_H
+#define TARGET_SYSCALL_H
+
+/* this struct defines the way the registers are stored on the
+   stack during a system call. */
+
+struct target_pt_regs {
+        /* Saved main processor registers. */
+        target_ulong regs[32];
+
+        /* Saved special registers. */
+        target_ulong cp0_status;
+        target_ulong lo;
+        target_ulong hi;
+        target_ulong cp0_badvaddr;
+        target_ulong cp0_cause;
+        target_ulong cp0_epc;
+};
+
+/* Target errno definitions taken from asm-mips/errno.h */
+#undef TARGET_ENOMSG
+#define TARGET_ENOMSG          35      /* Identifier removed */
+#undef TARGET_EIDRM
+#define TARGET_EIDRM           36      /* Identifier removed */
+#undef TARGET_ECHRNG
+#define TARGET_ECHRNG          37      /* Channel number out of range */
+#undef TARGET_EL2NSYNC
+#define TARGET_EL2NSYNC        38      /* Level 2 not synchronized */
+#undef TARGET_EL3HLT
+#define TARGET_EL3HLT          39      /* Level 3 halted */
+#undef TARGET_EL3RST
+#define TARGET_EL3RST          40      /* Level 3 reset */
+#undef TARGET_ELNRNG
+#define TARGET_ELNRNG          41      /* Link number out of range */
+#undef TARGET_EUNATCH
+#define TARGET_EUNATCH         42      /* Protocol driver not attached */
+#undef TARGET_ENOCSI
+#define TARGET_ENOCSI          43      /* No CSI structure available */
+#undef TARGET_EL2HLT
+#define TARGET_EL2HLT          44      /* Level 2 halted */
+#undef TARGET_EDEADLK
+#define TARGET_EDEADLK         45      /* Resource deadlock would occur */
+#undef TARGET_ENOLCK
+#define TARGET_ENOLCK          46      /* No record locks available */
+#undef TARGET_EBADE
+#define TARGET_EBADE           50      /* Invalid exchange */
+#undef TARGET_EBADR
+#define TARGET_EBADR           51      /* Invalid request descriptor */
+#undef TARGET_EXFULL
+#define TARGET_EXFULL          52      /* TARGET_Exchange full */
+#undef TARGET_ENOANO
+#define TARGET_ENOANO          53      /* No anode */
+#undef TARGET_EBADRQC
+#define TARGET_EBADRQC         54      /* Invalid request code */
+#undef TARGET_EBADSLT
+#define TARGET_EBADSLT         55      /* Invalid slot */
+#undef TARGET_EDEADLOCK
+#define TARGET_EDEADLOCK       56      /* File locking deadlock error */
+#undef TARGET_EBFONT
+#define TARGET_EBFONT          59      /* Bad font file format */
+#undef TARGET_ENOSTR
+#define TARGET_ENOSTR          60      /* Device not a stream */
+#undef TARGET_ENODATA
+#define TARGET_ENODATA         61      /* No data available */
+#undef TARGET_ETIME
+#define TARGET_ETIME           62      /* Timer expired */
+#undef TARGET_ENOSR
+#define TARGET_ENOSR           63      /* Out of streams resources */
+#undef TARGET_ENONET
+#define TARGET_ENONET          64      /* Machine is not on the network */
+#undef TARGET_ENOPKG
+#define TARGET_ENOPKG          65      /* Package not installed */
+#undef TARGET_EREMOTE
+#define TARGET_EREMOTE         66      /* Object is remote */
+#undef TARGET_ENOLINK
+#define TARGET_ENOLINK         67      /* Link has been severed */
+#undef TARGET_EADV
+#define TARGET_EADV            68      /* Advertise error */
+#undef TARGET_ESRMNT
+#define TARGET_ESRMNT          69      /* Srmount error */
+#undef TARGET_ECOMM
+#define TARGET_ECOMM           70      /* Communication error on send */
+#undef TARGET_EPROTO
+#define TARGET_EPROTO          71      /* Protocol error */
+#undef TARGET_EDOTDOT
+#define TARGET_EDOTDOT         73      /* RFS specific error */
+#undef TARGET_EMULTIHOP
+#define TARGET_EMULTIHOP       74      /* Multihop attempted */
+#undef TARGET_EBADMSG
+#define TARGET_EBADMSG         77      /* Not a data message */
+#undef TARGET_ENAMETOOLONG
+#define TARGET_ENAMETOOLONG    78      /* File name too long */
+#undef TARGET_EOVERFLOW
+#define TARGET_EOVERFLOW       79      /* Value too large for defined data 
type */
+#undef TARGET_ENOTUNIQ
+#define TARGET_ENOTUNIQ        80      /* Name not unique on network */
+#undef TARGET_EBADFD
+#define TARGET_EBADFD          81      /* File descriptor in bad state */
+#undef TARGET_EREMCHG
+#define TARGET_EREMCHG         82      /* Remote address changed */
+#undef TARGET_ELIBACC
+#define TARGET_ELIBACC         83      /* Can not access a needed shared 
library */
+#undef TARGET_ELIBBAD
+#define TARGET_ELIBBAD         84      /* Accessing a corrupted shared library 
*/
+#undef TARGET_ELIBSCN
+#define TARGET_ELIBSCN         85      /* .lib section in a.out corrupted */
+#undef TARGET_ELIBMAX
+#define TARGET_ELIBMAX         86      /* Attempting to link in too many 
shared libraries */
+#undef TARGET_ELIBEXEC
+#define TARGET_ELIBEXEC        87      /* Cannot exec a shared library 
directly */
+#undef TARGET_EILSEQ
+#define TARGET_EILSEQ          88      /* Illegal byte sequence */
+#undef TARGET_ENOSYS
+#define TARGET_ENOSYS          89      /* Function not implemented */
+#undef TARGET_ELOOP
+#define TARGET_ELOOP           90      /* Too many symbolic links encountered 
*/
+#undef TARGET_ERESTART
+#define TARGET_ERESTART        91      /* Interrupted system call should be 
restarted */
+#undef TARGET_ESTRPIPE
+#define TARGET_ESTRPIPE        92      /* Streams pipe error */
+#undef TARGET_ENOTEMPTY
+#define TARGET_ENOTEMPTY       93      /* Directory not empty */
+#undef TARGET_EUSERS
+#define TARGET_EUSERS          94      /* Too many users */
+#undef TARGET_ENOTSOCK
+#define TARGET_ENOTSOCK        95      /* Socket operation on non-socket */
+#undef TARGET_EDESTADDRREQ
+#define TARGET_EDESTADDRREQ    96      /* Destination address required */
+#undef TARGET_EMSGSIZE
+#define TARGET_EMSGSIZE        97      /* Message too long */
+#undef TARGET_EPROTOTYPE
+#define TARGET_EPROTOTYPE      98      /* Protocol wrong type for socket */
+#undef TARGET_ENOPROTOOPT
+#define TARGET_ENOPROTOOPT     99      /* Protocol not available */
+#undef TARGET_EPROTONOSUPPORT
+#define TARGET_EPROTONOSUPPORT 120     /* Protocol not supported */
+#undef TARGET_ESOCKTNOSUPPORT
+#define TARGET_ESOCKTNOSUPPORT 121     /* Socket type not supported */
+#undef TARGET_EOPNOTSUPP
+#define TARGET_EOPNOTSUPP      122     /* Operation not supported on transport 
endpoint */
+#undef TARGET_EPFNOSUPPORT
+#define TARGET_EPFNOSUPPORT    123     /* Protocol family not supported */
+#undef TARGET_EAFNOSUPPORT
+#define TARGET_EAFNOSUPPORT    124     /* Address family not supported by 
protocol */
+#undef TARGET_EADDRINUSE
+#define TARGET_EADDRINUSE      125     /* Address already in use */
+#undef TARGET_EADDRNOTAVAIL
+#define TARGET_EADDRNOTAVAIL   126     /* Cannot assign requested address */
+#undef TARGET_ENETDOWN
+#define TARGET_ENETDOWN        127     /* Network is down */
+#undef TARGET_ENETUNREACH
+#define TARGET_ENETUNREACH     128     /* Network is unreachable */
+#undef TARGET_ENETRESET
+#define TARGET_ENETRESET       129     /* Network dropped connection because 
of reset */
+#undef TARGET_ECONNABORTED
+#define TARGET_ECONNABORTED    130     /* Software caused connection abort */
+#undef TARGET_ECONNRESET
+#define TARGET_ECONNRESET      131     /* Connection reset by peer */
+#undef TARGET_ENOBUFS
+#define TARGET_ENOBUFS         132     /* No buffer space available */
+#undef TARGET_EISCONN
+#define TARGET_EISCONN         133     /* Transport endpoint is already 
connected */
+#undef TARGET_ENOTCONN
+#define TARGET_ENOTCONN        134     /* Transport endpoint is not connected 
*/
+#undef TARGET_EUCLEAN
+#define TARGET_EUCLEAN         135     /* Structure needs cleaning */
+#undef TARGET_ENOTNAM
+#define TARGET_ENOTNAM         137     /* Not a XENIX named type file */
+#undef TARGET_ENAVAIL
+#define TARGET_ENAVAIL         138     /* No XENIX semaphores available */
+#undef TARGET_EISNAM
+#define TARGET_EISNAM          139     /* Is a named type file */
+#undef TARGET_EREMOTEIO
+#define TARGET_EREMOTEIO       140     /* Remote I/O error */
+#undef TARGET_EINIT
+#define TARGET_EINIT           141     /* Reserved */
+#undef TARGET_EREMDEV
+#define TARGET_EREMDEV         142     /* TARGET_Error 142 */
+#undef TARGET_ESHUTDOWN
+#define TARGET_ESHUTDOWN       143     /* Cannot send after transport endpoint 
shutdown */
+#undef TARGET_ETOOMANYREFS
+#define TARGET_ETOOMANYREFS    144     /* Too many references: cannot splice */
+#undef TARGET_ETIMEDOUT
+#define TARGET_ETIMEDOUT       145     /* Connection timed out */
+#undef TARGET_ECONNREFUSED
+#define TARGET_ECONNREFUSED    146     /* Connection refused */
+#undef TARGET_EHOSTDOWN
+#define TARGET_EHOSTDOWN       147     /* Host is down */
+#undef TARGET_EHOSTUNREACH
+#define TARGET_EHOSTUNREACH    148     /* No route to host */
+#undef TARGET_EALREADY
+#define TARGET_EALREADY        149     /* Operation already in progress */
+#undef TARGET_EINPROGRESS
+#define TARGET_EINPROGRESS     150     /* Operation now in progress */
+#undef TARGET_ESTALE
+#define TARGET_ESTALE          151     /* Stale NFS file handle */
+#undef TARGET_ECANCELED
+#define TARGET_ECANCELED       158     /* AIO operation canceled */
+/*
+ * These error are Linux extensions.
+ */
+#undef TARGET_ENOMEDIUM
+#define TARGET_ENOMEDIUM       159     /* No medium found */
+#undef TARGET_EMEDIUMTYPE
+#define TARGET_EMEDIUMTYPE     160     /* Wrong medium type */
+#undef TARGET_ENOKEY
+#define TARGET_ENOKEY          161     /* Required key not available */
+#undef TARGET_EKEYEXPIRED
+#define TARGET_EKEYEXPIRED     162     /* Key has expired */
+#undef TARGET_EKEYREVOKED
+#define TARGET_EKEYREVOKED     163     /* Key has been revoked */
+#undef TARGET_EKEYREJECTED
+#define TARGET_EKEYREJECTED    164     /* Key was rejected by service */
+
+/* for robust mutexes */
+#undef TARGET_EOWNERDEAD
+#define TARGET_EOWNERDEAD      165     /* Owner died */
+#undef TARGET_ENOTRECOVERABLE
+#define TARGET_ENOTRECOVERABLE 166     /* State not recoverable */
+
+
+
+/* Nasty hack: define a fake errno value for use by sigreturn. */
+#define TARGET_QEMU_ESIGRETURN 255
+
+#define UNAME_MACHINE "mips64"
+#define UNAME_MINIMUM_RELEASE "2.6.32"
+
+#define TARGET_CLONE_BACKWARDS
+#define TARGET_MINSIGSTKSZ      2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE  2
+
+#endif  /* TARGET_SYSCALL_H */
diff --git a/linux-user/openrisc/syscall.h b/linux-user/openrisc/syscall.h
deleted file mode 100644
index 8ac0365..0000000
--- a/linux-user/openrisc/syscall.h
+++ /dev/null
@@ -1,29 +0,0 @@
-struct target_pt_regs {
-    union {
-        struct {
-            /* Named registers */
-            uint32_t sr;       /* Stored in place of r0 */
-            target_ulong sp;   /* r1 */
-        };
-        struct {
-            /* Old style */
-            target_ulong offset[2];
-            target_ulong gprs[30];
-        };
-        struct {
-            /* New style */
-            target_ulong gpr[32];
-        };
-    };
-    target_ulong pc;
-    target_ulong orig_gpr11;   /* For restarting system calls */
-    uint32_t syscallno;        /* Syscall number (used by strace) */
-    target_ulong dummy;     /* Cheap alignment fix */
-};
-
-#define UNAME_MACHINE "openrisc"
-#define UNAME_MINIMUM_RELEASE "2.6.32"
-
-#define TARGET_MINSIGSTKSZ 2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE  2
diff --git a/linux-user/openrisc/target_syscall.h 
b/linux-user/openrisc/target_syscall.h
new file mode 100644
index 0000000..19aeffc
--- /dev/null
+++ b/linux-user/openrisc/target_syscall.h
@@ -0,0 +1,34 @@
+#ifndef TARGET_SYSCALL_H
+#define TARGET_SYSCALL_H
+
+struct target_pt_regs {
+    union {
+        struct {
+            /* Named registers */
+            uint32_t sr;       /* Stored in place of r0 */
+            target_ulong sp;   /* r1 */
+        };
+        struct {
+            /* Old style */
+            target_ulong offset[2];
+            target_ulong gprs[30];
+        };
+        struct {
+            /* New style */
+            target_ulong gpr[32];
+        };
+    };
+    target_ulong pc;
+    target_ulong orig_gpr11;   /* For restarting system calls */
+    uint32_t syscallno;        /* Syscall number (used by strace) */
+    target_ulong dummy;     /* Cheap alignment fix */
+};
+
+#define UNAME_MACHINE "openrisc"
+#define UNAME_MINIMUM_RELEASE "2.6.32"
+
+#define TARGET_MINSIGSTKSZ 2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE  2
+
+#endif  /* TARGET_SYSCALL_H */
diff --git a/linux-user/ppc/syscall.h b/linux-user/ppc/syscall.h
deleted file mode 100644
index 0daf5cd..0000000
--- a/linux-user/ppc/syscall.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- *  PPC emulation for qemu: syscall definitions.
- *
- *  Copyright (c) 2003 Jocelyn Mayer
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, see <http://www.gnu.org/licenses/>.
- */
-
-/* XXX: ABSOLUTELY BUGGY:
- * for now, this is quite just a cut-and-paste from i386 target...
- */
-
-/* default linux values for the selectors */
-#define __USER_DS      (1)
-
-struct target_pt_regs {
-       abi_ulong gpr[32];
-       abi_ulong nip;
-       abi_ulong msr;
-       abi_ulong orig_gpr3;    /* Used for restarting system calls */
-       abi_ulong ctr;
-       abi_ulong link;
-       abi_ulong xer;
-       abi_ulong ccr;
-#if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
-        abi_ulong softe;
-#else
-       abi_ulong mq;           /* 601 only (not used at present) */
-#endif
-                                       /* Used on APUS to hold IPL value. */
-       abi_ulong trap;         /* Reason for being here */
-       abi_ulong dar;          /* Fault registers */
-       abi_ulong dsisr;
-       abi_ulong result;               /* Result of a system call */
-};
-
-/* ioctls */
-struct target_revectored_struct {
-       abi_ulong __map[8];                     /* 256 bits */
-};
-
-/* Nasty hack: define a fake errno value for use by sigreturn.  */
-#define TARGET_QEMU_ESIGRETURN 255
-
-/*
- * flags masks
- */
-
-#if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
-#ifdef TARGET_WORDS_BIGENDIAN
-#define UNAME_MACHINE "ppc64"
-#else
-#define UNAME_MACHINE "ppc64le"
-#endif
-#else
-#define UNAME_MACHINE "ppc"
-#endif
-#define UNAME_MINIMUM_RELEASE "2.6.32"
-
-#define TARGET_CLONE_BACKWARDS
-
-#define TARGET_MINSIGSTKSZ 2048
-#define TARGET_MLOCKALL_MCL_CURRENT 0x2000
-#define TARGET_MLOCKALL_MCL_FUTURE  0x4000
diff --git a/linux-user/ppc/target_syscall.h b/linux-user/ppc/target_syscall.h
new file mode 100644
index 0000000..35cab59
--- /dev/null
+++ b/linux-user/ppc/target_syscall.h
@@ -0,0 +1,80 @@
+/*
+ *  PPC emulation for qemu: syscall definitions.
+ *
+ *  Copyright (c) 2003 Jocelyn Mayer
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TARGET_SYSCALL_H
+#define TARGET_SYSCALL_H
+
+/* XXX: ABSOLUTELY BUGGY:
+ * for now, this is quite just a cut-and-paste from i386 target...
+ */
+
+/* default linux values for the selectors */
+#define __USER_DS      (1)
+
+struct target_pt_regs {
+       abi_ulong gpr[32];
+       abi_ulong nip;
+       abi_ulong msr;
+       abi_ulong orig_gpr3;    /* Used for restarting system calls */
+       abi_ulong ctr;
+       abi_ulong link;
+       abi_ulong xer;
+       abi_ulong ccr;
+#if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
+        abi_ulong softe;
+#else
+       abi_ulong mq;           /* 601 only (not used at present) */
+#endif
+                                       /* Used on APUS to hold IPL value. */
+       abi_ulong trap;         /* Reason for being here */
+       abi_ulong dar;          /* Fault registers */
+       abi_ulong dsisr;
+       abi_ulong result;               /* Result of a system call */
+};
+
+/* ioctls */
+struct target_revectored_struct {
+       abi_ulong __map[8];                     /* 256 bits */
+};
+
+/* Nasty hack: define a fake errno value for use by sigreturn.  */
+#define TARGET_QEMU_ESIGRETURN 255
+
+/*
+ * flags masks
+ */
+
+#if defined(TARGET_PPC64) && !defined(TARGET_ABI32)
+#ifdef TARGET_WORDS_BIGENDIAN
+#define UNAME_MACHINE "ppc64"
+#else
+#define UNAME_MACHINE "ppc64le"
+#endif
+#else
+#define UNAME_MACHINE "ppc"
+#endif
+#define UNAME_MINIMUM_RELEASE "2.6.32"
+
+#define TARGET_CLONE_BACKWARDS
+
+#define TARGET_MINSIGSTKSZ 2048
+#define TARGET_MLOCKALL_MCL_CURRENT 0x2000
+#define TARGET_MLOCKALL_MCL_FUTURE  0x4000
+
+#endif  /* TARGET_SYSCALL_H */
diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index ba5b433..26b0ba2 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -13,7 +13,7 @@
 
 #include "exec/user/thunk.h"
 #include "syscall_defs.h"
-#include "syscall.h"
+#include "target_syscall.h"
 #include "exec/gdbstub.h"
 #include "qemu/queue.h"
 
diff --git a/linux-user/s390x/syscall.h b/linux-user/s390x/syscall.h
deleted file mode 100644
index 35f170a..0000000
--- a/linux-user/s390x/syscall.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* this typedef defines how a Program Status Word looks like */
-typedef struct {
-    abi_ulong mask;
-    abi_ulong addr;
-} __attribute__ ((aligned(8))) target_psw_t;
-
-/*
- * The pt_regs struct defines the way the registers are stored on
- * the stack during a system call.
- */
-
-#define TARGET_NUM_GPRS        16
-
-struct target_pt_regs {
-    abi_ulong args[1];
-    target_psw_t psw;
-    abi_ulong gprs[TARGET_NUM_GPRS];
-    abi_ulong orig_gpr2;
-    unsigned short ilen;
-    unsigned short trap;
-};
-
-#define UNAME_MACHINE "s390x"
-#define UNAME_MINIMUM_RELEASE "2.6.32"
-
-#define TARGET_CLONE_BACKWARDS2
-#define TARGET_MINSIGSTKSZ        2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE  2
diff --git a/linux-user/s390x/target_syscall.h 
b/linux-user/s390x/target_syscall.h
new file mode 100644
index 0000000..02061ef
--- /dev/null
+++ b/linux-user/s390x/target_syscall.h
@@ -0,0 +1,34 @@
+#ifndef TARGET_SYSCALL_H
+#define TARGET_SYSCALL_H
+
+/* this typedef defines how a Program Status Word looks like */
+typedef struct {
+    abi_ulong mask;
+    abi_ulong addr;
+} __attribute__ ((aligned(8))) target_psw_t;
+
+/*
+ * The pt_regs struct defines the way the registers are stored on
+ * the stack during a system call.
+ */
+
+#define TARGET_NUM_GPRS        16
+
+struct target_pt_regs {
+    abi_ulong args[1];
+    target_psw_t psw;
+    abi_ulong gprs[TARGET_NUM_GPRS];
+    abi_ulong orig_gpr2;
+    unsigned short ilen;
+    unsigned short trap;
+};
+
+#define UNAME_MACHINE "s390x"
+#define UNAME_MINIMUM_RELEASE "2.6.32"
+
+#define TARGET_CLONE_BACKWARDS2
+#define TARGET_MINSIGSTKSZ        2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE  2
+
+#endif  /* TARGET_SYSCALL_H */
diff --git a/linux-user/sh4/syscall.h b/linux-user/sh4/syscall.h
deleted file mode 100644
index 7aa4f23..0000000
--- a/linux-user/sh4/syscall.h
+++ /dev/null
@@ -1,17 +0,0 @@
-struct target_pt_regs {
-        unsigned long regs[16];
-        unsigned long pc;
-        unsigned long pr;
-        unsigned long sr;
-        unsigned long gbr;
-        unsigned long mach;
-        unsigned long macl;
-        long tra;
-};
-
-#define UNAME_MACHINE "sh4"
-#define UNAME_MINIMUM_RELEASE "2.6.32"
-
-#define TARGET_MINSIGSTKSZ 2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE  2
diff --git a/linux-user/sh4/target_syscall.h b/linux-user/sh4/target_syscall.h
new file mode 100644
index 0000000..9f3381b
--- /dev/null
+++ b/linux-user/sh4/target_syscall.h
@@ -0,0 +1,22 @@
+#ifndef TARGET_SYSCALL_H
+#define TARGET_SYSCALL_H
+
+struct target_pt_regs {
+        unsigned long regs[16];
+        unsigned long pc;
+        unsigned long pr;
+        unsigned long sr;
+        unsigned long gbr;
+        unsigned long mach;
+        unsigned long macl;
+        long tra;
+};
+
+#define UNAME_MACHINE "sh4"
+#define UNAME_MINIMUM_RELEASE "2.6.32"
+
+#define TARGET_MINSIGSTKSZ 2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE  2
+
+#endif  /* TARGET_SYSCALL_H */
diff --git a/linux-user/sparc/syscall.h b/linux-user/sparc/syscall.h
deleted file mode 100644
index 58573b9..0000000
--- a/linux-user/sparc/syscall.h
+++ /dev/null
@@ -1,20 +0,0 @@
-struct target_pt_regs {
-       abi_ulong psr;
-       abi_ulong pc;
-       abi_ulong npc;
-       abi_ulong y;
-       abi_ulong u_regs[16];
-};
-
-#define UNAME_MACHINE "sun4"
-#define UNAME_MINIMUM_RELEASE "2.6.32"
-
-/* SPARC kernels don't define this in their Kconfig, but they have the
- * same ABI as if they did, implemented by sparc-specific code which fishes
- * directly in the u_regs() struct for half the parameters in sparc_do_fork()
- * and copy_thread().
- */
-#define TARGET_CLONE_BACKWARDS
-#define TARGET_MINSIGSTKSZ      4096
-#define TARGET_MLOCKALL_MCL_CURRENT 0x2000
-#define TARGET_MLOCKALL_MCL_FUTURE  0x4000
diff --git a/linux-user/sparc/target_syscall.h 
b/linux-user/sparc/target_syscall.h
new file mode 100644
index 0000000..a73fa6d
--- /dev/null
+++ b/linux-user/sparc/target_syscall.h
@@ -0,0 +1,25 @@
+#ifndef TARGET_SYSCALL_H
+#define TARGET_SYSCALL_H
+
+struct target_pt_regs {
+       abi_ulong psr;
+       abi_ulong pc;
+       abi_ulong npc;
+       abi_ulong y;
+       abi_ulong u_regs[16];
+};
+
+#define UNAME_MACHINE "sun4"
+#define UNAME_MINIMUM_RELEASE "2.6.32"
+
+/* SPARC kernels don't define this in their Kconfig, but they have the
+ * same ABI as if they did, implemented by sparc-specific code which fishes
+ * directly in the u_regs() struct for half the parameters in sparc_do_fork()
+ * and copy_thread().
+ */
+#define TARGET_CLONE_BACKWARDS
+#define TARGET_MINSIGSTKSZ      4096
+#define TARGET_MLOCKALL_MCL_CURRENT 0x2000
+#define TARGET_MLOCKALL_MCL_FUTURE  0x4000
+
+#endif  /* TARGET_SYSCALL_H */
diff --git a/linux-user/sparc64/syscall.h b/linux-user/sparc64/syscall.h
deleted file mode 100644
index 8398d3f..0000000
--- a/linux-user/sparc64/syscall.h
+++ /dev/null
@@ -1,21 +0,0 @@
-struct target_pt_regs {
-       abi_ulong u_regs[16];
-       abi_ulong tstate;
-       abi_ulong pc;
-       abi_ulong npc;
-       abi_ulong y;
-       abi_ulong fprs;
-};
-
-#define UNAME_MACHINE "sun4u"
-#define UNAME_MINIMUM_RELEASE "2.6.32"
-
-/* SPARC kernels don't define this in their Kconfig, but they have the
- * same ABI as if they did, implemented by sparc-specific code which fishes
- * directly in the u_regs() struct for half the parameters in sparc_do_fork()
- * and copy_thread().
- */
-#define TARGET_CLONE_BACKWARDS
-#define TARGET_MINSIGSTKSZ      4096
-#define TARGET_MLOCKALL_MCL_CURRENT 0x2000
-#define TARGET_MLOCKALL_MCL_FUTURE  0x4000
diff --git a/linux-user/sparc64/target_syscall.h 
b/linux-user/sparc64/target_syscall.h
new file mode 100644
index 0000000..eb827fc
--- /dev/null
+++ b/linux-user/sparc64/target_syscall.h
@@ -0,0 +1,26 @@
+#ifndef TARGET_SYSCALL_H
+#define TARGET_SYSCALL_H
+
+struct target_pt_regs {
+       abi_ulong u_regs[16];
+       abi_ulong tstate;
+       abi_ulong pc;
+       abi_ulong npc;
+       abi_ulong y;
+       abi_ulong fprs;
+};
+
+#define UNAME_MACHINE "sun4u"
+#define UNAME_MINIMUM_RELEASE "2.6.32"
+
+/* SPARC kernels don't define this in their Kconfig, but they have the
+ * same ABI as if they did, implemented by sparc-specific code which fishes
+ * directly in the u_regs() struct for half the parameters in sparc_do_fork()
+ * and copy_thread().
+ */
+#define TARGET_CLONE_BACKWARDS
+#define TARGET_MINSIGSTKSZ      4096
+#define TARGET_MLOCKALL_MCL_CURRENT 0x2000
+#define TARGET_MLOCKALL_MCL_FUTURE  0x4000
+
+#endif  /* TARGET_SYSCALL_H */
diff --git a/linux-user/tilegx/syscall.h b/linux-user/tilegx/syscall.h
deleted file mode 100644
index a938d4e..0000000
--- a/linux-user/tilegx/syscall.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef TILEGX_SYSCALLS_H
-#define TILEGX_SYSCALLS_H
-
-#define UNAME_MACHINE "tilegx"
-#define UNAME_MINIMUM_RELEASE "3.19"
-
-#define MMAP_SHIFT TARGET_PAGE_BITS
-
-#define TILEGX_IS_ERRNO(ret) \
-                       ((ret) > 0xfffffffffffff000ULL) /* errno is 0 -- 4096 */
-
-typedef uint64_t tilegx_reg_t;
-
-struct target_pt_regs {
-
-    union {
-        /* Saved main processor registers; 56..63 are special. */
-        tilegx_reg_t regs[56];
-        struct {
-            tilegx_reg_t __regs[53];
-            tilegx_reg_t tp;    /* aliases regs[TREG_TP] */
-            tilegx_reg_t sp;    /* aliases regs[TREG_SP] */
-            tilegx_reg_t lr;    /* aliases regs[TREG_LR] */
-        };
-    };
-
-    /* Saved special registers. */
-    tilegx_reg_t pc;            /* stored in EX_CONTEXT_K_0 */
-    tilegx_reg_t ex1;           /* stored in EX_CONTEXT_K_1 (PL and ICS bit) */
-    tilegx_reg_t faultnum;      /* fault number (INT_SWINT_1 for syscall) */
-    tilegx_reg_t orig_r0;       /* r0 at syscall entry, else zero */
-    tilegx_reg_t flags;         /* flags (see below) */
-    tilegx_reg_t cmpexch;       /* value of CMPEXCH_VALUE SPR at interrupt */
-    tilegx_reg_t pad[2];
-};
-
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE  2
-
-/* For faultnum */
-#define TARGET_INT_SWINT_1            14
-
-#endif
diff --git a/linux-user/tilegx/target_syscall.h 
b/linux-user/tilegx/target_syscall.h
new file mode 100644
index 0000000..a938d4e
--- /dev/null
+++ b/linux-user/tilegx/target_syscall.h
@@ -0,0 +1,43 @@
+#ifndef TILEGX_SYSCALLS_H
+#define TILEGX_SYSCALLS_H
+
+#define UNAME_MACHINE "tilegx"
+#define UNAME_MINIMUM_RELEASE "3.19"
+
+#define MMAP_SHIFT TARGET_PAGE_BITS
+
+#define TILEGX_IS_ERRNO(ret) \
+                       ((ret) > 0xfffffffffffff000ULL) /* errno is 0 -- 4096 */
+
+typedef uint64_t tilegx_reg_t;
+
+struct target_pt_regs {
+
+    union {
+        /* Saved main processor registers; 56..63 are special. */
+        tilegx_reg_t regs[56];
+        struct {
+            tilegx_reg_t __regs[53];
+            tilegx_reg_t tp;    /* aliases regs[TREG_TP] */
+            tilegx_reg_t sp;    /* aliases regs[TREG_SP] */
+            tilegx_reg_t lr;    /* aliases regs[TREG_LR] */
+        };
+    };
+
+    /* Saved special registers. */
+    tilegx_reg_t pc;            /* stored in EX_CONTEXT_K_0 */
+    tilegx_reg_t ex1;           /* stored in EX_CONTEXT_K_1 (PL and ICS bit) */
+    tilegx_reg_t faultnum;      /* fault number (INT_SWINT_1 for syscall) */
+    tilegx_reg_t orig_r0;       /* r0 at syscall entry, else zero */
+    tilegx_reg_t flags;         /* flags (see below) */
+    tilegx_reg_t cmpexch;       /* value of CMPEXCH_VALUE SPR at interrupt */
+    tilegx_reg_t pad[2];
+};
+
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE  2
+
+/* For faultnum */
+#define TARGET_INT_SWINT_1            14
+
+#endif
diff --git a/linux-user/unicore32/syscall.h b/linux-user/unicore32/syscall.h
deleted file mode 100644
index 385a975..0000000
--- a/linux-user/unicore32/syscall.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (C) 2010-2011 GUAN Xue-tao
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#ifndef __UC32_SYSCALL_H__
-#define __UC32_SYSCALL_H__
-struct target_pt_regs {
-    abi_ulong uregs[34];
-};
-
-#define UC32_REG_pc             uregs[31]
-#define UC32_REG_lr             uregs[30]
-#define UC32_REG_sp             uregs[29]
-#define UC32_REG_ip             uregs[28]
-#define UC32_REG_fp             uregs[27]
-#define UC32_REG_26             uregs[26]
-#define UC32_REG_25             uregs[25]
-#define UC32_REG_24             uregs[24]
-#define UC32_REG_23             uregs[23]
-#define UC32_REG_22             uregs[22]
-#define UC32_REG_21             uregs[21]
-#define UC32_REG_20             uregs[20]
-#define UC32_REG_19             uregs[19]
-#define UC32_REG_18             uregs[18]
-#define UC32_REG_17             uregs[17]
-#define UC32_REG_16             uregs[16]
-#define UC32_REG_15             uregs[15]
-#define UC32_REG_14             uregs[14]
-#define UC32_REG_13             uregs[13]
-#define UC32_REG_12             uregs[12]
-#define UC32_REG_11             uregs[11]
-#define UC32_REG_10             uregs[10]
-#define UC32_REG_09             uregs[9]
-#define UC32_REG_08             uregs[8]
-#define UC32_REG_07             uregs[7]
-#define UC32_REG_06             uregs[6]
-#define UC32_REG_05             uregs[5]
-#define UC32_REG_04             uregs[4]
-#define UC32_REG_03             uregs[3]
-#define UC32_REG_02             uregs[2]
-#define UC32_REG_01             uregs[1]
-#define UC32_REG_00             uregs[0]
-#define UC32_REG_asr            uregs[32]
-#define UC32_REG_ORIG_00        uregs[33]
-
-#define UC32_SYSCALL_BASE               0x900000
-#define UC32_SYSCALL_ARCH_BASE          0xf0000
-#define UC32_SYSCALL_NR_set_tls         (UC32_SYSCALL_ARCH_BASE + 5)
-
-#define UNAME_MACHINE "UniCore-II"
-#define UNAME_MINIMUM_RELEASE "2.6.32"
-
-#define TARGET_MINSIGSTKSZ 2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE  2
-
-#endif /* __UC32_SYSCALL_H__ */
diff --git a/linux-user/unicore32/target_syscall.h 
b/linux-user/unicore32/target_syscall.h
new file mode 100644
index 0000000..385a975
--- /dev/null
+++ b/linux-user/unicore32/target_syscall.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2010-2011 GUAN Xue-tao
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __UC32_SYSCALL_H__
+#define __UC32_SYSCALL_H__
+struct target_pt_regs {
+    abi_ulong uregs[34];
+};
+
+#define UC32_REG_pc             uregs[31]
+#define UC32_REG_lr             uregs[30]
+#define UC32_REG_sp             uregs[29]
+#define UC32_REG_ip             uregs[28]
+#define UC32_REG_fp             uregs[27]
+#define UC32_REG_26             uregs[26]
+#define UC32_REG_25             uregs[25]
+#define UC32_REG_24             uregs[24]
+#define UC32_REG_23             uregs[23]
+#define UC32_REG_22             uregs[22]
+#define UC32_REG_21             uregs[21]
+#define UC32_REG_20             uregs[20]
+#define UC32_REG_19             uregs[19]
+#define UC32_REG_18             uregs[18]
+#define UC32_REG_17             uregs[17]
+#define UC32_REG_16             uregs[16]
+#define UC32_REG_15             uregs[15]
+#define UC32_REG_14             uregs[14]
+#define UC32_REG_13             uregs[13]
+#define UC32_REG_12             uregs[12]
+#define UC32_REG_11             uregs[11]
+#define UC32_REG_10             uregs[10]
+#define UC32_REG_09             uregs[9]
+#define UC32_REG_08             uregs[8]
+#define UC32_REG_07             uregs[7]
+#define UC32_REG_06             uregs[6]
+#define UC32_REG_05             uregs[5]
+#define UC32_REG_04             uregs[4]
+#define UC32_REG_03             uregs[3]
+#define UC32_REG_02             uregs[2]
+#define UC32_REG_01             uregs[1]
+#define UC32_REG_00             uregs[0]
+#define UC32_REG_asr            uregs[32]
+#define UC32_REG_ORIG_00        uregs[33]
+
+#define UC32_SYSCALL_BASE               0x900000
+#define UC32_SYSCALL_ARCH_BASE          0xf0000
+#define UC32_SYSCALL_NR_set_tls         (UC32_SYSCALL_ARCH_BASE + 5)
+
+#define UNAME_MACHINE "UniCore-II"
+#define UNAME_MINIMUM_RELEASE "2.6.32"
+
+#define TARGET_MINSIGSTKSZ 2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE  2
+
+#endif /* __UC32_SYSCALL_H__ */
diff --git a/linux-user/x86_64/syscall.h b/linux-user/x86_64/syscall.h
deleted file mode 100644
index 88b3c3f..0000000
--- a/linux-user/x86_64/syscall.h
+++ /dev/null
@@ -1,102 +0,0 @@
-#define __USER_CS      (0x33)
-#define __USER_DS      (0x2B)
-
-struct target_pt_regs {
-       abi_ulong r15;
-       abi_ulong r14;
-       abi_ulong r13;
-       abi_ulong r12;
-       abi_ulong rbp;
-       abi_ulong rbx;
-/* arguments: non interrupts/non tracing syscalls only save up to here */
-       abi_ulong r11;
-       abi_ulong r10;
-       abi_ulong r9;
-       abi_ulong r8;
-       abi_ulong rax;
-       abi_ulong rcx;
-       abi_ulong rdx;
-       abi_ulong rsi;
-       abi_ulong rdi;
-       abi_ulong orig_rax;
-/* end of arguments */
-/* cpu exception frame or undefined */
-       abi_ulong rip;
-       abi_ulong cs;
-       abi_ulong eflags;
-       abi_ulong rsp;
-       abi_ulong ss;
-/* top of stack page */
-};
-
-/* Maximum number of LDT entries supported. */
-#define TARGET_LDT_ENTRIES     8192
-/* The size of each LDT entry. */
-#define TARGET_LDT_ENTRY_SIZE  8
-
-#define TARGET_GDT_ENTRIES 16
-#define TARGET_GDT_ENTRY_TLS_ENTRIES 3
-#define TARGET_GDT_ENTRY_TLS_MIN 12
-#define TARGET_GDT_ENTRY_TLS_MAX 14
-
-#if 0 // Redefine this
-struct target_modify_ldt_ldt_s {
-       unsigned int  entry_number;
-        abi_ulong     base_addr;
-       unsigned int  limit;
-       unsigned int  seg_32bit:1;
-       unsigned int  contents:2;
-       unsigned int  read_exec_only:1;
-       unsigned int  limit_in_pages:1;
-       unsigned int  seg_not_present:1;
-       unsigned int  useable:1;
-       unsigned int  lm:1;
-};
-#else
-struct target_modify_ldt_ldt_s {
-       unsigned int  entry_number;
-        abi_ulong     base_addr;
-       unsigned int  limit;
-        unsigned int flags;
-};
-#endif
-
-struct target_ipc64_perm
-{
-       int             key;
-       uint32_t        uid;
-       uint32_t        gid;
-       uint32_t        cuid;
-       uint32_t        cgid;
-       unsigned short          mode;
-       unsigned short          __pad1;
-       unsigned short          seq;
-       unsigned short          __pad2;
-       abi_ulong               __unused1;
-       abi_ulong               __unused2;
-};
-
-struct target_msqid64_ds {
-       struct target_ipc64_perm msg_perm;
-       unsigned int msg_stime; /* last msgsnd time */
-       unsigned int msg_rtime; /* last msgrcv time */
-       unsigned int msg_ctime; /* last change time */
-       abi_ulong  msg_cbytes;  /* current number of bytes on queue */
-       abi_ulong  msg_qnum;    /* number of messages in queue */
-       abi_ulong  msg_qbytes;  /* max number of bytes on queue */
-       unsigned int msg_lspid; /* pid of last msgsnd */
-       unsigned int msg_lrpid; /* last receive pid */
-       abi_ulong  __unused4;
-       abi_ulong  __unused5;
-};
-
-#define UNAME_MACHINE "x86_64"
-#define UNAME_MINIMUM_RELEASE "2.6.32"
-
-#define TARGET_ARCH_SET_GS 0x1001
-#define TARGET_ARCH_SET_FS 0x1002
-#define TARGET_ARCH_GET_FS 0x1003
-#define TARGET_ARCH_GET_GS 0x1004
-#define TARGET_MINSIGSTKSZ 2048
-#define TARGET_MLOCKALL_MCL_CURRENT 1
-#define TARGET_MLOCKALL_MCL_FUTURE  2
diff --git a/linux-user/x86_64/target_syscall.h 
b/linux-user/x86_64/target_syscall.h
new file mode 100644
index 0000000..feecd32
--- /dev/null
+++ b/linux-user/x86_64/target_syscall.h
@@ -0,0 +1,107 @@
+#ifndef TARGET_SYSCALL_H
+#define TARGET_SYSCALL_H
+
+#define __USER_CS      (0x33)
+#define __USER_DS      (0x2B)
+
+struct target_pt_regs {
+       abi_ulong r15;
+       abi_ulong r14;
+       abi_ulong r13;
+       abi_ulong r12;
+       abi_ulong rbp;
+       abi_ulong rbx;
+/* arguments: non interrupts/non tracing syscalls only save up to here */
+       abi_ulong r11;
+       abi_ulong r10;
+       abi_ulong r9;
+       abi_ulong r8;
+       abi_ulong rax;
+       abi_ulong rcx;
+       abi_ulong rdx;
+       abi_ulong rsi;
+       abi_ulong rdi;
+       abi_ulong orig_rax;
+/* end of arguments */
+/* cpu exception frame or undefined */
+       abi_ulong rip;
+       abi_ulong cs;
+       abi_ulong eflags;
+       abi_ulong rsp;
+       abi_ulong ss;
+/* top of stack page */
+};
+
+/* Maximum number of LDT entries supported. */
+#define TARGET_LDT_ENTRIES     8192
+/* The size of each LDT entry. */
+#define TARGET_LDT_ENTRY_SIZE  8
+
+#define TARGET_GDT_ENTRIES 16
+#define TARGET_GDT_ENTRY_TLS_ENTRIES 3
+#define TARGET_GDT_ENTRY_TLS_MIN 12
+#define TARGET_GDT_ENTRY_TLS_MAX 14
+
+#if 0 // Redefine this
+struct target_modify_ldt_ldt_s {
+       unsigned int  entry_number;
+        abi_ulong     base_addr;
+       unsigned int  limit;
+       unsigned int  seg_32bit:1;
+       unsigned int  contents:2;
+       unsigned int  read_exec_only:1;
+       unsigned int  limit_in_pages:1;
+       unsigned int  seg_not_present:1;
+       unsigned int  useable:1;
+       unsigned int  lm:1;
+};
+#else
+struct target_modify_ldt_ldt_s {
+       unsigned int  entry_number;
+        abi_ulong     base_addr;
+       unsigned int  limit;
+        unsigned int flags;
+};
+#endif
+
+struct target_ipc64_perm
+{
+       int             key;
+       uint32_t        uid;
+       uint32_t        gid;
+       uint32_t        cuid;
+       uint32_t        cgid;
+       unsigned short          mode;
+       unsigned short          __pad1;
+       unsigned short          seq;
+       unsigned short          __pad2;
+       abi_ulong               __unused1;
+       abi_ulong               __unused2;
+};
+
+struct target_msqid64_ds {
+       struct target_ipc64_perm msg_perm;
+       unsigned int msg_stime; /* last msgsnd time */
+       unsigned int msg_rtime; /* last msgrcv time */
+       unsigned int msg_ctime; /* last change time */
+       abi_ulong  msg_cbytes;  /* current number of bytes on queue */
+       abi_ulong  msg_qnum;    /* number of messages in queue */
+       abi_ulong  msg_qbytes;  /* max number of bytes on queue */
+       unsigned int msg_lspid; /* pid of last msgsnd */
+       unsigned int msg_lrpid; /* last receive pid */
+       abi_ulong  __unused4;
+       abi_ulong  __unused5;
+};
+
+#define UNAME_MACHINE "x86_64"
+#define UNAME_MINIMUM_RELEASE "2.6.32"
+
+#define TARGET_ARCH_SET_GS 0x1001
+#define TARGET_ARCH_SET_FS 0x1002
+#define TARGET_ARCH_GET_FS 0x1003
+#define TARGET_ARCH_GET_GS 0x1004
+#define TARGET_MINSIGSTKSZ 2048
+#define TARGET_MLOCKALL_MCL_CURRENT 1
+#define TARGET_MLOCKALL_MCL_FUTURE  2
+
+#endif  /* TARGET_SYSCALL_H */
-- 
2.1.4


Reply via email to