diff options
author | Jeff Dike <jdike@addtoit.com> | 2007-10-16 04:27:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:43:07 -0400 |
commit | f0c4cad99c12f08cb2a6cd0255911b2a93c57707 (patch) | |
tree | 1687ef2577bc7429955e8642fe8340ff2292817c /arch/um | |
parent | 54fa0ba40698af6d6735ade024293bb51cc4d4b3 (diff) |
uml: style fixes in FP code
Tidy the code affected by the floating point fixes.
A bunch of unused stuff is gone, including two sigcontext.c files,
which turned out to be entirely unneeded.
There are the usual fixes -
whitespace and style cleanups
copyright updates
emacs formatting comments gone
include cleanups
adding severities to printks
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um')
-rw-r--r-- | arch/um/include/sysdep-i386/sigcontext.h | 13 | ||||
-rw-r--r-- | arch/um/include/sysdep-x86_64/sigcontext.h | 28 | ||||
-rw-r--r-- | arch/um/kernel/ptrace.c | 2 | ||||
-rw-r--r-- | arch/um/os-Linux/sys-i386/registers.c | 26 | ||||
-rw-r--r-- | arch/um/sys-i386/Makefile | 6 | ||||
-rw-r--r-- | arch/um/sys-i386/sigcontext.c | 71 | ||||
-rw-r--r-- | arch/um/sys-x86_64/Makefile | 6 | ||||
-rw-r--r-- | arch/um/sys-x86_64/ptrace.c | 101 | ||||
-rw-r--r-- | arch/um/sys-x86_64/sigcontext.c | 39 | ||||
-rw-r--r-- | arch/um/sys-x86_64/signal.c | 23 |
10 files changed, 77 insertions, 238 deletions
diff --git a/arch/um/include/sysdep-i386/sigcontext.h b/arch/um/include/sysdep-i386/sigcontext.h index 3050a6aaed7a..67e77122aa45 100644 --- a/arch/um/include/sysdep-i386/sigcontext.h +++ b/arch/um/include/sysdep-i386/sigcontext.h | |||
@@ -6,15 +6,10 @@ | |||
6 | #ifndef __SYS_SIGCONTEXT_I386_H | 6 | #ifndef __SYS_SIGCONTEXT_I386_H |
7 | #define __SYS_SIGCONTEXT_I386_H | 7 | #define __SYS_SIGCONTEXT_I386_H |
8 | 8 | ||
9 | #include "uml-config.h" | ||
10 | #include "skas.h" | ||
11 | #include "sysdep/sc.h" | 9 | #include "sysdep/sc.h" |
12 | 10 | ||
13 | #define IP_RESTART_SYSCALL(ip) ((ip) -= 2) | 11 | #define IP_RESTART_SYSCALL(ip) ((ip) -= 2) |
14 | 12 | ||
15 | #define SC_RESTART_SYSCALL(sc) IP_RESTART_SYSCALL(SC_IP(sc)) | ||
16 | #define SC_SET_SYSCALL_RETURN(sc, result) SC_EAX(sc) = (result) | ||
17 | |||
18 | #define GET_FAULTINFO_FROM_SC(fi,sc) \ | 13 | #define GET_FAULTINFO_FROM_SC(fi,sc) \ |
19 | { \ | 14 | { \ |
20 | (fi).cr2 = SC_CR2(sc); \ | 15 | (fi).cr2 = SC_CR2(sc); \ |
@@ -22,18 +17,10 @@ | |||
22 | (fi).trap_no = SC_TRAPNO(sc); \ | 17 | (fi).trap_no = SC_TRAPNO(sc); \ |
23 | } | 18 | } |
24 | 19 | ||
25 | /* ptrace expects that, at the start of a system call, %eax contains | ||
26 | * -ENOSYS, so this makes it so. | ||
27 | */ | ||
28 | #define SC_START_SYSCALL(sc) do SC_EAX(sc) = -ENOSYS; while(0) | ||
29 | |||
30 | /* This is Page Fault */ | 20 | /* This is Page Fault */ |
31 | #define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14) | 21 | #define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14) |
32 | 22 | ||
33 | /* SKAS3 has no trap_no on i386, but get_skas_faultinfo() sets it to 0. */ | 23 | /* SKAS3 has no trap_no on i386, but get_skas_faultinfo() sets it to 0. */ |
34 | #define SEGV_MAYBE_FIXABLE(fi) ((fi)->trap_no == 0 && ptrace_faultinfo) | 24 | #define SEGV_MAYBE_FIXABLE(fi) ((fi)->trap_no == 0 && ptrace_faultinfo) |
35 | 25 | ||
36 | extern unsigned long *sc_sigmask(void *sc_ptr); | ||
37 | extern int sc_get_fpregs(unsigned long buf, void *sc_ptr); | ||
38 | |||
39 | #endif | 26 | #endif |
diff --git a/arch/um/include/sysdep-x86_64/sigcontext.h b/arch/um/include/sysdep-x86_64/sigcontext.h index 41073235e7ad..0155133b1458 100644 --- a/arch/um/include/sysdep-x86_64/sigcontext.h +++ b/arch/um/include/sysdep-x86_64/sigcontext.h | |||
@@ -11,43 +11,17 @@ | |||
11 | 11 | ||
12 | #define IP_RESTART_SYSCALL(ip) ((ip) -= 2) | 12 | #define IP_RESTART_SYSCALL(ip) ((ip) -= 2) |
13 | 13 | ||
14 | #define SC_RESTART_SYSCALL(sc) IP_RESTART_SYSCALL(SC_IP(sc)) | 14 | #define GET_FAULTINFO_FROM_SC(fi, sc) \ |
15 | #define SC_SET_SYSCALL_RETURN(sc, result) SC_RAX(sc) = (result) | ||
16 | |||
17 | #define SC_FAULT_ADDR(sc) SC_CR2(sc) | ||
18 | #define SC_FAULT_TYPE(sc) SC_ERR(sc) | ||
19 | |||
20 | #define GET_FAULTINFO_FROM_SC(fi,sc) \ | ||
21 | { \ | 15 | { \ |
22 | (fi).cr2 = SC_CR2(sc); \ | 16 | (fi).cr2 = SC_CR2(sc); \ |
23 | (fi).error_code = SC_ERR(sc); \ | 17 | (fi).error_code = SC_ERR(sc); \ |
24 | (fi).trap_no = SC_TRAPNO(sc); \ | 18 | (fi).trap_no = SC_TRAPNO(sc); \ |
25 | } | 19 | } |
26 | 20 | ||
27 | /* ptrace expects that, at the start of a system call, %eax contains | ||
28 | * -ENOSYS, so this makes it so. | ||
29 | */ | ||
30 | |||
31 | #define SC_START_SYSCALL(sc) do SC_RAX(sc) = -ENOSYS; while(0) | ||
32 | |||
33 | /* This is Page Fault */ | 21 | /* This is Page Fault */ |
34 | #define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14) | 22 | #define SEGV_IS_FIXABLE(fi) ((fi)->trap_no == 14) |
35 | 23 | ||
36 | /* No broken SKAS API, which doesn't pass trap_no, here. */ | 24 | /* No broken SKAS API, which doesn't pass trap_no, here. */ |
37 | #define SEGV_MAYBE_FIXABLE(fi) 0 | 25 | #define SEGV_MAYBE_FIXABLE(fi) 0 |
38 | 26 | ||
39 | extern unsigned long *sc_sigmask(void *sc_ptr); | ||
40 | |||
41 | #endif | 27 | #endif |
42 | |||
43 | /* | ||
44 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
45 | * Emacs will notice this stuff at the end of the file and automatically | ||
46 | * adjust the settings for this buffer only. This must remain at the end | ||
47 | * of the file. | ||
48 | * --------------------------------------------------------------------------- | ||
49 | * Local variables: | ||
50 | * c-file-style: "linux" | ||
51 | * End: | ||
52 | */ | ||
53 | |||
diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c index 2511f9199417..a0eba0833068 100644 --- a/arch/um/kernel/ptrace.c +++ b/arch/um/kernel/ptrace.c | |||
@@ -171,8 +171,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
171 | */ | 171 | */ |
172 | ret = copy_to_user(p, &child->thread.arch.faultinfo, | 172 | ret = copy_to_user(p, &child->thread.arch.faultinfo, |
173 | sizeof(struct ptrace_faultinfo)); | 173 | sizeof(struct ptrace_faultinfo)); |
174 | if (ret) | ||
175 | break; | ||
176 | break; | 174 | break; |
177 | } | 175 | } |
178 | 176 | ||
diff --git a/arch/um/os-Linux/sys-i386/registers.c b/arch/um/os-Linux/sys-i386/registers.c index 8f1f0ab639b9..d1997ca76e5c 100644 --- a/arch/um/os-Linux/sys-i386/registers.c +++ b/arch/um/os-Linux/sys-i386/registers.c | |||
@@ -1,49 +1,55 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2004 PathScale, Inc | 2 | * Copyright (C) 2004 PathScale, Inc |
3 | * Copyright (C) 2004 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | ||
3 | * Licensed under the GPL | 4 | * Licensed under the GPL |
4 | */ | 5 | */ |
5 | 6 | ||
6 | #include <errno.h> | 7 | #include <errno.h> |
7 | #include <sysdep/ptrace_user.h> | 8 | #include "kern_constants.h" |
8 | #include "longjmp.h" | 9 | #include "longjmp.h" |
9 | #include "user.h" | 10 | #include "user.h" |
11 | #include "sysdep/ptrace_user.h" | ||
10 | 12 | ||
11 | int save_fp_registers(int pid, unsigned long *fp_regs) | 13 | int save_fp_registers(int pid, unsigned long *fp_regs) |
12 | { | 14 | { |
13 | if(ptrace(PTRACE_GETFPREGS, pid, 0, fp_regs) < 0) | 15 | if (ptrace(PTRACE_GETFPREGS, pid, 0, fp_regs) < 0) |
14 | return -errno; | 16 | return -errno; |
15 | return 0; | 17 | return 0; |
16 | } | 18 | } |
17 | 19 | ||
18 | int restore_fp_registers(int pid, unsigned long *fp_regs) | 20 | int restore_fp_registers(int pid, unsigned long *fp_regs) |
19 | { | 21 | { |
20 | if(ptrace(PTRACE_SETFPREGS, pid, 0, fp_regs) < 0) | 22 | if (ptrace(PTRACE_SETFPREGS, pid, 0, fp_regs) < 0) |
21 | return -errno; | 23 | return -errno; |
22 | return 0; | 24 | return 0; |
23 | } | 25 | } |
24 | 26 | ||
25 | int save_fpx_registers(int pid, unsigned long *fp_regs) | 27 | int save_fpx_registers(int pid, unsigned long *fp_regs) |
26 | { | 28 | { |
27 | if(ptrace(PTRACE_GETFPXREGS, pid, 0, fp_regs) < 0) | 29 | if (ptrace(PTRACE_GETFPXREGS, pid, 0, fp_regs) < 0) |
28 | return -errno; | 30 | return -errno; |
29 | return 0; | 31 | return 0; |
30 | } | 32 | } |
31 | 33 | ||
32 | int restore_fpx_registers(int pid, unsigned long *fp_regs) | 34 | int restore_fpx_registers(int pid, unsigned long *fp_regs) |
33 | { | 35 | { |
34 | if(ptrace(PTRACE_SETFPXREGS, pid, 0, fp_regs) < 0) | 36 | if (ptrace(PTRACE_SETFPXREGS, pid, 0, fp_regs) < 0) |
35 | return -errno; | 37 | return -errno; |
36 | return 0; | 38 | return 0; |
37 | } | 39 | } |
38 | 40 | ||
39 | unsigned long get_thread_reg(int reg, jmp_buf *buf) | 41 | unsigned long get_thread_reg(int reg, jmp_buf *buf) |
40 | { | 42 | { |
41 | switch(reg){ | 43 | switch (reg) { |
42 | case EIP: return buf[0]->__eip; | 44 | case EIP: |
43 | case UESP: return buf[0]->__esp; | 45 | return buf[0]->__eip; |
44 | case EBP: return buf[0]->__ebp; | 46 | case UESP: |
47 | return buf[0]->__esp; | ||
48 | case EBP: | ||
49 | return buf[0]->__ebp; | ||
45 | default: | 50 | default: |
46 | printk("get_thread_regs - unknown register %d\n", reg); | 51 | printk(UM_KERN_ERR "get_thread_regs - unknown register %d\n", |
52 | reg); | ||
47 | return 0; | 53 | return 0; |
48 | } | 54 | } |
49 | } | 55 | } |
diff --git a/arch/um/sys-i386/Makefile b/arch/um/sys-i386/Makefile index 9468cf364843..964dc1a04c37 100644 --- a/arch/um/sys-i386/Makefile +++ b/arch/um/sys-i386/Makefile | |||
@@ -3,14 +3,14 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y = bug.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \ | 5 | obj-y = bug.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \ |
6 | ptrace_user.o setjmp.o signal.o sigcontext.o stub.o stub_segv.o \ | 6 | ptrace_user.o setjmp.o signal.o stub.o stub_segv.o syscalls.o sysrq.o \ |
7 | syscalls.o sysrq.o sys_call_table.o tls.o | 7 | sys_call_table.o tls.o |
8 | 8 | ||
9 | subarch-obj-y = lib/bitops_32.o lib/semaphore_32.o lib/string_32.o | 9 | subarch-obj-y = lib/bitops_32.o lib/semaphore_32.o lib/string_32.o |
10 | subarch-obj-$(CONFIG_HIGHMEM) += mm/highmem_32.o | 10 | subarch-obj-$(CONFIG_HIGHMEM) += mm/highmem_32.o |
11 | subarch-obj-$(CONFIG_MODULES) += kernel/module_32.o | 11 | subarch-obj-$(CONFIG_MODULES) += kernel/module_32.o |
12 | 12 | ||
13 | USER_OBJS := bugs.o ptrace_user.o sigcontext.o fault.o | 13 | USER_OBJS := bugs.o ptrace_user.o fault.o |
14 | 14 | ||
15 | USER_OBJS += user-offsets.s | 15 | USER_OBJS += user-offsets.s |
16 | extra-y += user-offsets.s | 16 | extra-y += user-offsets.s |
diff --git a/arch/um/sys-i386/sigcontext.c b/arch/um/sys-i386/sigcontext.c deleted file mode 100644 index 467d489c31cd..000000000000 --- a/arch/um/sys-i386/sigcontext.c +++ /dev/null | |||
@@ -1,71 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) | ||
3 | * Licensed under the GPL | ||
4 | */ | ||
5 | |||
6 | #include <stddef.h> | ||
7 | #include <string.h> | ||
8 | #include <asm/ptrace.h> | ||
9 | #include <asm/sigcontext.h> | ||
10 | #include "sysdep/ptrace.h" | ||
11 | #include "kern_util.h" | ||
12 | |||
13 | void sc_to_sc(void *to_ptr, void *from_ptr) | ||
14 | { | ||
15 | struct sigcontext *to = to_ptr, *from = from_ptr; | ||
16 | |||
17 | memcpy(to, from, sizeof(*to) + sizeof(struct _fpstate)); | ||
18 | if(from->fpstate != NULL) | ||
19 | to->fpstate = (struct _fpstate *) (to + 1); | ||
20 | } | ||
21 | |||
22 | unsigned long *sc_sigmask(void *sc_ptr) | ||
23 | { | ||
24 | struct sigcontext *sc = sc_ptr; | ||
25 | return &sc->oldmask; | ||
26 | } | ||
27 | |||
28 | int sc_get_fpregs(unsigned long buf, void *sc_ptr) | ||
29 | { | ||
30 | struct sigcontext *sc = sc_ptr; | ||
31 | struct _fpstate *from = sc->fpstate, *to = (struct _fpstate *) buf; | ||
32 | int err = 0; | ||
33 | |||
34 | if(from == NULL){ | ||
35 | err |= clear_user_proc(&to->cw, sizeof(to->cw)); | ||
36 | err |= clear_user_proc(&to->sw, sizeof(to->sw)); | ||
37 | err |= clear_user_proc(&to->tag, sizeof(to->tag)); | ||
38 | err |= clear_user_proc(&to->ipoff, sizeof(to->ipoff)); | ||
39 | err |= clear_user_proc(&to->cssel, sizeof(to->cssel)); | ||
40 | err |= clear_user_proc(&to->dataoff, sizeof(to->dataoff)); | ||
41 | err |= clear_user_proc(&to->datasel, sizeof(to->datasel)); | ||
42 | err |= clear_user_proc(&to->_st, sizeof(to->_st)); | ||
43 | } | ||
44 | else { | ||
45 | err |= copy_to_user_proc(&to->cw, &from->cw, sizeof(to->cw)); | ||
46 | err |= copy_to_user_proc(&to->sw, &from->sw, sizeof(to->sw)); | ||
47 | err |= copy_to_user_proc(&to->tag, &from->tag, | ||
48 | sizeof(to->tag)); | ||
49 | err |= copy_to_user_proc(&to->ipoff, &from->ipoff, | ||
50 | sizeof(to->ipoff)); | ||
51 | err |= copy_to_user_proc(&to->cssel,& from->cssel, | ||
52 | sizeof(to->cssel)); | ||
53 | err |= copy_to_user_proc(&to->dataoff, &from->dataoff, | ||
54 | sizeof(to->dataoff)); | ||
55 | err |= copy_to_user_proc(&to->datasel, &from->datasel, | ||
56 | sizeof(to->datasel)); | ||
57 | err |= copy_to_user_proc(to->_st, from->_st, sizeof(to->_st)); | ||
58 | } | ||
59 | return(err); | ||
60 | } | ||
61 | |||
62 | /* | ||
63 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
64 | * Emacs will notice this stuff at the end of the file and automatically | ||
65 | * adjust the settings for this buffer only. This must remain at the end | ||
66 | * of the file. | ||
67 | * --------------------------------------------------------------------------- | ||
68 | * Local variables: | ||
69 | * c-file-style: "linux" | ||
70 | * End: | ||
71 | */ | ||
diff --git a/arch/um/sys-x86_64/Makefile b/arch/um/sys-x86_64/Makefile index 002bb020f96a..3c22de532088 100644 --- a/arch/um/sys-x86_64/Makefile +++ b/arch/um/sys-x86_64/Makefile | |||
@@ -5,8 +5,8 @@ | |||
5 | # | 5 | # |
6 | 6 | ||
7 | obj-y = bug.o bugs.o delay.o fault.o ldt.o mem.o ptrace.o ptrace_user.o \ | 7 | obj-y = bug.o bugs.o delay.o fault.o ldt.o mem.o ptrace.o ptrace_user.o \ |
8 | setjmp.o sigcontext.o signal.o stub.o stub_segv.o syscalls.o \ | 8 | setjmp.o signal.o stub.o stub_segv.o syscalls.o syscall_table.o \ |
9 | syscall_table.o sysrq.o ksyms.o tls.o | 9 | sysrq.o ksyms.o tls.o |
10 | 10 | ||
11 | obj-$(CONFIG_MODULES) += um_module.o | 11 | obj-$(CONFIG_MODULES) += um_module.o |
12 | 12 | ||
@@ -15,7 +15,7 @@ subarch-obj-$(CONFIG_MODULES) += kernel/module_64.o | |||
15 | 15 | ||
16 | ldt-y = ../sys-i386/ldt.o | 16 | ldt-y = ../sys-i386/ldt.o |
17 | 17 | ||
18 | USER_OBJS := ptrace_user.o sigcontext.o | 18 | USER_OBJS := ptrace_user.o |
19 | 19 | ||
20 | USER_OBJS += user-offsets.s | 20 | USER_OBJS += user-offsets.s |
21 | extra-y += user-offsets.s | 21 | extra-y += user-offsets.s |
diff --git a/arch/um/sys-x86_64/ptrace.c b/arch/um/sys-x86_64/ptrace.c index b9032992a997..a3cfeed17af4 100644 --- a/arch/um/sys-x86_64/ptrace.c +++ b/arch/um/sys-x86_64/ptrace.c | |||
@@ -1,5 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright 2003 PathScale, Inc. | 2 | * Copyright 2003 PathScale, Inc. |
3 | * Copyright (C) 2003 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | ||
3 | * | 4 | * |
4 | * Licensed under the GPL | 5 | * Licensed under the GPL |
5 | */ | 6 | */ |
@@ -12,17 +13,10 @@ | |||
12 | #include <asm/uaccess.h> | 13 | #include <asm/uaccess.h> |
13 | #include <asm/elf.h> | 14 | #include <asm/elf.h> |
14 | 15 | ||
15 | /* XXX x86_64 */ | 16 | /* |
16 | unsigned long not_ss; | 17 | * determines which flags the user has access to. |
17 | unsigned long not_ds; | 18 | * 1 = access 0 = no access |
18 | unsigned long not_es; | 19 | */ |
19 | |||
20 | #define SC_SS(r) (not_ss) | ||
21 | #define SC_DS(r) (not_ds) | ||
22 | #define SC_ES(r) (not_es) | ||
23 | |||
24 | /* determines which flags the user has access to. */ | ||
25 | /* 1 = access 0 = no access */ | ||
26 | #define FLAG_MASK 0x44dd5UL | 20 | #define FLAG_MASK 0x44dd5UL |
27 | 21 | ||
28 | int putreg(struct task_struct *child, int regno, unsigned long value) | 22 | int putreg(struct task_struct *child, int regno, unsigned long value) |
@@ -66,20 +60,21 @@ int putreg(struct task_struct *child, int regno, unsigned long value) | |||
66 | 60 | ||
67 | int poke_user(struct task_struct *child, long addr, long data) | 61 | int poke_user(struct task_struct *child, long addr, long data) |
68 | { | 62 | { |
69 | if ((addr & 3) || addr < 0) | 63 | if ((addr & 3) || addr < 0) |
70 | return -EIO; | 64 | return -EIO; |
71 | 65 | ||
72 | if (addr < MAX_REG_OFFSET) | 66 | if (addr < MAX_REG_OFFSET) |
73 | return putreg(child, addr, data); | 67 | return putreg(child, addr, data); |
74 | else if((addr >= offsetof(struct user, u_debugreg[0])) && | 68 | else if ((addr >= offsetof(struct user, u_debugreg[0])) && |
75 | (addr <= offsetof(struct user, u_debugreg[7]))){ | 69 | (addr <= offsetof(struct user, u_debugreg[7]))){ |
76 | addr -= offsetof(struct user, u_debugreg[0]); | 70 | addr -= offsetof(struct user, u_debugreg[0]); |
77 | addr = addr >> 2; | 71 | addr = addr >> 2; |
78 | if((addr == 4) || (addr == 5)) return -EIO; | 72 | if ((addr == 4) || (addr == 5)) |
79 | child->thread.arch.debugregs[addr] = data; | 73 | return -EIO; |
80 | return 0; | 74 | child->thread.arch.debugregs[addr] = data; |
81 | } | 75 | return 0; |
82 | return -EIO; | 76 | } |
77 | return -EIO; | ||
83 | } | 78 | } |
84 | 79 | ||
85 | unsigned long getreg(struct task_struct *child, int regno) | 80 | unsigned long getreg(struct task_struct *child, int regno) |
@@ -107,29 +102,22 @@ unsigned long getreg(struct task_struct *child, int regno) | |||
107 | int peek_user(struct task_struct *child, long addr, long data) | 102 | int peek_user(struct task_struct *child, long addr, long data) |
108 | { | 103 | { |
109 | /* read the word at location addr in the USER area. */ | 104 | /* read the word at location addr in the USER area. */ |
110 | unsigned long tmp; | 105 | unsigned long tmp; |
111 | |||
112 | if ((addr & 3) || addr < 0) | ||
113 | return -EIO; | ||
114 | |||
115 | tmp = 0; /* Default return condition */ | ||
116 | if(addr < MAX_REG_OFFSET){ | ||
117 | tmp = getreg(child, addr); | ||
118 | } | ||
119 | else if((addr >= offsetof(struct user, u_debugreg[0])) && | ||
120 | (addr <= offsetof(struct user, u_debugreg[7]))){ | ||
121 | addr -= offsetof(struct user, u_debugreg[0]); | ||
122 | addr = addr >> 2; | ||
123 | tmp = child->thread.arch.debugregs[addr]; | ||
124 | } | ||
125 | return put_user(tmp, (unsigned long *) data); | ||
126 | } | ||
127 | 106 | ||
128 | void arch_switch(void) | 107 | if ((addr & 3) || addr < 0) |
129 | { | 108 | return -EIO; |
130 | /* XXX | 109 | |
131 | printk("arch_switch\n"); | 110 | tmp = 0; /* Default return condition */ |
132 | */ | 111 | if (addr < MAX_REG_OFFSET){ |
112 | tmp = getreg(child, addr); | ||
113 | } | ||
114 | else if ((addr >= offsetof(struct user, u_debugreg[0])) && | ||
115 | (addr <= offsetof(struct user, u_debugreg[7]))){ | ||
116 | addr -= offsetof(struct user, u_debugreg[0]); | ||
117 | addr = addr >> 2; | ||
118 | tmp = child->thread.arch.debugregs[addr]; | ||
119 | } | ||
120 | return put_user(tmp, (unsigned long *) data); | ||
133 | } | 121 | } |
134 | 122 | ||
135 | /* XXX Mostly copied from sys-i386 */ | 123 | /* XXX Mostly copied from sys-i386 */ |
@@ -139,21 +127,21 @@ int is_syscall(unsigned long addr) | |||
139 | int n; | 127 | int n; |
140 | 128 | ||
141 | n = copy_from_user(&instr, (void __user *) addr, sizeof(instr)); | 129 | n = copy_from_user(&instr, (void __user *) addr, sizeof(instr)); |
142 | if(n){ | 130 | if (n){ |
143 | /* access_process_vm() grants access to vsyscall and stub, | 131 | /* access_process_vm() grants access to vsyscall and stub, |
144 | * while copy_from_user doesn't. Maybe access_process_vm is | 132 | * while copy_from_user doesn't. Maybe access_process_vm is |
145 | * slow, but that doesn't matter, since it will be called only | 133 | * slow, but that doesn't matter, since it will be called only |
146 | * in case of singlestepping, if copy_from_user failed. | 134 | * in case of singlestepping, if copy_from_user failed. |
147 | */ | 135 | */ |
148 | n = access_process_vm(current, addr, &instr, sizeof(instr), 0); | 136 | n = access_process_vm(current, addr, &instr, sizeof(instr), 0); |
149 | if(n != sizeof(instr)) { | 137 | if (n != sizeof(instr)) { |
150 | printk("is_syscall : failed to read instruction from " | 138 | printk("is_syscall : failed to read instruction from " |
151 | "0x%lx\n", addr); | 139 | "0x%lx\n", addr); |
152 | return(1); | 140 | return 1; |
153 | } | 141 | } |
154 | } | 142 | } |
155 | /* sysenter */ | 143 | /* sysenter */ |
156 | return(instr == 0x050f); | 144 | return instr == 0x050f; |
157 | } | 145 | } |
158 | 146 | ||
159 | int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) | 147 | int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) |
@@ -204,14 +192,3 @@ long subarch_ptrace(struct task_struct *child, long request, long addr, | |||
204 | 192 | ||
205 | return ret; | 193 | return ret; |
206 | } | 194 | } |
207 | |||
208 | /* | ||
209 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
210 | * Emacs will notice this stuff at the end of the file and automatically | ||
211 | * adjust the settings for this buffer only. This must remain at the end | ||
212 | * of the file. | ||
213 | * --------------------------------------------------------------------------- | ||
214 | * Local variables: | ||
215 | * c-file-style: "linux" | ||
216 | * End: | ||
217 | */ | ||
diff --git a/arch/um/sys-x86_64/sigcontext.c b/arch/um/sys-x86_64/sigcontext.c deleted file mode 100644 index c88e64def6f2..000000000000 --- a/arch/um/sys-x86_64/sigcontext.c +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright 2003 PathScale, Inc. | ||
3 | * | ||
4 | * Licensed under the GPL | ||
5 | */ | ||
6 | |||
7 | #include <stdio.h> | ||
8 | #include <string.h> | ||
9 | #include <signal.h> | ||
10 | #include "user.h" | ||
11 | |||
12 | void sc_to_sc(void *to_ptr, void *from_ptr) | ||
13 | { | ||
14 | struct sigcontext *to = to_ptr, *from = from_ptr; | ||
15 | int size = sizeof(*to); /* + sizeof(struct _fpstate); */ | ||
16 | |||
17 | memcpy(to, from, size); | ||
18 | if(from->fpstate != NULL) | ||
19 | to->fpstate = (struct _fpstate *) (to + 1); | ||
20 | |||
21 | to->fpstate = NULL; | ||
22 | } | ||
23 | |||
24 | unsigned long *sc_sigmask(void *sc_ptr) | ||
25 | { | ||
26 | struct sigcontext *sc = sc_ptr; | ||
27 | |||
28 | return(&sc->oldmask); | ||
29 | } | ||
30 | |||
31 | /* Overrides for Emacs so that we follow Linus's tabbing style. | ||
32 | * Emacs will notice this stuff at the end of the file and automatically | ||
33 | * adjust the settings for this buffer only. This must remain at the end | ||
34 | * of the file. | ||
35 | * --------------------------------------------------------------------------- | ||
36 | * Local variables: | ||
37 | * c-file-style: "linux" | ||
38 | * End: | ||
39 | */ | ||
diff --git a/arch/um/sys-x86_64/signal.c b/arch/um/sys-x86_64/signal.c index a8e5fd7b2adb..1778d33808f4 100644 --- a/arch/um/sys-x86_64/signal.c +++ b/arch/um/sys-x86_64/signal.c | |||
@@ -1,5 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2003 PathScale, Inc. | 2 | * Copyright (C) 2003 PathScale, Inc. |
3 | * Copyright (C) 2003 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) | ||
3 | * Licensed under the GPL | 4 | * Licensed under the GPL |
4 | */ | 5 | */ |
5 | 6 | ||
@@ -110,7 +111,8 @@ static int copy_sc_to_user(struct sigcontext __user *to, | |||
110 | err |= PUTREG(regs, RDI, to, rdi); | 111 | err |= PUTREG(regs, RDI, to, rdi); |
111 | err |= PUTREG(regs, RSI, to, rsi); | 112 | err |= PUTREG(regs, RSI, to, rsi); |
112 | err |= PUTREG(regs, RBP, to, rbp); | 113 | err |= PUTREG(regs, RBP, to, rbp); |
113 | /* Must use orignal RSP, which is passed in, rather than what's in | 114 | /* |
115 | * Must use orignal RSP, which is passed in, rather than what's in | ||
114 | * the pt_regs, because that's already been updated to point at the | 116 | * the pt_regs, because that's already been updated to point at the |
115 | * signal frame. | 117 | * signal frame. |
116 | */ | 118 | */ |
@@ -152,7 +154,7 @@ static int copy_sc_to_user(struct sigcontext __user *to, | |||
152 | if (copy_to_user(to_fp, &fp, sizeof(struct user_i387_struct))) | 154 | if (copy_to_user(to_fp, &fp, sizeof(struct user_i387_struct))) |
153 | return 1; | 155 | return 1; |
154 | 156 | ||
155 | return(err); | 157 | return err; |
156 | } | 158 | } |
157 | 159 | ||
158 | struct rt_sigframe | 160 | struct rt_sigframe |
@@ -188,7 +190,8 @@ int setup_signal_stack_si(unsigned long stack_top, int sig, | |||
188 | goto out; | 190 | goto out; |
189 | } | 191 | } |
190 | 192 | ||
191 | /* Update SP now because the page fault handler refuses to extend | 193 | /* |
194 | * Update SP now because the page fault handler refuses to extend | ||
192 | * the stack if the faulting address is too far below the current | 195 | * the stack if the faulting address is too far below the current |
193 | * SP, which frame now certainly is. If there's an error, the original | 196 | * SP, which frame now certainly is. If there's an error, the original |
194 | * value is restored on the way out. | 197 | * value is restored on the way out. |
@@ -216,8 +219,10 @@ int setup_signal_stack_si(unsigned long stack_top, int sig, | |||
216 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, | 219 | err |= __copy_to_user(&frame->uc.uc_sigmask, set, |
217 | sizeof(*set)); | 220 | sizeof(*set)); |
218 | 221 | ||
219 | /* Set up to return from userspace. If provided, use a stub | 222 | /* |
220 | already in userspace. */ | 223 | * Set up to return from userspace. If provided, use a stub |
224 | * already in userspace. | ||
225 | */ | ||
221 | /* x86-64 should always use SA_RESTORER. */ | 226 | /* x86-64 should always use SA_RESTORER. */ |
222 | if (ka->sa.sa_flags & SA_RESTORER) | 227 | if (ka->sa.sa_flags & SA_RESTORER) |
223 | err |= __put_user(ka->sa.sa_restorer, &frame->pretcode); | 228 | err |= __put_user(ka->sa.sa_restorer, &frame->pretcode); |
@@ -239,8 +244,10 @@ int setup_signal_stack_si(unsigned long stack_top, int sig, | |||
239 | /* In case the signal handler was declared without prototypes */ | 244 | /* In case the signal handler was declared without prototypes */ |
240 | PT_REGS_RAX(regs) = 0; | 245 | PT_REGS_RAX(regs) = 0; |
241 | 246 | ||
242 | /* This also works for non SA_SIGINFO handlers because they expect the | 247 | /* |
243 | next argument after the signal number on the stack. */ | 248 | * This also works for non SA_SIGINFO handlers because they expect the |
249 | * next argument after the signal number on the stack. | ||
250 | */ | ||
244 | PT_REGS_RSI(regs) = (unsigned long) &frame->info; | 251 | PT_REGS_RSI(regs) = (unsigned long) &frame->info; |
245 | PT_REGS_RDX(regs) = (unsigned long) &frame->uc; | 252 | PT_REGS_RDX(regs) = (unsigned long) &frame->uc; |
246 | PT_REGS_RIP(regs) = (unsigned long) ka->sa.sa_handler; | 253 | PT_REGS_RIP(regs) = (unsigned long) ka->sa.sa_handler; |
@@ -276,7 +283,7 @@ long sys_rt_sigreturn(struct pt_regs *regs) | |||
276 | 283 | ||
277 | /* Avoid ERESTART handling */ | 284 | /* Avoid ERESTART handling */ |
278 | PT_REGS_SYSCALL_NR(¤t->thread.regs) = -1; | 285 | PT_REGS_SYSCALL_NR(¤t->thread.regs) = -1; |
279 | return(PT_REGS_SYSCALL_RET(¤t->thread.regs)); | 286 | return PT_REGS_SYSCALL_RET(¤t->thread.regs); |
280 | 287 | ||
281 | segfault: | 288 | segfault: |
282 | force_sig(SIGSEGV, current); | 289 | force_sig(SIGSEGV, current); |