summaryrefslogtreecommitdiff
path: root/arch/um/sys-ppc
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2008-08-18 21:44:32 -0400
committerH. Peter Anvin <hpa@zytor.com>2008-10-22 22:55:21 -0700
commitf5ad6a42b700d9687bb97cf461e7f2506e3006d6 (patch)
tree1bd92ee745ce1bdf459147dd9cbdb440c72cd9f8 /arch/um/sys-ppc
parent17dcf75d3ea11d7e26110ba85677cfadbccecf45 (diff)
x86, um: get rid of sysdep symlink
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/um/sys-ppc')
-rw-r--r--arch/um/sys-ppc/sysdep/ptrace.h103
-rw-r--r--arch/um/sys-ppc/sysdep/sigcontext.h62
-rw-r--r--arch/um/sys-ppc/sysdep/skas_ptrace.h22
-rw-r--r--arch/um/sys-ppc/sysdep/syscalls.h53
4 files changed, 240 insertions, 0 deletions
diff --git a/arch/um/sys-ppc/sysdep/ptrace.h b/arch/um/sys-ppc/sysdep/ptrace.h
new file mode 100644
index 000000000000..df2397dba3e5
--- /dev/null
+++ b/arch/um/sys-ppc/sysdep/ptrace.h
@@ -0,0 +1,103 @@
+/*
+ * Licensed under the GPL
+ */
+
+#ifndef __SYS_PTRACE_PPC_H
+#define __SYS_PTRACE_PPC_H
+
+#include "linux/types.h"
+
+/* the following taken from <asm-ppc/ptrace.h> */
+
+#ifdef CONFIG_PPC64
+#define PPC_REG unsigned long /*long*/
+#else
+#define PPC_REG unsigned long
+#endif
+struct sys_pt_regs_s {
+ PPC_REG gpr[32];
+ PPC_REG nip;
+ PPC_REG msr;
+ PPC_REG orig_gpr3; /* Used for restarting system calls */
+ PPC_REG ctr;
+ PPC_REG link;
+ PPC_REG xer;
+ PPC_REG ccr;
+ PPC_REG mq; /* 601 only (not used at present) */
+ /* Used on APUS to hold IPL value. */
+ PPC_REG trap; /* Reason for being here */
+ PPC_REG dar; /* Fault registers */
+ PPC_REG dsisr;
+ PPC_REG result; /* Result of a system call */
+};
+
+#define NUM_REGS (sizeof(struct sys_pt_regs_s) / sizeof(PPC_REG))
+
+struct sys_pt_regs {
+ PPC_REG regs[sizeof(struct sys_pt_regs_s) / sizeof(PPC_REG)];
+};
+
+#define UM_MAX_REG (PT_FPR0)
+#define UM_MAX_REG_OFFSET (UM_MAX_REG * sizeof(PPC_REG))
+
+#define EMPTY_REGS { { [ 0 ... NUM_REGS - 1] = 0 } }
+
+#define UM_REG(r, n) ((r)->regs[n])
+
+#define UM_SYSCALL_RET(r) UM_REG(r, PT_R3)
+#define UM_SP(r) UM_REG(r, PT_R1)
+#define UM_IP(r) UM_REG(r, PT_NIP)
+#define UM_ELF_ZERO(r) UM_REG(r, PT_FPSCR)
+#define UM_SYSCALL_NR(r) UM_REG(r, PT_R0)
+#define UM_SYSCALL_ARG1(r) UM_REG(r, PT_ORIG_R3)
+#define UM_SYSCALL_ARG2(r) UM_REG(r, PT_R4)
+#define UM_SYSCALL_ARG3(r) UM_REG(r, PT_R5)
+#define UM_SYSCALL_ARG4(r) UM_REG(r, PT_R6)
+#define UM_SYSCALL_ARG5(r) UM_REG(r, PT_R7)
+#define UM_SYSCALL_ARG6(r) UM_REG(r, PT_R8)
+
+#define UM_SYSCALL_NR_OFFSET (PT_R0 * sizeof(PPC_REG))
+#define UM_SYSCALL_RET_OFFSET (PT_R3 * sizeof(PPC_REG))
+#define UM_SYSCALL_ARG1_OFFSET (PT_R3 * sizeof(PPC_REG))
+#define UM_SYSCALL_ARG2_OFFSET (PT_R4 * sizeof(PPC_REG))
+#define UM_SYSCALL_ARG3_OFFSET (PT_R5 * sizeof(PPC_REG))
+#define UM_SYSCALL_ARG4_OFFSET (PT_R6 * sizeof(PPC_REG))
+#define UM_SYSCALL_ARG5_OFFSET (PT_R7 * sizeof(PPC_REG))
+#define UM_SYSCALL_ARG6_OFFSET (PT_R8 * sizeof(PPC_REG))
+#define UM_SP_OFFSET (PT_R1 * sizeof(PPC_REG))
+#define UM_IP_OFFSET (PT_NIP * sizeof(PPC_REG))
+#define UM_ELF_ZERO_OFFSET (PT_R3 * sizeof(PPC_REG))
+
+#define UM_SET_SYSCALL_RETURN(_regs, result) \
+do { \
+ if (result < 0) { \
+ (_regs)->regs[PT_CCR] |= 0x10000000; \
+ UM_SYSCALL_RET((_regs)) = -result; \
+ } else { \
+ UM_SYSCALL_RET((_regs)) = result; \
+ } \
+} while(0)
+
+extern void shove_aux_table(unsigned long sp);
+#define UM_FIX_EXEC_STACK(sp) shove_aux_table(sp);
+
+/* These aren't actually defined. The undefs are just to make sure
+ * everyone's clear on the concept.
+ */
+#undef UML_HAVE_GETREGS
+#undef UML_HAVE_GETFPREGS
+#undef UML_HAVE_SETREGS
+#undef UML_HAVE_SETFPREGS
+
+#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/sys-ppc/sysdep/sigcontext.h b/arch/um/sys-ppc/sysdep/sigcontext.h
new file mode 100644
index 000000000000..f20d965de9c7
--- /dev/null
+++ b/arch/um/sys-ppc/sysdep/sigcontext.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
+ * Licensed under the GPL
+ */
+
+#ifndef __SYS_SIGCONTEXT_PPC_H
+#define __SYS_SIGCONTEXT_PPC_H
+
+#define DSISR_WRITE 0x02000000
+
+#define SC_FAULT_ADDR(sc) ({ \
+ struct sigcontext *_sc = (sc); \
+ long retval = -1; \
+ switch (_sc->regs->trap) { \
+ case 0x300: \
+ /* data exception */ \
+ retval = _sc->regs->dar; \
+ break; \
+ case 0x400: \
+ /* instruction exception */ \
+ retval = _sc->regs->nip; \
+ break; \
+ default: \
+ panic("SC_FAULT_ADDR: unhandled trap type\n"); \
+ } \
+ retval; \
+ })
+
+#define SC_FAULT_WRITE(sc) ({ \
+ struct sigcontext *_sc = (sc); \
+ long retval = -1; \
+ switch (_sc->regs->trap) { \
+ case 0x300: \
+ /* data exception */ \
+ retval = !!(_sc->regs->dsisr & DSISR_WRITE); \
+ break; \
+ case 0x400: \
+ /* instruction exception: not a write */ \
+ retval = 0; \
+ break; \
+ default: \
+ panic("SC_FAULT_ADDR: unhandled trap type\n"); \
+ } \
+ retval; \
+ })
+
+#define SC_IP(sc) ((sc)->regs->nip)
+#define SC_SP(sc) ((sc)->regs->gpr[1])
+#define SEGV_IS_FIXABLE(sc) (1)
+
+#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/sys-ppc/sysdep/skas_ptrace.h b/arch/um/sys-ppc/sysdep/skas_ptrace.h
new file mode 100644
index 000000000000..d9fbbac10de0
--- /dev/null
+++ b/arch/um/sys-ppc/sysdep/skas_ptrace.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
+ * Licensed under the GPL
+ */
+
+#ifndef __SYSDEP_PPC_SKAS_PTRACE_H
+#define __SYSDEP_PPC_SKAS_PTRACE_H
+
+struct ptrace_faultinfo {
+ int is_write;
+ unsigned long addr;
+};
+
+struct ptrace_ldt {
+ int func;
+ void *ptr;
+ unsigned long bytecount;
+};
+
+#define PTRACE_LDT 54
+
+#endif
diff --git a/arch/um/sys-ppc/sysdep/syscalls.h b/arch/um/sys-ppc/sysdep/syscalls.h
new file mode 100644
index 000000000000..679df351e19b
--- /dev/null
+++ b/arch/um/sys-ppc/sysdep/syscalls.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
+ * Licensed under the GPL
+ */
+
+typedef long syscall_handler_t(unsigned long arg1, unsigned long arg2,
+ unsigned long arg3, unsigned long arg4,
+ unsigned long arg5, unsigned long arg6);
+
+#define EXECUTE_SYSCALL(syscall, regs) \
+ (*sys_call_table[syscall])(UM_SYSCALL_ARG1(&regs), \
+ UM_SYSCALL_ARG2(&regs), \
+ UM_SYSCALL_ARG3(&regs), \
+ UM_SYSCALL_ARG4(&regs), \
+ UM_SYSCALL_ARG5(&regs), \
+ UM_SYSCALL_ARG6(&regs))
+
+extern syscall_handler_t sys_mincore;
+extern syscall_handler_t sys_madvise;
+
+/* old_mmap needs the correct prototype since syscall_kern.c includes
+ * this file.
+ */
+int old_mmap(unsigned long addr, unsigned long len,
+ unsigned long prot, unsigned long flags,
+ unsigned long fd, unsigned long offset);
+
+#define ARCH_SYSCALLS \
+ [ __NR_modify_ldt ] = sys_ni_syscall, \
+ [ __NR_pciconfig_read ] = sys_ni_syscall, \
+ [ __NR_pciconfig_write ] = sys_ni_syscall, \
+ [ __NR_pciconfig_iobase ] = sys_ni_syscall, \
+ [ __NR_pivot_root ] = sys_ni_syscall, \
+ [ __NR_multiplexer ] = sys_ni_syscall, \
+ [ __NR_mmap ] = old_mmap, \
+ [ __NR_madvise ] = sys_madvise, \
+ [ __NR_mincore ] = sys_mincore, \
+ [ __NR_iopl ] = (syscall_handler_t *) sys_ni_syscall, \
+ [ __NR_utimes ] = (syscall_handler_t *) sys_utimes, \
+ [ __NR_fadvise64 ] = (syscall_handler_t *) sys_fadvise64,
+
+#define LAST_ARCH_SYSCALL __NR_fadvise64
+
+/*
+ * 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:
+ */