summaryrefslogtreecommitdiff
path: root/arch/um/include/sysdep-i386
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 15:20:36 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 15:20:36 -0700
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/um/include/sysdep-i386
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/um/include/sysdep-i386')
-rw-r--r--arch/um/include/sysdep-i386/checksum.h219
-rw-r--r--arch/um/include/sysdep-i386/ptrace.h241
-rw-r--r--arch/um/include/sysdep-i386/ptrace_user.h62
-rw-r--r--arch/um/include/sysdep-i386/sigcontext.h49
-rw-r--r--arch/um/include/sysdep-i386/signal.h25
-rw-r--r--arch/um/include/sysdep-i386/syscalls.h123
6 files changed, 719 insertions, 0 deletions
diff --git a/arch/um/include/sysdep-i386/checksum.h b/arch/um/include/sysdep-i386/checksum.h
new file mode 100644
index 000000000000..3a2a45811aa3
--- /dev/null
+++ b/arch/um/include/sysdep-i386/checksum.h
@@ -0,0 +1,219 @@
+/*
+ * Licensed under the GPL
+ */
+
+#ifndef __UM_SYSDEP_CHECKSUM_H
+#define __UM_SYSDEP_CHECKSUM_H
+
+#include "linux/in6.h"
+#include "linux/string.h"
+
+/*
+ * computes the checksum of a memory block at buff, length len,
+ * and adds in "sum" (32-bit)
+ *
+ * returns a 32-bit number suitable for feeding into itself
+ * or csum_tcpudp_magic
+ *
+ * this function must be called with even lengths, except
+ * for the last fragment, which may be odd
+ *
+ * it's best to have buff aligned on a 32-bit boundary
+ */
+unsigned int csum_partial(const unsigned char * buff, int len,
+ unsigned int sum);
+
+/*
+ * the same as csum_partial, but copies from src while it
+ * checksums, and handles user-space pointer exceptions correctly, when needed.
+ *
+ * here even more important to align src and dst on a 32-bit (or even
+ * better 64-bit) boundary
+ */
+
+unsigned int csum_partial_copy_to(const unsigned char *src, unsigned char *dst,
+ int len, int sum, int *err_ptr);
+unsigned int csum_partial_copy_from(const unsigned char *src, unsigned char *dst,
+ int len, int sum, int *err_ptr);
+
+/*
+ * Note: when you get a NULL pointer exception here this means someone
+ * passed in an incorrect kernel address to one of these functions.
+ *
+ * If you use these functions directly please don't forget the
+ * access_ok().
+ */
+
+static __inline__
+unsigned int csum_partial_copy_nocheck(const unsigned char *src, unsigned char *dst,
+ int len, int sum)
+{
+ memcpy(dst, src, len);
+ return(csum_partial(dst, len, sum));
+}
+
+static __inline__
+unsigned int csum_partial_copy_from_user(const unsigned char *src, unsigned char *dst,
+ int len, int sum, int *err_ptr)
+{
+ return csum_partial_copy_from(src, dst, len, sum, err_ptr);
+}
+
+/*
+ * These are the old (and unsafe) way of doing checksums, a warning message
+ * will be printed if they are used and an exception occurs.
+ *
+ * these functions should go away after some time.
+ */
+
+#define csum_partial_copy_fromuser csum_partial_copy_from_user
+unsigned int csum_partial_copy(const unsigned char *src, unsigned char *dst, int len, int sum);
+
+/*
+ * This is a version of ip_compute_csum() optimized for IP headers,
+ * which always checksum on 4 octet boundaries.
+ *
+ * By Jorge Cwik <jorge@laser.satlink.net>, adapted for linux by
+ * Arnt Gulbrandsen.
+ */
+static inline unsigned short ip_fast_csum(unsigned char * iph,
+ unsigned int ihl)
+{
+ unsigned int sum;
+
+ __asm__ __volatile__(
+ "movl (%1), %0 ;\n"
+ "subl $4, %2 ;\n"
+ "jbe 2f ;\n"
+ "addl 4(%1), %0 ;\n"
+ "adcl 8(%1), %0 ;\n"
+ "adcl 12(%1), %0 ;\n"
+"1: adcl 16(%1), %0 ;\n"
+ "lea 4(%1), %1 ;\n"
+ "decl %2 ;\n"
+ "jne 1b ;\n"
+ "adcl $0, %0 ;\n"
+ "movl %0, %2 ;\n"
+ "shrl $16, %0 ;\n"
+ "addw %w2, %w0 ;\n"
+ "adcl $0, %0 ;\n"
+ "notl %0 ;\n"
+"2: ;\n"
+ /* Since the input registers which are loaded with iph and ipl
+ are modified, we must also specify them as outputs, or gcc
+ will assume they contain their original values. */
+ : "=r" (sum), "=r" (iph), "=r" (ihl)
+ : "1" (iph), "2" (ihl)
+ : "memory");
+ return(sum);
+}
+
+/*
+ * Fold a partial checksum
+ */
+
+static inline unsigned int csum_fold(unsigned int sum)
+{
+ __asm__(
+ "addl %1, %0 ;\n"
+ "adcl $0xffff, %0 ;\n"
+ : "=r" (sum)
+ : "r" (sum << 16), "0" (sum & 0xffff0000)
+ );
+ return (~sum) >> 16;
+}
+
+static inline unsigned long csum_tcpudp_nofold(unsigned long saddr,
+ unsigned long daddr,
+ unsigned short len,
+ unsigned short proto,
+ unsigned int sum)
+{
+ __asm__(
+ "addl %1, %0 ;\n"
+ "adcl %2, %0 ;\n"
+ "adcl %3, %0 ;\n"
+ "adcl $0, %0 ;\n"
+ : "=r" (sum)
+ : "g" (daddr), "g"(saddr), "g"((ntohs(len)<<16)+proto*256), "0"(sum));
+ return sum;
+}
+
+/*
+ * computes the checksum of the TCP/UDP pseudo-header
+ * returns a 16-bit checksum, already complemented
+ */
+static inline unsigned short int csum_tcpudp_magic(unsigned long saddr,
+ unsigned long daddr,
+ unsigned short len,
+ unsigned short proto,
+ unsigned int sum)
+{
+ return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum));
+}
+
+/*
+ * this routine is used for miscellaneous IP-like checksums, mainly
+ * in icmp.c
+ */
+
+static inline unsigned short ip_compute_csum(unsigned char * buff, int len)
+{
+ return csum_fold (csum_partial(buff, len, 0));
+}
+
+#define _HAVE_ARCH_IPV6_CSUM
+static __inline__ unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
+ struct in6_addr *daddr,
+ __u32 len,
+ unsigned short proto,
+ unsigned int sum)
+{
+ __asm__(
+ "addl 0(%1), %0 ;\n"
+ "adcl 4(%1), %0 ;\n"
+ "adcl 8(%1), %0 ;\n"
+ "adcl 12(%1), %0 ;\n"
+ "adcl 0(%2), %0 ;\n"
+ "adcl 4(%2), %0 ;\n"
+ "adcl 8(%2), %0 ;\n"
+ "adcl 12(%2), %0 ;\n"
+ "adcl %3, %0 ;\n"
+ "adcl %4, %0 ;\n"
+ "adcl $0, %0 ;\n"
+ : "=&r" (sum)
+ : "r" (saddr), "r" (daddr),
+ "r"(htonl(len)), "r"(htonl(proto)), "0"(sum));
+
+ return csum_fold(sum);
+}
+
+/*
+ * Copy and checksum to user
+ */
+#define HAVE_CSUM_COPY_USER
+static __inline__ unsigned int csum_and_copy_to_user(const unsigned char *src,
+ unsigned char *dst,
+ int len, int sum, int *err_ptr)
+{
+ if (access_ok(VERIFY_WRITE, dst, len))
+ return(csum_partial_copy_to(src, dst, len, sum, err_ptr));
+
+ if (len)
+ *err_ptr = -EFAULT;
+
+ return -1; /* invalid checksum */
+}
+
+#endif
+
+/*
+ * Overrides for Emacs so that we follow Linus's tabbing style.
+ * Emacs will notice this stuff at the end of the file and automatically
+ * adjust the settings for this buffer only. This must remain at the end
+ * of the file.
+ * ---------------------------------------------------------------------------
+ * Local variables:
+ * c-file-style: "linux"
+ * End:
+ */
diff --git a/arch/um/include/sysdep-i386/ptrace.h b/arch/um/include/sysdep-i386/ptrace.h
new file mode 100644
index 000000000000..661d495e2044
--- /dev/null
+++ b/arch/um/include/sysdep-i386/ptrace.h
@@ -0,0 +1,241 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
+ * Licensed under the GPL
+ */
+
+#ifndef __SYSDEP_I386_PTRACE_H
+#define __SYSDEP_I386_PTRACE_H
+
+#include "uml-config.h"
+#include "user_constants.h"
+
+#define MAX_REG_NR (UM_FRAME_SIZE / sizeof(unsigned long))
+#define MAX_REG_OFFSET (UM_FRAME_SIZE)
+
+extern void update_debugregs(int seq);
+
+/* syscall emulation path in ptrace */
+
+#ifndef PTRACE_SYSEMU
+#define PTRACE_SYSEMU 31
+#endif
+
+void set_using_sysemu(int value);
+int get_using_sysemu(void);
+extern int sysemu_supported;
+
+#ifdef UML_CONFIG_MODE_TT
+#include "sysdep/sc.h"
+#endif
+
+#ifdef UML_CONFIG_MODE_SKAS
+
+#include "skas_ptregs.h"
+
+#define REGS_IP(r) ((r)[HOST_IP])
+#define REGS_SP(r) ((r)[HOST_SP])
+#define REGS_EFLAGS(r) ((r)[HOST_EFLAGS])
+#define REGS_EAX(r) ((r)[HOST_EAX])
+#define REGS_EBX(r) ((r)[HOST_EBX])
+#define REGS_ECX(r) ((r)[HOST_ECX])
+#define REGS_EDX(r) ((r)[HOST_EDX])
+#define REGS_ESI(r) ((r)[HOST_ESI])
+#define REGS_EDI(r) ((r)[HOST_EDI])
+#define REGS_EBP(r) ((r)[HOST_EBP])
+#define REGS_CS(r) ((r)[HOST_CS])
+#define REGS_SS(r) ((r)[HOST_SS])
+#define REGS_DS(r) ((r)[HOST_DS])
+#define REGS_ES(r) ((r)[HOST_ES])
+#define REGS_FS(r) ((r)[HOST_FS])
+#define REGS_GS(r) ((r)[HOST_GS])
+
+#define REGS_SET_SYSCALL_RETURN(r, res) REGS_EAX(r) = (res)
+
+#define REGS_RESTART_SYSCALL(r) IP_RESTART_SYSCALL(REGS_IP(r))
+
+#define REGS_SEGV_IS_FIXABLE(r) SEGV_IS_FIXABLE((r)->trap_type)
+
+#define REGS_FAULT_ADDR(r) ((r)->fault_addr)
+
+#define REGS_FAULT_WRITE(r) FAULT_WRITE((r)->fault_type)
+
+#endif
+#ifndef PTRACE_SYSEMU_SINGLESTEP
+#define PTRACE_SYSEMU_SINGLESTEP 32
+#endif
+
+#include "choose-mode.h"
+
+union uml_pt_regs {
+#ifdef UML_CONFIG_MODE_TT
+ struct tt_regs {
+ long syscall;
+ void *sc;
+ } tt;
+#endif
+#ifdef UML_CONFIG_MODE_SKAS
+ struct skas_regs {
+ unsigned long regs[HOST_FRAME_SIZE];
+ unsigned long fp[HOST_FP_SIZE];
+ unsigned long xfp[HOST_XFP_SIZE];
+ unsigned long fault_addr;
+ unsigned long fault_type;
+ unsigned long trap_type;
+ long syscall;
+ int is_user;
+ } skas;
+#endif
+};
+
+#define EMPTY_UML_PT_REGS { }
+
+extern int mode_tt;
+
+#define UPT_SC(r) ((r)->tt.sc)
+#define UPT_IP(r) \
+ __CHOOSE_MODE(SC_IP(UPT_SC(r)), REGS_IP((r)->skas.regs))
+#define UPT_SP(r) \
+ __CHOOSE_MODE(SC_SP(UPT_SC(r)), REGS_SP((r)->skas.regs))
+#define UPT_EFLAGS(r) \
+ __CHOOSE_MODE(SC_EFLAGS(UPT_SC(r)), REGS_EFLAGS((r)->skas.regs))
+#define UPT_EAX(r) \
+ __CHOOSE_MODE(SC_EAX(UPT_SC(r)), REGS_EAX((r)->skas.regs))
+#define UPT_EBX(r) \
+ __CHOOSE_MODE(SC_EBX(UPT_SC(r)), REGS_EBX((r)->skas.regs))
+#define UPT_ECX(r) \
+ __CHOOSE_MODE(SC_ECX(UPT_SC(r)), REGS_ECX((r)->skas.regs))
+#define UPT_EDX(r) \
+ __CHOOSE_MODE(SC_EDX(UPT_SC(r)), REGS_EDX((r)->skas.regs))
+#define UPT_ESI(r) \
+ __CHOOSE_MODE(SC_ESI(UPT_SC(r)), REGS_ESI((r)->skas.regs))
+#define UPT_EDI(r) \
+ __CHOOSE_MODE(SC_EDI(UPT_SC(r)), REGS_EDI((r)->skas.regs))
+#define UPT_EBP(r) \
+ __CHOOSE_MODE(SC_EBP(UPT_SC(r)), REGS_EBP((r)->skas.regs))
+#define UPT_ORIG_EAX(r) \
+ __CHOOSE_MODE((r)->tt.syscall, (r)->skas.syscall)
+#define UPT_CS(r) \
+ __CHOOSE_MODE(SC_CS(UPT_SC(r)), REGS_CS((r)->skas.regs))
+#define UPT_SS(r) \
+ __CHOOSE_MODE(SC_SS(UPT_SC(r)), REGS_SS((r)->skas.regs))
+#define UPT_DS(r) \
+ __CHOOSE_MODE(SC_DS(UPT_SC(r)), REGS_DS((r)->skas.regs))
+#define UPT_ES(r) \
+ __CHOOSE_MODE(SC_ES(UPT_SC(r)), REGS_ES((r)->skas.regs))
+#define UPT_FS(r) \
+ __CHOOSE_MODE(SC_FS(UPT_SC(r)), REGS_FS((r)->skas.regs))
+#define UPT_GS(r) \
+ __CHOOSE_MODE(SC_GS(UPT_SC(r)), REGS_GS((r)->skas.regs))
+
+#define UPT_SYSCALL_ARG1(r) UPT_EBX(r)
+#define UPT_SYSCALL_ARG2(r) UPT_ECX(r)
+#define UPT_SYSCALL_ARG3(r) UPT_EDX(r)
+#define UPT_SYSCALL_ARG4(r) UPT_ESI(r)
+#define UPT_SYSCALL_ARG5(r) UPT_EDI(r)
+#define UPT_SYSCALL_ARG6(r) UPT_EBP(r)
+
+extern int user_context(unsigned long sp);
+
+#define UPT_IS_USER(r) \
+ CHOOSE_MODE(user_context(UPT_SP(r)), (r)->skas.is_user)
+
+struct syscall_args {
+ unsigned long args[6];
+};
+
+#define SYSCALL_ARGS(r) ((struct syscall_args) \
+ { .args = { UPT_SYSCALL_ARG1(r), \
+ UPT_SYSCALL_ARG2(r), \
+ UPT_SYSCALL_ARG3(r), \
+ UPT_SYSCALL_ARG4(r), \
+ UPT_SYSCALL_ARG5(r), \
+ UPT_SYSCALL_ARG6(r) } } )
+
+#define UPT_REG(regs, reg) \
+ ({ unsigned long val; \
+ switch(reg){ \
+ case EIP: val = UPT_IP(regs); break; \
+ case UESP: val = UPT_SP(regs); break; \
+ case EAX: val = UPT_EAX(regs); break; \
+ case EBX: val = UPT_EBX(regs); break; \
+ case ECX: val = UPT_ECX(regs); break; \
+ case EDX: val = UPT_EDX(regs); break; \
+ case ESI: val = UPT_ESI(regs); break; \
+ case EDI: val = UPT_EDI(regs); break; \
+ case EBP: val = UPT_EBP(regs); break; \
+ case ORIG_EAX: val = UPT_ORIG_EAX(regs); break; \
+ case CS: val = UPT_CS(regs); break; \
+ case SS: val = UPT_SS(regs); break; \
+ case DS: val = UPT_DS(regs); break; \
+ case ES: val = UPT_ES(regs); break; \
+ case FS: val = UPT_FS(regs); break; \
+ case GS: val = UPT_GS(regs); break; \
+ case EFL: val = UPT_EFLAGS(regs); break; \
+ default : \
+ panic("Bad register in UPT_REG : %d\n", reg); \
+ val = -1; \
+ } \
+ val; \
+ })
+
+
+#define UPT_SET(regs, reg, val) \
+ do { \
+ switch(reg){ \
+ case EIP: UPT_IP(regs) = val; break; \
+ case UESP: UPT_SP(regs) = val; break; \
+ case EAX: UPT_EAX(regs) = val; break; \
+ case EBX: UPT_EBX(regs) = val; break; \
+ case ECX: UPT_ECX(regs) = val; break; \
+ case EDX: UPT_EDX(regs) = val; break; \
+ case ESI: UPT_ESI(regs) = val; break; \
+ case EDI: UPT_EDI(regs) = val; break; \
+ case EBP: UPT_EBP(regs) = val; break; \
+ case ORIG_EAX: UPT_ORIG_EAX(regs) = val; break; \
+ case CS: UPT_CS(regs) = val; break; \
+ case SS: UPT_SS(regs) = val; break; \
+ case DS: UPT_DS(regs) = val; break; \
+ case ES: UPT_ES(regs) = val; break; \
+ case FS: UPT_FS(regs) = val; break; \
+ case GS: UPT_GS(regs) = val; break; \
+ case EFL: UPT_EFLAGS(regs) = val; break; \
+ default : \
+ panic("Bad register in UPT_SET : %d\n", reg); \
+ break; \
+ } \
+ } while (0)
+
+#define UPT_SET_SYSCALL_RETURN(r, res) \
+ CHOOSE_MODE(SC_SET_SYSCALL_RETURN(UPT_SC(r), (res)), \
+ REGS_SET_SYSCALL_RETURN((r)->skas.regs, (res)))
+
+#define UPT_RESTART_SYSCALL(r) \
+ CHOOSE_MODE(SC_RESTART_SYSCALL(UPT_SC(r)), \
+ REGS_RESTART_SYSCALL((r)->skas.regs))
+
+#define UPT_ORIG_SYSCALL(r) UPT_EAX(r)
+#define UPT_SYSCALL_NR(r) UPT_ORIG_EAX(r)
+#define UPT_SYSCALL_RET(r) UPT_EAX(r)
+
+#define UPT_SEGV_IS_FIXABLE(r) \
+ CHOOSE_MODE(SC_SEGV_IS_FIXABLE(UPT_SC(r)), \
+ REGS_SEGV_IS_FIXABLE(&r->skas))
+
+#define UPT_FAULT_ADDR(r) \
+ __CHOOSE_MODE(SC_FAULT_ADDR(UPT_SC(r)), REGS_FAULT_ADDR(&r->skas))
+
+#define UPT_FAULT_WRITE(r) \
+ CHOOSE_MODE(SC_FAULT_WRITE(UPT_SC(r)), REGS_FAULT_WRITE(&r->skas))
+
+#endif
+
+/*
+ * Overrides for Emacs so that we follow Linus's tabbing style.
+ * Emacs will notice this stuff at the end of the file and automatically
+ * adjust the settings for this buffer only. This must remain at the end
+ * of the file.
+ * ---------------------------------------------------------------------------
+ * Local variables:
+ * c-file-style: "linux"
+ * End:
+ */
diff --git a/arch/um/include/sysdep-i386/ptrace_user.h b/arch/um/include/sysdep-i386/ptrace_user.h
new file mode 100644
index 000000000000..eca8066e7a43
--- /dev/null
+++ b/arch/um/include/sysdep-i386/ptrace_user.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
+ * Licensed under the GPL
+ */
+
+#ifndef __SYSDEP_I386_PTRACE_USER_H__
+#define __SYSDEP_I386_PTRACE_USER_H__
+
+#include <sys/ptrace.h>
+#include <linux/ptrace.h>
+#include <asm/ptrace.h>
+
+#define PT_OFFSET(r) ((r) * sizeof(long))
+
+#define PT_SYSCALL_NR(regs) ((regs)[ORIG_EAX])
+#define PT_SYSCALL_NR_OFFSET PT_OFFSET(ORIG_EAX)
+
+#define PT_SYSCALL_ARG1_OFFSET PT_OFFSET(EBX)
+#define PT_SYSCALL_ARG2_OFFSET PT_OFFSET(ECX)
+#define PT_SYSCALL_ARG3_OFFSET PT_OFFSET(EDX)
+#define PT_SYSCALL_ARG4_OFFSET PT_OFFSET(ESI)
+#define PT_SYSCALL_ARG5_OFFSET PT_OFFSET(EDI)
+
+#define PT_SYSCALL_RET_OFFSET PT_OFFSET(EAX)
+
+#define PT_IP_OFFSET PT_OFFSET(EIP)
+#define PT_IP(regs) ((regs)[EIP])
+#define PT_SP(regs) ((regs)[UESP])
+
+#ifndef FRAME_SIZE
+#define FRAME_SIZE (17)
+#endif
+#define FRAME_SIZE_OFFSET (FRAME_SIZE * sizeof(unsigned long))
+
+#define FP_FRAME_SIZE (27)
+#define FPX_FRAME_SIZE (128)
+
+#ifdef PTRACE_GETREGS
+#define UM_HAVE_GETREGS
+#endif
+
+#ifdef PTRACE_SETREGS
+#define UM_HAVE_SETREGS
+#endif
+
+#ifdef PTRACE_GETFPREGS
+#define UM_HAVE_GETFPREGS
+#endif
+
+#ifdef PTRACE_SETFPREGS
+#define UM_HAVE_SETFPREGS
+#endif
+
+#ifdef PTRACE_GETFPXREGS
+#define UM_HAVE_GETFPXREGS
+#endif
+
+#ifdef PTRACE_SETFPXREGS
+#define UM_HAVE_SETFPXREGS
+#endif
+
+#endif
diff --git a/arch/um/include/sysdep-i386/sigcontext.h b/arch/um/include/sysdep-i386/sigcontext.h
new file mode 100644
index 000000000000..dfee589de360
--- /dev/null
+++ b/arch/um/include/sysdep-i386/sigcontext.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
+ * Licensed under the GPL
+ */
+
+#ifndef __SYS_SIGCONTEXT_I386_H
+#define __SYS_SIGCONTEXT_I386_H
+
+#include <sysdep/sc.h>
+
+#define IP_RESTART_SYSCALL(ip) ((ip) -= 2)
+
+#define SC_RESTART_SYSCALL(sc) IP_RESTART_SYSCALL(SC_IP(sc))
+#define SC_SET_SYSCALL_RETURN(sc, result) SC_EAX(sc) = (result)
+
+#define SC_FAULT_ADDR(sc) SC_CR2(sc)
+#define SC_FAULT_TYPE(sc) SC_ERR(sc)
+
+#define FAULT_WRITE(err) (err & 2)
+#define TO_SC_ERR(is_write) ((is_write) ? 2 : 0)
+
+#define SC_FAULT_WRITE(sc) (FAULT_WRITE(SC_ERR(sc)))
+
+#define SC_TRAP_TYPE(sc) SC_TRAPNO(sc)
+
+/* ptrace expects that, at the start of a system call, %eax contains
+ * -ENOSYS, so this makes it so.
+ */
+#define SC_START_SYSCALL(sc) do SC_EAX(sc) = -ENOSYS; while(0)
+
+/* This is Page Fault */
+#define SEGV_IS_FIXABLE(trap) (trap == 14)
+
+#define SC_SEGV_IS_FIXABLE(sc) (SEGV_IS_FIXABLE(SC_TRAPNO(sc)))
+
+extern unsigned long *sc_sigmask(void *sc_ptr);
+extern int sc_get_fpregs(unsigned long buf, void *sc_ptr);
+
+#endif
+/*
+ * Overrides for Emacs so that we follow Linus's tabbing style.
+ * Emacs will notice this stuff at the end of the file and automatically
+ * adjust the settings for this buffer only. This must remain at the end
+ * of the file.
+ * ---------------------------------------------------------------------------
+ * Local variables:
+ * c-file-style: "linux"
+ * End:
+ */
diff --git a/arch/um/include/sysdep-i386/signal.h b/arch/um/include/sysdep-i386/signal.h
new file mode 100644
index 000000000000..b1e1f7a77499
--- /dev/null
+++ b/arch/um/include/sysdep-i386/signal.h
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2004 PathScale, Inc
+ * Licensed under the GPL
+ */
+
+#ifndef __I386_SIGNAL_H_
+#define __I386_SIGNAL_H_
+
+#include <signal.h>
+
+#define ARCH_GET_SIGCONTEXT(sc, sig) \
+ do sc = (struct sigcontext *) (&sig + 1); while(0)
+
+#endif
+
+/*
+ * Overrides for Emacs so that we follow Linus's tabbing style.
+ * Emacs will notice this stuff at the end of the file and automatically
+ * adjust the settings for this buffer only. This must remain at the end
+ * of the file.
+ * ---------------------------------------------------------------------------
+ * Local variables:
+ * c-file-style: "linux"
+ * End:
+ */
diff --git a/arch/um/include/sysdep-i386/syscalls.h b/arch/um/include/sysdep-i386/syscalls.h
new file mode 100644
index 000000000000..5db81ec9087d
--- /dev/null
+++ b/arch/um/include/sysdep-i386/syscalls.h
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
+ * Licensed under the GPL
+ */
+
+#include "asm/unistd.h"
+#include "sysdep/ptrace.h"
+
+typedef long syscall_handler_t(struct pt_regs);
+
+/* Not declared on x86, incompatible declarations on x86_64, so these have
+ * to go here rather than in sys_call_table.c
+ */
+extern syscall_handler_t sys_ptrace;
+extern syscall_handler_t sys_rt_sigaction;
+
+extern syscall_handler_t old_mmap_i386;
+
+#define EXECUTE_SYSCALL(syscall, regs) \
+ ((long (*)(struct syscall_args)) (*sys_call_table[syscall]))(SYSCALL_ARGS(&regs->regs))
+
+extern long sys_mmap2(unsigned long addr, unsigned long len,
+ unsigned long prot, unsigned long flags,
+ unsigned long fd, unsigned long pgoff);
+
+/* On i386 they choose a meaningless naming.*/
+#define __NR_kexec_load __NR_sys_kexec_load
+
+#define ARCH_SYSCALLS \
+ [ __NR_waitpid ] = (syscall_handler_t *) sys_waitpid, \
+ [ __NR_break ] = (syscall_handler_t *) sys_ni_syscall, \
+ [ __NR_oldstat ] = (syscall_handler_t *) sys_stat, \
+ [ __NR_umount ] = (syscall_handler_t *) sys_oldumount, \
+ [ __NR_stime ] = um_stime, \
+ [ __NR_oldfstat ] = (syscall_handler_t *) sys_fstat, \
+ [ __NR_stty ] = (syscall_handler_t *) sys_ni_syscall, \
+ [ __NR_gtty ] = (syscall_handler_t *) sys_ni_syscall, \
+ [ __NR_nice ] = (syscall_handler_t *) sys_nice, \
+ [ __NR_ftime ] = (syscall_handler_t *) sys_ni_syscall, \
+ [ __NR_prof ] = (syscall_handler_t *) sys_ni_syscall, \
+ [ __NR_signal ] = (syscall_handler_t *) sys_signal, \
+ [ __NR_lock ] = (syscall_handler_t *) sys_ni_syscall, \
+ [ __NR_mpx ] = (syscall_handler_t *) sys_ni_syscall, \
+ [ __NR_ulimit ] = (syscall_handler_t *) sys_ni_syscall, \
+ [ __NR_oldolduname ] = (syscall_handler_t *) sys_olduname, \
+ [ __NR_sigaction ] = (syscall_handler_t *) sys_sigaction, \
+ [ __NR_sgetmask ] = (syscall_handler_t *) sys_sgetmask, \
+ [ __NR_ssetmask ] = (syscall_handler_t *) sys_ssetmask, \
+ [ __NR_sigsuspend ] = (syscall_handler_t *) sys_sigsuspend, \
+ [ __NR_sigpending ] = (syscall_handler_t *) sys_sigpending, \
+ [ __NR_oldlstat ] = (syscall_handler_t *) sys_lstat, \
+ [ __NR_readdir ] = old_readdir, \
+ [ __NR_profil ] = (syscall_handler_t *) sys_ni_syscall, \
+ [ __NR_socketcall ] = (syscall_handler_t *) sys_socketcall, \
+ [ __NR_olduname ] = (syscall_handler_t *) sys_uname, \
+ [ __NR_iopl ] = (syscall_handler_t *) sys_ni_syscall, \
+ [ __NR_idle ] = (syscall_handler_t *) sys_ni_syscall, \
+ [ __NR_ipc ] = (syscall_handler_t *) sys_ipc, \
+ [ __NR_sigreturn ] = (syscall_handler_t *) sys_sigreturn, \
+ [ __NR_sigprocmask ] = (syscall_handler_t *) sys_sigprocmask, \
+ [ __NR_bdflush ] = (syscall_handler_t *) sys_bdflush, \
+ [ __NR__llseek ] = (syscall_handler_t *) sys_llseek, \
+ [ __NR__newselect ] = (syscall_handler_t *) sys_select, \
+ [ __NR_vm86 ] = (syscall_handler_t *) sys_ni_syscall, \
+ [ __NR_mmap ] = (syscall_handler_t *) old_mmap_i386, \
+ [ __NR_ugetrlimit ] = (syscall_handler_t *) sys_getrlimit, \
+ [ __NR_mmap2 ] = (syscall_handler_t *) sys_mmap2, \
+ [ __NR_truncate64 ] = (syscall_handler_t *) sys_truncate64, \
+ [ __NR_ftruncate64 ] = (syscall_handler_t *) sys_ftruncate64, \
+ [ __NR_stat64 ] = (syscall_handler_t *) sys_stat64, \
+ [ __NR_lstat64 ] = (syscall_handler_t *) sys_lstat64, \
+ [ __NR_fstat64 ] = (syscall_handler_t *) sys_fstat64, \
+ [ __NR_fcntl64 ] = (syscall_handler_t *) sys_fcntl64, \
+ [ __NR_sendfile64 ] = (syscall_handler_t *) sys_sendfile64, \
+ [ __NR_statfs64 ] = (syscall_handler_t *) sys_statfs64, \
+ [ __NR_fstatfs64 ] = (syscall_handler_t *) sys_fstatfs64, \
+ [ __NR_fadvise64_64 ] = (syscall_handler_t *) sys_fadvise64_64, \
+ [ __NR_select ] = (syscall_handler_t *) old_select, \
+ [ __NR_vm86old ] = (syscall_handler_t *) sys_ni_syscall, \
+ [ __NR_modify_ldt ] = (syscall_handler_t *) sys_modify_ldt, \
+ [ __NR_lchown32 ] = (syscall_handler_t *) sys_lchown, \
+ [ __NR_getuid32 ] = (syscall_handler_t *) sys_getuid, \
+ [ __NR_getgid32 ] = (syscall_handler_t *) sys_getgid, \
+ [ __NR_geteuid32 ] = (syscall_handler_t *) sys_geteuid, \
+ [ __NR_getegid32 ] = (syscall_handler_t *) sys_getegid, \
+ [ __NR_setreuid32 ] = (syscall_handler_t *) sys_setreuid, \
+ [ __NR_setregid32 ] = (syscall_handler_t *) sys_setregid, \
+ [ __NR_getgroups32 ] = (syscall_handler_t *) sys_getgroups, \
+ [ __NR_setgroups32 ] = (syscall_handler_t *) sys_setgroups, \
+ [ __NR_fchown32 ] = (syscall_handler_t *) sys_fchown, \
+ [ __NR_setresuid32 ] = (syscall_handler_t *) sys_setresuid, \
+ [ __NR_getresuid32 ] = (syscall_handler_t *) sys_getresuid, \
+ [ __NR_setresgid32 ] = (syscall_handler_t *) sys_setresgid, \
+ [ __NR_getresgid32 ] = (syscall_handler_t *) sys_getresgid, \
+ [ __NR_chown32 ] = (syscall_handler_t *) sys_chown, \
+ [ __NR_setuid32 ] = (syscall_handler_t *) sys_setuid, \
+ [ __NR_setgid32 ] = (syscall_handler_t *) sys_setgid, \
+ [ __NR_setfsuid32 ] = (syscall_handler_t *) sys_setfsuid, \
+ [ __NR_setfsgid32 ] = (syscall_handler_t *) sys_setfsgid, \
+ [ __NR_pivot_root ] = (syscall_handler_t *) sys_pivot_root, \
+ [ __NR_mincore ] = (syscall_handler_t *) sys_mincore, \
+ [ __NR_madvise ] = (syscall_handler_t *) sys_madvise, \
+ [ 222 ] = (syscall_handler_t *) sys_ni_syscall, \
+ [ 223 ] = (syscall_handler_t *) sys_ni_syscall, \
+ [ __NR_set_thread_area ] = (syscall_handler_t *) sys_ni_syscall, \
+ [ __NR_get_thread_area ] = (syscall_handler_t *) sys_ni_syscall, \
+ [ 251 ] = (syscall_handler_t *) sys_ni_syscall, \
+ [ 285 ] = (syscall_handler_t *) sys_ni_syscall,
+
+/* 222 doesn't yet have a name in include/asm-i386/unistd.h */
+
+#define LAST_ARCH_SYSCALL 285
+
+/*
+ * Overrides for Emacs so that we follow Linus's tabbing style.
+ * Emacs will notice this stuff at the end of the file and automatically
+ * adjust the settings for this buffer only. This must remain at the end
+ * of the file.
+ * ---------------------------------------------------------------------------
+ * Local variables:
+ * c-file-style: "linux"
+ * End:
+ */