diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2008-08-18 21:44:32 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-10-23 01:55:21 -0400 |
commit | f5ad6a42b700d9687bb97cf461e7f2506e3006d6 (patch) | |
tree | 1bd92ee745ce1bdf459147dd9cbdb440c72cd9f8 /arch/um/sys-ppc/sysdep | |
parent | 17dcf75d3ea11d7e26110ba85677cfadbccecf45 (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/sysdep')
-rw-r--r-- | arch/um/sys-ppc/sysdep/ptrace.h | 103 | ||||
-rw-r--r-- | arch/um/sys-ppc/sysdep/sigcontext.h | 62 | ||||
-rw-r--r-- | arch/um/sys-ppc/sysdep/skas_ptrace.h | 22 | ||||
-rw-r--r-- | arch/um/sys-ppc/sysdep/syscalls.h | 53 |
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 @@ | |||
1 | /* | ||
2 | * Licensed under the GPL | ||
3 | */ | ||
4 | |||
5 | #ifndef __SYS_PTRACE_PPC_H | ||
6 | #define __SYS_PTRACE_PPC_H | ||
7 | |||
8 | #include "linux/types.h" | ||
9 | |||
10 | /* the following taken from <asm-ppc/ptrace.h> */ | ||
11 | |||
12 | #ifdef CONFIG_PPC64 | ||
13 | #define PPC_REG unsigned long /*long*/ | ||
14 | #else | ||
15 | #define PPC_REG unsigned long | ||
16 | #endif | ||
17 | struct sys_pt_regs_s { | ||
18 | PPC_REG gpr[32]; | ||
19 | PPC_REG nip; | ||
20 | PPC_REG msr; | ||
21 | PPC_REG orig_gpr3; /* Used for restarting system calls */ | ||
22 | PPC_REG ctr; | ||
23 | PPC_REG link; | ||
24 | PPC_REG xer; | ||
25 | PPC_REG ccr; | ||
26 | PPC_REG mq; /* 601 only (not used at present) */ | ||
27 | /* Used on APUS to hold IPL value. */ | ||
28 | PPC_REG trap; /* Reason for being here */ | ||
29 | PPC_REG dar; /* Fault registers */ | ||
30 | PPC_REG dsisr; | ||
31 | PPC_REG result; /* Result of a system call */ | ||
32 | }; | ||
33 | |||
34 | #define NUM_REGS (sizeof(struct sys_pt_regs_s) / sizeof(PPC_REG)) | ||
35 | |||
36 | struct sys_pt_regs { | ||
37 | PPC_REG regs[sizeof(struct sys_pt_regs_s) / sizeof(PPC_REG)]; | ||
38 | }; | ||
39 | |||
40 | #define UM_MAX_REG (PT_FPR0) | ||
41 | #define UM_MAX_REG_OFFSET (UM_MAX_REG * sizeof(PPC_REG)) | ||
42 | |||
43 | #define EMPTY_REGS { { [ 0 ... NUM_REGS - 1] = 0 } } | ||
44 | |||
45 | #define UM_REG(r, n) ((r)->regs[n]) | ||
46 | |||
47 | #define UM_SYSCALL_RET(r) UM_REG(r, PT_R3) | ||
48 | #define UM_SP(r) UM_REG(r, PT_R1) | ||
49 | #define UM_IP(r) UM_REG(r, PT_NIP) | ||
50 | #define UM_ELF_ZERO(r) UM_REG(r, PT_FPSCR) | ||
51 | #define UM_SYSCALL_NR(r) UM_REG(r, PT_R0) | ||
52 | #define UM_SYSCALL_ARG1(r) UM_REG(r, PT_ORIG_R3) | ||
53 | #define UM_SYSCALL_ARG2(r) UM_REG(r, PT_R4) | ||
54 | #define UM_SYSCALL_ARG3(r) UM_REG(r, PT_R5) | ||
55 | #define UM_SYSCALL_ARG4(r) UM_REG(r, PT_R6) | ||
56 | #define UM_SYSCALL_ARG5(r) UM_REG(r, PT_R7) | ||
57 | #define UM_SYSCALL_ARG6(r) UM_REG(r, PT_R8) | ||
58 | |||
59 | #define UM_SYSCALL_NR_OFFSET (PT_R0 * sizeof(PPC_REG)) | ||
60 | #define UM_SYSCALL_RET_OFFSET (PT_R3 * sizeof(PPC_REG)) | ||
61 | #define UM_SYSCALL_ARG1_OFFSET (PT_R3 * sizeof(PPC_REG)) | ||
62 | #define UM_SYSCALL_ARG2_OFFSET (PT_R4 * sizeof(PPC_REG)) | ||
63 | #define UM_SYSCALL_ARG3_OFFSET (PT_R5 * sizeof(PPC_REG)) | ||
64 | #define UM_SYSCALL_ARG4_OFFSET (PT_R6 * sizeof(PPC_REG)) | ||
65 | #define UM_SYSCALL_ARG5_OFFSET (PT_R7 * sizeof(PPC_REG)) | ||
66 | #define UM_SYSCALL_ARG6_OFFSET (PT_R8 * sizeof(PPC_REG)) | ||
67 | #define UM_SP_OFFSET (PT_R1 * sizeof(PPC_REG)) | ||
68 | #define UM_IP_OFFSET (PT_NIP * sizeof(PPC_REG)) | ||
69 | #define UM_ELF_ZERO_OFFSET (PT_R3 * sizeof(PPC_REG)) | ||
70 | |||
71 | #define UM_SET_SYSCALL_RETURN(_regs, result) \ | ||
72 | do { \ | ||
73 | if (result < 0) { \ | ||
74 | (_regs)->regs[PT_CCR] |= 0x10000000; \ | ||
75 | UM_SYSCALL_RET((_regs)) = -result; \ | ||
76 | } else { \ | ||
77 | UM_SYSCALL_RET((_regs)) = result; \ | ||
78 | } \ | ||
79 | } while(0) | ||
80 | |||
81 | extern void shove_aux_table(unsigned long sp); | ||
82 | #define UM_FIX_EXEC_STACK(sp) shove_aux_table(sp); | ||
83 | |||
84 | /* These aren't actually defined. The undefs are just to make sure | ||
85 | * everyone's clear on the concept. | ||
86 | */ | ||
87 | #undef UML_HAVE_GETREGS | ||
88 | #undef UML_HAVE_GETFPREGS | ||
89 | #undef UML_HAVE_SETREGS | ||
90 | #undef UML_HAVE_SETFPREGS | ||
91 | |||
92 | #endif | ||
93 | |||
94 | /* | ||
95 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
96 | * Emacs will notice this stuff at the end of the file and automatically | ||
97 | * adjust the settings for this buffer only. This must remain at the end | ||
98 | * of the file. | ||
99 | * --------------------------------------------------------------------------- | ||
100 | * Local variables: | ||
101 | * c-file-style: "linux" | ||
102 | * End: | ||
103 | */ | ||
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 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __SYS_SIGCONTEXT_PPC_H | ||
7 | #define __SYS_SIGCONTEXT_PPC_H | ||
8 | |||
9 | #define DSISR_WRITE 0x02000000 | ||
10 | |||
11 | #define SC_FAULT_ADDR(sc) ({ \ | ||
12 | struct sigcontext *_sc = (sc); \ | ||
13 | long retval = -1; \ | ||
14 | switch (_sc->regs->trap) { \ | ||
15 | case 0x300: \ | ||
16 | /* data exception */ \ | ||
17 | retval = _sc->regs->dar; \ | ||
18 | break; \ | ||
19 | case 0x400: \ | ||
20 | /* instruction exception */ \ | ||
21 | retval = _sc->regs->nip; \ | ||
22 | break; \ | ||
23 | default: \ | ||
24 | panic("SC_FAULT_ADDR: unhandled trap type\n"); \ | ||
25 | } \ | ||
26 | retval; \ | ||
27 | }) | ||
28 | |||
29 | #define SC_FAULT_WRITE(sc) ({ \ | ||
30 | struct sigcontext *_sc = (sc); \ | ||
31 | long retval = -1; \ | ||
32 | switch (_sc->regs->trap) { \ | ||
33 | case 0x300: \ | ||
34 | /* data exception */ \ | ||
35 | retval = !!(_sc->regs->dsisr & DSISR_WRITE); \ | ||
36 | break; \ | ||
37 | case 0x400: \ | ||
38 | /* instruction exception: not a write */ \ | ||
39 | retval = 0; \ | ||
40 | break; \ | ||
41 | default: \ | ||
42 | panic("SC_FAULT_ADDR: unhandled trap type\n"); \ | ||
43 | } \ | ||
44 | retval; \ | ||
45 | }) | ||
46 | |||
47 | #define SC_IP(sc) ((sc)->regs->nip) | ||
48 | #define SC_SP(sc) ((sc)->regs->gpr[1]) | ||
49 | #define SEGV_IS_FIXABLE(sc) (1) | ||
50 | |||
51 | #endif | ||
52 | |||
53 | /* | ||
54 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
55 | * Emacs will notice this stuff at the end of the file and automatically | ||
56 | * adjust the settings for this buffer only. This must remain at the end | ||
57 | * of the file. | ||
58 | * --------------------------------------------------------------------------- | ||
59 | * Local variables: | ||
60 | * c-file-style: "linux" | ||
61 | * End: | ||
62 | */ | ||
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 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #ifndef __SYSDEP_PPC_SKAS_PTRACE_H | ||
7 | #define __SYSDEP_PPC_SKAS_PTRACE_H | ||
8 | |||
9 | struct ptrace_faultinfo { | ||
10 | int is_write; | ||
11 | unsigned long addr; | ||
12 | }; | ||
13 | |||
14 | struct ptrace_ldt { | ||
15 | int func; | ||
16 | void *ptr; | ||
17 | unsigned long bytecount; | ||
18 | }; | ||
19 | |||
20 | #define PTRACE_LDT 54 | ||
21 | |||
22 | #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 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | typedef long syscall_handler_t(unsigned long arg1, unsigned long arg2, | ||
7 | unsigned long arg3, unsigned long arg4, | ||
8 | unsigned long arg5, unsigned long arg6); | ||
9 | |||
10 | #define EXECUTE_SYSCALL(syscall, regs) \ | ||
11 | (*sys_call_table[syscall])(UM_SYSCALL_ARG1(®s), \ | ||
12 | UM_SYSCALL_ARG2(®s), \ | ||
13 | UM_SYSCALL_ARG3(®s), \ | ||
14 | UM_SYSCALL_ARG4(®s), \ | ||
15 | UM_SYSCALL_ARG5(®s), \ | ||
16 | UM_SYSCALL_ARG6(®s)) | ||
17 | |||
18 | extern syscall_handler_t sys_mincore; | ||
19 | extern syscall_handler_t sys_madvise; | ||
20 | |||
21 | /* old_mmap needs the correct prototype since syscall_kern.c includes | ||
22 | * this file. | ||
23 | */ | ||
24 | int old_mmap(unsigned long addr, unsigned long len, | ||
25 | unsigned long prot, unsigned long flags, | ||
26 | unsigned long fd, unsigned long offset); | ||
27 | |||
28 | #define ARCH_SYSCALLS \ | ||
29 | [ __NR_modify_ldt ] = sys_ni_syscall, \ | ||
30 | [ __NR_pciconfig_read ] = sys_ni_syscall, \ | ||
31 | [ __NR_pciconfig_write ] = sys_ni_syscall, \ | ||
32 | [ __NR_pciconfig_iobase ] = sys_ni_syscall, \ | ||
33 | [ __NR_pivot_root ] = sys_ni_syscall, \ | ||
34 | [ __NR_multiplexer ] = sys_ni_syscall, \ | ||
35 | [ __NR_mmap ] = old_mmap, \ | ||
36 | [ __NR_madvise ] = sys_madvise, \ | ||
37 | [ __NR_mincore ] = sys_mincore, \ | ||
38 | [ __NR_iopl ] = (syscall_handler_t *) sys_ni_syscall, \ | ||
39 | [ __NR_utimes ] = (syscall_handler_t *) sys_utimes, \ | ||
40 | [ __NR_fadvise64 ] = (syscall_handler_t *) sys_fadvise64, | ||
41 | |||
42 | #define LAST_ARCH_SYSCALL __NR_fadvise64 | ||
43 | |||
44 | /* | ||
45 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
46 | * Emacs will notice this stuff at the end of the file and automatically | ||
47 | * adjust the settings for this buffer only. This must remain at the end | ||
48 | * of the file. | ||
49 | * --------------------------------------------------------------------------- | ||
50 | * Local variables: | ||
51 | * c-file-style: "linux" | ||
52 | * End: | ||
53 | */ | ||