aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2007-10-16 04:27:05 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:43:05 -0400
commitfab95c55e3b94e219044dc7a558632d08c198771 (patch)
tree2ce8bf6eb52e66ee69a0b03cf9ad60310279524e
parent0a7675aa204ac2470bb06f562557978b03914a71 (diff)
uml: get rid of do_longjmp
do_longjmp used to be needed when UML didn't have its own implementation of setjmp and longjmp. They came from libc, and couldn't be called directly from kernel code, as the libc jmp_buf couldn't be imported there. do_longjmp was a userspace function which served to provide longjmp access to kernel code. This is gone, and a number of void * pointers can now be jmp_buf *. 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>
-rw-r--r--arch/um/include/os.h5
-rw-r--r--arch/um/include/um_uaccess.h4
-rw-r--r--arch/um/include/uml_uaccess.h24
-rw-r--r--arch/um/kernel/exec.c2
-rw-r--r--arch/um/kernel/mem.c2
-rw-r--r--arch/um/kernel/trap.c6
-rw-r--r--arch/um/kernel/uaccess.c2
-rw-r--r--arch/um/os-Linux/process.c2
-rw-r--r--arch/um/os-Linux/trap.c7
-rw-r--r--arch/um/os-Linux/uaccess.c2
-rw-r--r--include/asm-um/processor-generic.h4
11 files changed, 16 insertions, 44 deletions
diff --git a/arch/um/include/os.h b/arch/um/include/os.h
index 96f333cd560d..c704851d68b7 100644
--- a/arch/um/include/os.h
+++ b/arch/um/include/os.h
@@ -193,7 +193,7 @@ extern int os_getpid(void);
193extern int os_getpgrp(void); 193extern int os_getpgrp(void);
194 194
195extern void init_new_thread_signals(void); 195extern void init_new_thread_signals(void);
196extern int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr); 196extern int run_kernel_thread(int (*fn)(void *), void *arg, jmp_buf **jmp_ptr);
197 197
198extern int os_map_memory(void *virt, int fd, unsigned long long off, 198extern int os_map_memory(void *virt, int fd, unsigned long long off,
199 unsigned long len, int r, int w, int x); 199 unsigned long len, int r, int w, int x);
@@ -206,7 +206,7 @@ extern void os_flush_stdout(void);
206 206
207/* uaccess.c */ 207/* uaccess.c */
208extern unsigned long __do_user_copy(void *to, const void *from, int n, 208extern unsigned long __do_user_copy(void *to, const void *from, int n,
209 void **fault_addr, void **fault_catcher, 209 void **fault_addr, jmp_buf **fault_catcher,
210 void (*op)(void *to, const void *from, 210 void (*op)(void *to, const void *from,
211 int n), int *faulted_out); 211 int n), int *faulted_out);
212 212
@@ -240,7 +240,6 @@ extern int set_signals(int enable);
240 240
241/* trap.c */ 241/* trap.c */
242extern void os_fill_handlinfo(struct kern_handlers h); 242extern void os_fill_handlinfo(struct kern_handlers h);
243extern void do_longjmp(void *p, int val);
244 243
245/* util.c */ 244/* util.c */
246extern void stack_protections(unsigned long address); 245extern void stack_protections(unsigned long address);
diff --git a/arch/um/include/um_uaccess.h b/arch/um/include/um_uaccess.h
index 5ef311a1a394..fdfc06b85605 100644
--- a/arch/um/include/um_uaccess.h
+++ b/arch/um/include/um_uaccess.h
@@ -30,6 +30,10 @@
30extern int copy_from_user(void *to, const void __user *from, int n); 30extern int copy_from_user(void *to, const void __user *from, int n);
31extern int copy_to_user(void __user *to, const void *from, int n); 31extern int copy_to_user(void __user *to, const void *from, int n);
32 32
33extern int __do_copy_to_user(void *to, const void *from, int n,
34 void **fault_addr, jmp_buf **fault_catcher);
35extern void __do_copy(void *to, const void *from, int n);
36
33/* 37/*
34 * strncpy_from_user: - Copy a NUL terminated string from userspace. 38 * strncpy_from_user: - Copy a NUL terminated string from userspace.
35 * @dst: Destination address, in kernel space. This buffer must be at 39 * @dst: Destination address, in kernel space. This buffer must be at
diff --git a/arch/um/include/uml_uaccess.h b/arch/um/include/uml_uaccess.h
deleted file mode 100644
index c0df11d06f5e..000000000000
--- a/arch/um/include/uml_uaccess.h
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * Copyright (C) 2001 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __UML_UACCESS_H__
7#define __UML_UACCESS_H__
8
9extern int __do_copy_to_user(void *to, const void *from, int n,
10 void **fault_addr, void **fault_catcher);
11void __do_copy(void *to, const void *from, int n);
12
13#endif
14
15/*
16 * Overrides for Emacs so that we follow Linus's tabbing style.
17 * Emacs will notice this stuff at the end of the file and automatically
18 * adjust the settings for this buffer only. This must remain at the end
19 * of the file.
20 * ---------------------------------------------------------------------------
21 * Local variables:
22 * c-file-style: "linux"
23 * End:
24 */
diff --git a/arch/um/kernel/exec.c b/arch/um/kernel/exec.c
index 0d260567fd15..25c502617553 100644
--- a/arch/um/kernel/exec.c
+++ b/arch/um/kernel/exec.c
@@ -75,7 +75,7 @@ long um_execve(char *file, char __user *__user *argv, char __user *__user *env)
75 75
76 err = execve1(file, argv, env); 76 err = execve1(file, argv, env);
77 if (!err) 77 if (!err)
78 do_longjmp(current->thread.exec_buf, 1); 78 UML_LONGJMP(current->thread.exec_buf, 1);
79 return err; 79 return err;
80} 80}
81 81
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index d2b11f242698..8456397f5f4d 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -17,7 +17,7 @@
17#include "as-layout.h" 17#include "as-layout.h"
18#include "kern.h" 18#include "kern.h"
19#include "mem_user.h" 19#include "mem_user.h"
20#include "uml_uaccess.h" 20#include "um_uaccess.h"
21#include "os.h" 21#include "os.h"
22#include "linux/types.h" 22#include "linux/types.h"
23#include "linux/string.h" 23#include "linux/string.h"
diff --git a/arch/um/kernel/trap.c b/arch/um/kernel/trap.c
index eac63fb6183c..bd060551e619 100644
--- a/arch/um/kernel/trap.c
+++ b/arch/um/kernel/trap.c
@@ -149,7 +149,7 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user,
149 struct uml_pt_regs *regs) 149 struct uml_pt_regs *regs)
150{ 150{
151 struct siginfo si; 151 struct siginfo si;
152 void *catcher; 152 jmp_buf *catcher;
153 int err; 153 int err;
154 int is_write = FAULT_WRITE(fi); 154 int is_write = FAULT_WRITE(fi);
155 unsigned long address = FAULT_ADDRESS(fi); 155 unsigned long address = FAULT_ADDRESS(fi);
@@ -181,7 +181,7 @@ unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user,
181 return 0; 181 return 0;
182 else if (catcher != NULL) { 182 else if (catcher != NULL) {
183 current->thread.fault_addr = (void *) address; 183 current->thread.fault_addr = (void *) address;
184 do_longjmp(catcher, 1); 184 UML_LONGJMP(catcher, 1);
185 } 185 }
186 else if (current->thread.fault_addr != NULL) 186 else if (current->thread.fault_addr != NULL)
187 panic("fault_addr set but no fault catcher"); 187 panic("fault_addr set but no fault catcher");
@@ -233,7 +233,7 @@ void relay_signal(int sig, struct uml_pt_regs *regs)
233static void bus_handler(int sig, struct uml_pt_regs *regs) 233static void bus_handler(int sig, struct uml_pt_regs *regs)
234{ 234{
235 if (current->thread.fault_catcher != NULL) 235 if (current->thread.fault_catcher != NULL)
236 do_longjmp(current->thread.fault_catcher, 1); 236 UML_LONGJMP(current->thread.fault_catcher, 1);
237 else relay_signal(sig, regs); 237 else relay_signal(sig, regs);
238} 238}
239 239
diff --git a/arch/um/kernel/uaccess.c b/arch/um/kernel/uaccess.c
index 054e3de0784e..d7436aacd26f 100644
--- a/arch/um/kernel/uaccess.c
+++ b/arch/um/kernel/uaccess.c
@@ -18,7 +18,7 @@ void __do_copy(void *to, const void *from, int n)
18 18
19 19
20int __do_copy_to_user(void *to, const void *from, int n, 20int __do_copy_to_user(void *to, const void *from, int n,
21 void **fault_addr, void **fault_catcher) 21 void **fault_addr, jmp_buf **fault_catcher)
22{ 22{
23 unsigned long fault; 23 unsigned long fault;
24 int faulted; 24 int faulted;
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
index b2e0d8c4258c..8b57eb3647f5 100644
--- a/arch/um/os-Linux/process.c
+++ b/arch/um/os-Linux/process.c
@@ -249,7 +249,7 @@ void init_new_thread_signals(void)
249 init_irq_signals(1); 249 init_irq_signals(1);
250} 250}
251 251
252int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr) 252int run_kernel_thread(int (*fn)(void *), void *arg, jmp_buf **jmp_ptr)
253{ 253{
254 jmp_buf buf; 254 jmp_buf buf;
255 int n; 255 int n;
diff --git a/arch/um/os-Linux/trap.c b/arch/um/os-Linux/trap.c
index be8e029f58b4..d3a34ca8a891 100644
--- a/arch/um/os-Linux/trap.c
+++ b/arch/um/os-Linux/trap.c
@@ -22,10 +22,3 @@ void os_fill_handlinfo(struct kern_handlers h)
22 sig_info[SIGVTALRM] = h.timer_handler; 22 sig_info[SIGVTALRM] = h.timer_handler;
23 sig_info[SIGALRM] = h.timer_handler; 23 sig_info[SIGALRM] = h.timer_handler;
24} 24}
25
26void do_longjmp(void *b, int val)
27{
28 jmp_buf *buf = b;
29
30 UML_LONGJMP(buf, val);
31}
diff --git a/arch/um/os-Linux/uaccess.c b/arch/um/os-Linux/uaccess.c
index bbb73a650370..8d27b6d1df91 100644
--- a/arch/um/os-Linux/uaccess.c
+++ b/arch/um/os-Linux/uaccess.c
@@ -8,7 +8,7 @@
8#include "longjmp.h" 8#include "longjmp.h"
9 9
10unsigned long __do_user_copy(void *to, const void *from, int n, 10unsigned long __do_user_copy(void *to, const void *from, int n,
11 void **fault_addr, void **fault_catcher, 11 void **fault_addr, jmp_buf **fault_catcher,
12 void (*op)(void *to, const void *from, 12 void (*op)(void *to, const void *from,
13 int n), int *faulted_out) 13 int n), int *faulted_out)
14{ 14{
diff --git a/include/asm-um/processor-generic.h b/include/asm-um/processor-generic.h
index d40eae9ec9a2..78c0599cc80c 100644
--- a/include/asm-um/processor-generic.h
+++ b/include/asm-um/processor-generic.h
@@ -30,10 +30,10 @@ struct thread_struct {
30 struct pt_regs regs; 30 struct pt_regs regs;
31 int singlestep_syscall; 31 int singlestep_syscall;
32 void *fault_addr; 32 void *fault_addr;
33 void *fault_catcher; 33 jmp_buf *fault_catcher;
34 struct task_struct *prev_sched; 34 struct task_struct *prev_sched;
35 unsigned long temp_stack; 35 unsigned long temp_stack;
36 void *exec_buf; 36 jmp_buf *exec_buf;
37 struct arch_thread arch; 37 struct arch_thread arch;
38 jmp_buf switch_buf; 38 jmp_buf switch_buf;
39 int mm_count; 39 int mm_count;