aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/sys-x86_64
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2007-10-16 04:27:00 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:43:05 -0400
commitba180fd437156f7fd8cfb2fdd021d949eeef08d6 (patch)
treeb9f38b9cdd7a5b1aacf00341d1948314663c5871 /arch/um/sys-x86_64
parent77bf4400319db9d2a8af6b00c2be6faa0f3d07cb (diff)
uml: style fixes pass 3
Formatting changes in the files which have been changed in the course of folding foo_skas functions into their callers. These include: copyright updates header file trimming style fixes adding severity to printks These changes should be entirely non-functional. 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/fault.c7
-rw-r--r--arch/um/sys-x86_64/signal.c149
-rw-r--r--arch/um/sys-x86_64/syscalls.c66
-rw-r--r--arch/um/sys-x86_64/tls.c2
4 files changed, 104 insertions, 120 deletions
diff --git a/arch/um/sys-x86_64/fault.c b/arch/um/sys-x86_64/fault.c
index 79f37ef3dceb..ce85117fc64e 100644
--- a/arch/um/sys-x86_64/fault.c
+++ b/arch/um/sys-x86_64/fault.c
@@ -14,14 +14,15 @@ struct exception_table_entry
14}; 14};
15 15
16const struct exception_table_entry *search_exception_tables(unsigned long add); 16const struct exception_table_entry *search_exception_tables(unsigned long add);
17
17int arch_fixup(unsigned long address, struct uml_pt_regs *regs) 18int arch_fixup(unsigned long address, struct uml_pt_regs *regs)
18{ 19{
19 const struct exception_table_entry *fixup; 20 const struct exception_table_entry *fixup;
20 21
21 fixup = search_exception_tables(address); 22 fixup = search_exception_tables(address);
22 if(fixup != 0){ 23 if (fixup != 0) {
23 UPT_IP(regs) = fixup->fixup; 24 UPT_IP(regs) = fixup->fixup;
24 return(1); 25 return 1;
25 } 26 }
26 return(0); 27 return 0;
27} 28}
diff --git a/arch/um/sys-x86_64/signal.c b/arch/um/sys-x86_64/signal.c
index a06d66d0c409..9001d17fc3d8 100644
--- a/arch/um/sys-x86_64/signal.c
+++ b/arch/um/sys-x86_64/signal.c
@@ -3,16 +3,11 @@
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/stddef.h"
7#include "linux/errno.h"
8#include "linux/personality.h" 6#include "linux/personality.h"
9#include "linux/ptrace.h" 7#include "linux/ptrace.h"
10#include "asm/current.h" 8#include "asm/unistd.h"
11#include "asm/uaccess.h" 9#include "asm/uaccess.h"
12#include "asm/sigcontext.h" 10#include "asm/ucontext.h"
13#include "asm/ptrace.h"
14#include "asm/arch/ucontext.h"
15#include "sysdep/ptrace.h"
16#include "frame_kern.h" 11#include "frame_kern.h"
17#include "skas.h" 12#include "skas.h"
18 13
@@ -20,28 +15,28 @@ void copy_sc(struct uml_pt_regs *regs, void *from)
20{ 15{
21 struct sigcontext *sc = from; 16 struct sigcontext *sc = from;
22 17
23#define GETREG(regs, regno, sc, regname) \ 18#define GETREG(regs, regno, sc, regname) \
24 (regs)->regs[(regno) / sizeof(unsigned long)] = (sc)->regname 19 (regs)->regs[(regno) / sizeof(unsigned long)] = (sc)->regname
25 20
26 GETREG(regs, R8, sc, r8); 21 GETREG(regs, R8, sc, r8);
27 GETREG(regs, R9, sc, r9); 22 GETREG(regs, R9, sc, r9);
28 GETREG(regs, R10, sc, r10); 23 GETREG(regs, R10, sc, r10);
29 GETREG(regs, R11, sc, r11); 24 GETREG(regs, R11, sc, r11);
30 GETREG(regs, R12, sc, r12); 25 GETREG(regs, R12, sc, r12);
31 GETREG(regs, R13, sc, r13); 26 GETREG(regs, R13, sc, r13);
32 GETREG(regs, R14, sc, r14); 27 GETREG(regs, R14, sc, r14);
33 GETREG(regs, R15, sc, r15); 28 GETREG(regs, R15, sc, r15);
34 GETREG(regs, RDI, sc, rdi); 29 GETREG(regs, RDI, sc, rdi);
35 GETREG(regs, RSI, sc, rsi); 30 GETREG(regs, RSI, sc, rsi);
36 GETREG(regs, RBP, sc, rbp); 31 GETREG(regs, RBP, sc, rbp);
37 GETREG(regs, RBX, sc, rbx); 32 GETREG(regs, RBX, sc, rbx);
38 GETREG(regs, RDX, sc, rdx); 33 GETREG(regs, RDX, sc, rdx);
39 GETREG(regs, RAX, sc, rax); 34 GETREG(regs, RAX, sc, rax);
40 GETREG(regs, RCX, sc, rcx); 35 GETREG(regs, RCX, sc, rcx);
41 GETREG(regs, RSP, sc, rsp); 36 GETREG(regs, RSP, sc, rsp);
42 GETREG(regs, RIP, sc, rip); 37 GETREG(regs, RIP, sc, rip);
43 GETREG(regs, EFLAGS, sc, eflags); 38 GETREG(regs, EFLAGS, sc, eflags);
44 GETREG(regs, CS, sc, cs); 39 GETREG(regs, CS, sc, cs);
45 40
46#undef GETREG 41#undef GETREG
47} 42}
@@ -49,58 +44,58 @@ void copy_sc(struct uml_pt_regs *regs, void *from)
49static int copy_sc_from_user(struct pt_regs *regs, 44static int copy_sc_from_user(struct pt_regs *regs,
50 struct sigcontext __user *from) 45 struct sigcontext __user *from)
51{ 46{
52 int err = 0; 47 int err = 0;
53 48
54#define GETREG(regs, regno, sc, regname) \ 49#define GETREG(regs, regno, sc, regname) \
55 __get_user((regs)->regs.regs[(regno) / sizeof(unsigned long)], \ 50 __get_user((regs)->regs.regs[(regno) / sizeof(unsigned long)], \
56 &(sc)->regname) 51 &(sc)->regname)
57 52
58 err |= GETREG(regs, R8, from, r8); 53 err |= GETREG(regs, R8, from, r8);
59 err |= GETREG(regs, R9, from, r9); 54 err |= GETREG(regs, R9, from, r9);
60 err |= GETREG(regs, R10, from, r10); 55 err |= GETREG(regs, R10, from, r10);
61 err |= GETREG(regs, R11, from, r11); 56 err |= GETREG(regs, R11, from, r11);
62 err |= GETREG(regs, R12, from, r12); 57 err |= GETREG(regs, R12, from, r12);
63 err |= GETREG(regs, R13, from, r13); 58 err |= GETREG(regs, R13, from, r13);
64 err |= GETREG(regs, R14, from, r14); 59 err |= GETREG(regs, R14, from, r14);
65 err |= GETREG(regs, R15, from, r15); 60 err |= GETREG(regs, R15, from, r15);
66 err |= GETREG(regs, RDI, from, rdi); 61 err |= GETREG(regs, RDI, from, rdi);
67 err |= GETREG(regs, RSI, from, rsi); 62 err |= GETREG(regs, RSI, from, rsi);
68 err |= GETREG(regs, RBP, from, rbp); 63 err |= GETREG(regs, RBP, from, rbp);
69 err |= GETREG(regs, RBX, from, rbx); 64 err |= GETREG(regs, RBX, from, rbx);
70 err |= GETREG(regs, RDX, from, rdx); 65 err |= GETREG(regs, RDX, from, rdx);
71 err |= GETREG(regs, RAX, from, rax); 66 err |= GETREG(regs, RAX, from, rax);
72 err |= GETREG(regs, RCX, from, rcx); 67 err |= GETREG(regs, RCX, from, rcx);
73 err |= GETREG(regs, RSP, from, rsp); 68 err |= GETREG(regs, RSP, from, rsp);
74 err |= GETREG(regs, RIP, from, rip); 69 err |= GETREG(regs, RIP, from, rip);
75 err |= GETREG(regs, EFLAGS, from, eflags); 70 err |= GETREG(regs, EFLAGS, from, eflags);
76 err |= GETREG(regs, CS, from, cs); 71 err |= GETREG(regs, CS, from, cs);
77 72
78#undef GETREG 73#undef GETREG
79 74
80 return err; 75 return err;
81} 76}
82 77
83static int copy_sc_to_user(struct sigcontext __user *to, 78static int copy_sc_to_user(struct sigcontext __user *to,
84 struct _fpstate __user *to_fp, struct pt_regs *regs, 79 struct _fpstate __user *to_fp, struct pt_regs *regs,
85 unsigned long mask, unsigned long sp) 80 unsigned long mask, unsigned long sp)
86{ 81{
87 struct faultinfo * fi = &current->thread.arch.faultinfo; 82 struct faultinfo * fi = &current->thread.arch.faultinfo;
88 int err = 0; 83 int err = 0;
89 84
90 err |= __put_user(0, &to->gs); 85 err |= __put_user(0, &to->gs);
91 err |= __put_user(0, &to->fs); 86 err |= __put_user(0, &to->fs);
92 87
93#define PUTREG(regs, regno, sc, regname) \ 88#define PUTREG(regs, regno, sc, regname) \
94 __put_user((regs)->regs.regs[(regno) / sizeof(unsigned long)], \ 89 __put_user((regs)->regs.regs[(regno) / sizeof(unsigned long)], \
95 &(sc)->regname) 90 &(sc)->regname)
96 91
97 err |= PUTREG(regs, RDI, to, rdi); 92 err |= PUTREG(regs, RDI, to, rdi);
98 err |= PUTREG(regs, RSI, to, rsi); 93 err |= PUTREG(regs, RSI, to, rsi);
99 err |= PUTREG(regs, RBP, to, rbp); 94 err |= PUTREG(regs, RBP, to, rbp);
100 /* Must use orignal RSP, which is passed in, rather than what's in 95 /* Must use orignal RSP, which is passed in, rather than what's in
101 * the pt_regs, because that's already been updated to point at the 96 * the pt_regs, because that's already been updated to point at the
102 * signal frame. 97 * signal frame.
103 */ 98 */
104 err |= __put_user(sp, &to->rsp); 99 err |= __put_user(sp, &to->rsp);
105 err |= PUTREG(regs, RBX, to, rbx); 100 err |= PUTREG(regs, RBX, to, rbx);
106 err |= PUTREG(regs, RDX, to, rdx); 101 err |= PUTREG(regs, RDX, to, rdx);
@@ -116,9 +111,9 @@ static int copy_sc_to_user(struct sigcontext __user *to,
116 err |= PUTREG(regs, R15, to, r15); 111 err |= PUTREG(regs, R15, to, r15);
117 err |= PUTREG(regs, CS, to, cs); /* XXX x86_64 doesn't do this */ 112 err |= PUTREG(regs, CS, to, cs); /* XXX x86_64 doesn't do this */
118 113
119 err |= __put_user(fi->cr2, &to->cr2); 114 err |= __put_user(fi->cr2, &to->cr2);
120 err |= __put_user(fi->error_code, &to->err); 115 err |= __put_user(fi->error_code, &to->err);
121 err |= __put_user(fi->trap_no, &to->trapno); 116 err |= __put_user(fi->trap_no, &to->trapno);
122 117
123 err |= PUTREG(regs, RIP, to, rip); 118 err |= PUTREG(regs, RIP, to, rip);
124 err |= PUTREG(regs, EFLAGS, to, eflags); 119 err |= PUTREG(regs, EFLAGS, to, eflags);
@@ -131,9 +126,9 @@ static int copy_sc_to_user(struct sigcontext __user *to,
131 126
132struct rt_sigframe 127struct rt_sigframe
133{ 128{
134 char __user *pretcode; 129 char __user *pretcode;
135 struct ucontext uc; 130 struct ucontext uc;
136 struct siginfo info; 131 struct siginfo info;
137}; 132};
138 133
139#define round_down(m, n) (((m) / (n)) * (n)) 134#define round_down(m, n) (((m) / (n)) * (n))
@@ -151,7 +146,7 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
151 frame = (struct rt_sigframe __user *) 146 frame = (struct rt_sigframe __user *)
152 round_down(stack_top - sizeof(struct rt_sigframe), 16); 147 round_down(stack_top - sizeof(struct rt_sigframe), 16);
153 /* Subtract 128 for a red zone and 8 for proper alignment */ 148 /* Subtract 128 for a red zone and 8 for proper alignment */
154 frame = (struct rt_sigframe __user *) ((unsigned long) frame - 128 - 8); 149 frame = (struct rt_sigframe __user *) ((unsigned long) frame - 128 - 8);
155 150
156 if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate))) 151 if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate)))
157 goto out; 152 goto out;
@@ -241,7 +236,7 @@ long sys_rt_sigreturn(struct pt_regs *regs)
241 struct ucontext __user *uc = &frame->uc; 236 struct ucontext __user *uc = &frame->uc;
242 sigset_t set; 237 sigset_t set;
243 238
244 if(copy_from_user(&set, &uc->uc_sigmask, sizeof(set))) 239 if (copy_from_user(&set, &uc->uc_sigmask, sizeof(set)))
245 goto segfault; 240 goto segfault;
246 241
247 sigdelsetmask(&set, ~_BLOCKABLE); 242 sigdelsetmask(&set, ~_BLOCKABLE);
@@ -251,7 +246,7 @@ long sys_rt_sigreturn(struct pt_regs *regs)
251 recalc_sigpending(); 246 recalc_sigpending();
252 spin_unlock_irq(&current->sighand->siglock); 247 spin_unlock_irq(&current->sighand->siglock);
253 248
254 if(copy_sc_from_user(&current->thread.regs, &uc->uc_mcontext)) 249 if (copy_sc_from_user(&current->thread.regs, &uc->uc_mcontext))
255 goto segfault; 250 goto segfault;
256 251
257 /* Avoid ERESTART handling */ 252 /* Avoid ERESTART handling */
@@ -262,13 +257,3 @@ long sys_rt_sigreturn(struct pt_regs *regs)
262 force_sig(SIGSEGV, current); 257 force_sig(SIGSEGV, current);
263 return 0; 258 return 0;
264} 259}
265/*
266 * Overrides for Emacs so that we follow Linus's tabbing style.
267 * Emacs will notice this stuff at the end of the file and automatically
268 * adjust the settings for this buffer only. This must remain at the end
269 * of the file.
270 * ---------------------------------------------------------------------------
271 * Local variables:
272 * c-file-style: "linux"
273 * End:
274 */
diff --git a/arch/um/sys-x86_64/syscalls.c b/arch/um/sys-x86_64/syscalls.c
index bbcab773b23d..58ae06562b4a 100644
--- a/arch/um/sys-x86_64/syscalls.c
+++ b/arch/um/sys-x86_64/syscalls.c
@@ -1,36 +1,34 @@
1/* 1/*
2 * Copyright (C) 2003 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
2 * Copyright 2003 PathScale, Inc. 3 * Copyright 2003 PathScale, Inc.
3 * 4 *
4 * Licensed under the GPL 5 * Licensed under the GPL
5 */ 6 */
6 7
7#include "linux/linkage.h" 8#include "linux/linkage.h"
8#include "linux/slab.h"
9#include "linux/shm.h"
10#include "linux/utsname.h"
11#include "linux/personality.h" 9#include "linux/personality.h"
12#include "asm/uaccess.h" 10#include "linux/utsname.h"
13#define __FRAME_OFFSETS
14#include "asm/ptrace.h"
15#include "asm/unistd.h"
16#include "asm/prctl.h" /* XXX This should get the constants from libc */ 11#include "asm/prctl.h" /* XXX This should get the constants from libc */
17#include "kern.h" 12#include "asm/uaccess.h"
18#include "os.h" 13#include "os.h"
19 14
20asmlinkage long sys_uname64(struct new_utsname __user * name) 15asmlinkage long sys_uname64(struct new_utsname __user * name)
21{ 16{
22 int err; 17 int err;
18
23 down_read(&uts_sem); 19 down_read(&uts_sem);
24 err = copy_to_user(name, utsname(), sizeof (*name)); 20 err = copy_to_user(name, utsname(), sizeof (*name));
25 up_read(&uts_sem); 21 up_read(&uts_sem);
22
26 if (personality(current->personality) == PER_LINUX32) 23 if (personality(current->personality) == PER_LINUX32)
27 err |= copy_to_user(&name->machine, "i686", 5); 24 err |= copy_to_user(&name->machine, "i686", 5);
25
28 return err ? -EFAULT : 0; 26 return err ? -EFAULT : 0;
29} 27}
30 28
31long arch_prctl(struct task_struct *task, int code, unsigned long __user *addr) 29long arch_prctl(struct task_struct *task, int code, unsigned long __user *addr)
32{ 30{
33 unsigned long *ptr = addr, tmp; 31 unsigned long *ptr = addr, tmp;
34 long ret; 32 long ret;
35 int pid = task->mm->context.skas.id.u.pid; 33 int pid = task->mm->context.skas.id.u.pid;
36 34
@@ -47,42 +45,42 @@ long arch_prctl(struct task_struct *task, int code, unsigned long __user *addr)
47 * arch_prctl is run on the host, then the registers are read 45 * arch_prctl is run on the host, then the registers are read
48 * back. 46 * back.
49 */ 47 */
50 switch(code){ 48 switch (code) {
51 case ARCH_SET_FS: 49 case ARCH_SET_FS:
52 case ARCH_SET_GS: 50 case ARCH_SET_GS:
53 restore_registers(pid, &current->thread.regs.regs); 51 restore_registers(pid, &current->thread.regs.regs);
54 break; 52 break;
55 case ARCH_GET_FS: 53 case ARCH_GET_FS:
56 case ARCH_GET_GS: 54 case ARCH_GET_GS:
57 /* 55 /*
58 * With these two, we read to a local pointer and 56 * With these two, we read to a local pointer and
59 * put_user it to the userspace pointer that we were 57 * put_user it to the userspace pointer that we were
60 * given. If addr isn't valid (because it hasn't been 58 * given. If addr isn't valid (because it hasn't been
61 * faulted in or is just bogus), we want put_user to 59 * faulted in or is just bogus), we want put_user to
62 * fault it in (or return -EFAULT) instead of having 60 * fault it in (or return -EFAULT) instead of having
63 * the host return -EFAULT. 61 * the host return -EFAULT.
64 */ 62 */
65 ptr = &tmp; 63 ptr = &tmp;
66 } 64 }
67 65
68 ret = os_arch_prctl(pid, code, ptr); 66 ret = os_arch_prctl(pid, code, ptr);
69 if(ret) 67 if (ret)
70 return ret; 68 return ret;
71 69
72 switch(code){ 70 switch (code) {
73 case ARCH_SET_FS: 71 case ARCH_SET_FS:
74 current->thread.arch.fs = (unsigned long) ptr; 72 current->thread.arch.fs = (unsigned long) ptr;
75 save_registers(pid, &current->thread.regs.regs); 73 save_registers(pid, &current->thread.regs.regs);
76 break; 74 break;
77 case ARCH_SET_GS: 75 case ARCH_SET_GS:
78 save_registers(pid, &current->thread.regs.regs); 76 save_registers(pid, &current->thread.regs.regs);
79 break; 77 break;
80 case ARCH_GET_FS: 78 case ARCH_GET_FS:
81 ret = put_user(tmp, addr); 79 ret = put_user(tmp, addr);
82 break; 80 break;
83 case ARCH_GET_GS: 81 case ARCH_GET_GS:
84 ret = put_user(tmp, addr); 82 ret = put_user(tmp, addr);
85 break; 83 break;
86 } 84 }
87 85
88 return ret; 86 return ret;
@@ -109,8 +107,8 @@ long sys_clone(unsigned long clone_flags, unsigned long newsp,
109 107
110void arch_switch_to(struct task_struct *from, struct task_struct *to) 108void arch_switch_to(struct task_struct *from, struct task_struct *to)
111{ 109{
112 if((to->thread.arch.fs == 0) || (to->mm == NULL)) 110 if ((to->thread.arch.fs == 0) || (to->mm == NULL))
113 return; 111 return;
114 112
115 arch_prctl(to, ARCH_SET_FS, (void __user *) to->thread.arch.fs); 113 arch_prctl(to, ARCH_SET_FS, (void __user *) to->thread.arch.fs);
116} 114}
diff --git a/arch/um/sys-x86_64/tls.c b/arch/um/sys-x86_64/tls.c
index fcd5217c26a5..3bd19a51ad6b 100644
--- a/arch/um/sys-x86_64/tls.c
+++ b/arch/um/sys-x86_64/tls.c
@@ -13,5 +13,5 @@ int arch_copy_tls(struct task_struct *t)
13 */ 13 */
14 t->thread.arch.fs = t->thread.regs.regs.regs[R8 / sizeof(long)]; 14 t->thread.arch.fs = t->thread.regs.regs.regs[R8 / sizeof(long)];
15 15
16 return 0; 16 return 0;
17} 17}