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/sys-x86_64 | |
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/sys-x86_64')
-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 |
4 files changed, 57 insertions, 112 deletions
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); |