diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/um/include/os.h | 6 | ||||
-rw-r--r-- | arch/um/include/uml_uaccess.h | 4 | ||||
-rw-r--r-- | arch/um/kernel/Makefile | 2 | ||||
-rw-r--r-- | arch/um/kernel/tt/uaccess_user.c | 1 | ||||
-rw-r--r-- | arch/um/kernel/uaccess.c | 30 | ||||
-rw-r--r-- | arch/um/kernel/uaccess_user.c | 64 | ||||
-rw-r--r-- | arch/um/os-Linux/Makefile | 4 | ||||
-rw-r--r-- | arch/um/os-Linux/uaccess.c | 32 |
8 files changed, 72 insertions, 71 deletions
diff --git a/arch/um/include/os.h b/arch/um/include/os.h index 2e58e304b8be..b9f53519bbe6 100644 --- a/arch/um/include/os.h +++ b/arch/um/include/os.h | |||
@@ -199,6 +199,12 @@ extern void forward_pending_sigio(int target); | |||
199 | extern int start_fork_tramp(void *arg, unsigned long temp_stack, | 199 | extern int start_fork_tramp(void *arg, unsigned long temp_stack, |
200 | int clone_flags, int (*tramp)(void *)); | 200 | int clone_flags, int (*tramp)(void *)); |
201 | 201 | ||
202 | /* uaccess.c */ | ||
203 | extern unsigned long __do_user_copy(void *to, const void *from, int n, | ||
204 | void **fault_addr, void **fault_catcher, | ||
205 | void (*op)(void *to, const void *from, | ||
206 | int n), int *faulted_out); | ||
207 | |||
202 | #endif | 208 | #endif |
203 | 209 | ||
204 | /* | 210 | /* |
diff --git a/arch/um/include/uml_uaccess.h b/arch/um/include/uml_uaccess.h index f77eb6428453..c0df11d06f5e 100644 --- a/arch/um/include/uml_uaccess.h +++ b/arch/um/include/uml_uaccess.h | |||
@@ -8,10 +8,6 @@ | |||
8 | 8 | ||
9 | extern int __do_copy_to_user(void *to, const void *from, int n, | 9 | extern int __do_copy_to_user(void *to, const void *from, int n, |
10 | void **fault_addr, void **fault_catcher); | 10 | void **fault_addr, void **fault_catcher); |
11 | extern unsigned long __do_user_copy(void *to, const void *from, int n, | ||
12 | void **fault_addr, void **fault_catcher, | ||
13 | void (*op)(void *to, const void *from, | ||
14 | int n), int *faulted_out); | ||
15 | void __do_copy(void *to, const void *from, int n); | 11 | void __do_copy(void *to, const void *from, int n); |
16 | 12 | ||
17 | #endif | 13 | #endif |
diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile index 1a0001b3850c..72fd4eada9ca 100644 --- a/arch/um/kernel/Makefile +++ b/arch/um/kernel/Makefile | |||
@@ -10,7 +10,7 @@ obj-y = config.o exec_kern.o exitcode.o \ | |||
10 | helper.o init_task.o irq.o irq_user.o ksyms.o main.o mem.o physmem.o \ | 10 | helper.o init_task.o irq.o irq_user.o ksyms.o main.o mem.o physmem.o \ |
11 | process_kern.o ptrace.o reboot.o resource.o sigio_user.o sigio_kern.o \ | 11 | process_kern.o ptrace.o reboot.o resource.o sigio_user.o sigio_kern.o \ |
12 | signal_kern.o signal_user.o smp.o syscall_kern.o sysrq.o time.o \ | 12 | signal_kern.o signal_user.o smp.o syscall_kern.o sysrq.o time.o \ |
13 | time_kern.o tlb.o trap_kern.o trap_user.o uaccess_user.o um_arch.o \ | 13 | time_kern.o tlb.o trap_kern.o trap_user.o uaccess.o um_arch.o \ |
14 | umid.o user_util.o | 14 | umid.o user_util.o |
15 | 15 | ||
16 | obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o | 16 | obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o |
diff --git a/arch/um/kernel/tt/uaccess_user.c b/arch/um/kernel/tt/uaccess_user.c index 8c220f054b61..6c92bbccb49c 100644 --- a/arch/um/kernel/tt/uaccess_user.c +++ b/arch/um/kernel/tt/uaccess_user.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include "uml_uaccess.h" | 10 | #include "uml_uaccess.h" |
11 | #include "task.h" | 11 | #include "task.h" |
12 | #include "kern_util.h" | 12 | #include "kern_util.h" |
13 | #include "os.h" | ||
13 | 14 | ||
14 | int __do_copy_from_user(void *to, const void *from, int n, | 15 | int __do_copy_from_user(void *to, const void *from, int n, |
15 | void **fault_addr, void **fault_catcher) | 16 | void **fault_addr, void **fault_catcher) |
diff --git a/arch/um/kernel/uaccess.c b/arch/um/kernel/uaccess.c new file mode 100644 index 000000000000..054e3de0784e --- /dev/null +++ b/arch/um/kernel/uaccess.c | |||
@@ -0,0 +1,30 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2001 Chris Emerson (cemerson@chiark.greenend.org.uk) | ||
3 | * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com) | ||
4 | * Licensed under the GPL | ||
5 | */ | ||
6 | |||
7 | /* These are here rather than tt/uaccess.c because skas mode needs them in | ||
8 | * order to do SIGBUS recovery when a tmpfs mount runs out of room. | ||
9 | */ | ||
10 | |||
11 | #include <linux/string.h> | ||
12 | #include "os.h" | ||
13 | |||
14 | void __do_copy(void *to, const void *from, int n) | ||
15 | { | ||
16 | memcpy(to, from, n); | ||
17 | } | ||
18 | |||
19 | |||
20 | int __do_copy_to_user(void *to, const void *from, int n, | ||
21 | void **fault_addr, void **fault_catcher) | ||
22 | { | ||
23 | unsigned long fault; | ||
24 | int faulted; | ||
25 | |||
26 | fault = __do_user_copy(to, from, n, fault_addr, fault_catcher, | ||
27 | __do_copy, &faulted); | ||
28 | if(!faulted) return(0); | ||
29 | else return(n - (fault - (unsigned long) to)); | ||
30 | } | ||
diff --git a/arch/um/kernel/uaccess_user.c b/arch/um/kernel/uaccess_user.c deleted file mode 100644 index d035257ed0af..000000000000 --- a/arch/um/kernel/uaccess_user.c +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2001 Chris Emerson (cemerson@chiark.greenend.org.uk) | ||
3 | * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com) | ||
4 | * Licensed under the GPL | ||
5 | */ | ||
6 | |||
7 | #include <setjmp.h> | ||
8 | #include <string.h> | ||
9 | |||
10 | /* These are here rather than tt/uaccess.c because skas mode needs them in | ||
11 | * order to do SIGBUS recovery when a tmpfs mount runs out of room. | ||
12 | */ | ||
13 | |||
14 | unsigned long __do_user_copy(void *to, const void *from, int n, | ||
15 | void **fault_addr, void **fault_catcher, | ||
16 | void (*op)(void *to, const void *from, | ||
17 | int n), int *faulted_out) | ||
18 | { | ||
19 | unsigned long *faddrp = (unsigned long *) fault_addr, ret; | ||
20 | |||
21 | sigjmp_buf jbuf; | ||
22 | *fault_catcher = &jbuf; | ||
23 | if(sigsetjmp(jbuf, 1) == 0){ | ||
24 | (*op)(to, from, n); | ||
25 | ret = 0; | ||
26 | *faulted_out = 0; | ||
27 | } | ||
28 | else { | ||
29 | ret = *faddrp; | ||
30 | *faulted_out = 1; | ||
31 | } | ||
32 | *fault_addr = NULL; | ||
33 | *fault_catcher = NULL; | ||
34 | return ret; | ||
35 | } | ||
36 | |||
37 | void __do_copy(void *to, const void *from, int n) | ||
38 | { | ||
39 | memcpy(to, from, n); | ||
40 | } | ||
41 | |||
42 | |||
43 | int __do_copy_to_user(void *to, const void *from, int n, | ||
44 | void **fault_addr, void **fault_catcher) | ||
45 | { | ||
46 | unsigned long fault; | ||
47 | int faulted; | ||
48 | |||
49 | fault = __do_user_copy(to, from, n, fault_addr, fault_catcher, | ||
50 | __do_copy, &faulted); | ||
51 | if(!faulted) return(0); | ||
52 | else return(n - (fault - (unsigned long) to)); | ||
53 | } | ||
54 | |||
55 | /* | ||
56 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
57 | * Emacs will notice this stuff at the end of the file and automatically | ||
58 | * adjust the settings for this buffer only. This must remain at the end | ||
59 | * of the file. | ||
60 | * --------------------------------------------------------------------------- | ||
61 | * Local variables: | ||
62 | * c-file-style: "linux" | ||
63 | * End: | ||
64 | */ | ||
diff --git a/arch/um/os-Linux/Makefile b/arch/um/os-Linux/Makefile index d15ec2af6a22..d389c58b18b2 100644 --- a/arch/um/os-Linux/Makefile +++ b/arch/um/os-Linux/Makefile | |||
@@ -4,10 +4,10 @@ | |||
4 | # | 4 | # |
5 | 5 | ||
6 | obj-y = aio.o elf_aux.o file.o mem.o process.o signal.o start_up.o time.o \ | 6 | obj-y = aio.o elf_aux.o file.o mem.o process.o signal.o start_up.o time.o \ |
7 | tt.o tty.o user_syms.o drivers/ sys-$(SUBARCH)/ | 7 | tt.o tty.o uaccess.o user_syms.o drivers/ sys-$(SUBARCH)/ |
8 | 8 | ||
9 | USER_OBJS := aio.o elf_aux.o file.o mem.o process.o signal.o start_up.o \ | 9 | USER_OBJS := aio.o elf_aux.o file.o mem.o process.o signal.o start_up.o \ |
10 | time.o tt.o tty.o | 10 | time.o tt.o tty.o uaccess.o |
11 | 11 | ||
12 | elf_aux.o: $(ARCH_DIR)/kernel-offsets.h | 12 | elf_aux.o: $(ARCH_DIR)/kernel-offsets.h |
13 | CFLAGS_elf_aux.o += -I$(objtree)/arch/um | 13 | CFLAGS_elf_aux.o += -I$(objtree)/arch/um |
diff --git a/arch/um/os-Linux/uaccess.c b/arch/um/os-Linux/uaccess.c new file mode 100644 index 000000000000..38d710158c3d --- /dev/null +++ b/arch/um/os-Linux/uaccess.c | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2001 Chris Emerson (cemerson@chiark.greenend.org.uk) | ||
3 | * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com) | ||
4 | * Licensed under the GPL | ||
5 | */ | ||
6 | |||
7 | #include <setjmp.h> | ||
8 | #include <string.h> | ||
9 | |||
10 | unsigned long __do_user_copy(void *to, const void *from, int n, | ||
11 | void **fault_addr, void **fault_catcher, | ||
12 | void (*op)(void *to, const void *from, | ||
13 | int n), int *faulted_out) | ||
14 | { | ||
15 | unsigned long *faddrp = (unsigned long *) fault_addr, ret; | ||
16 | |||
17 | sigjmp_buf jbuf; | ||
18 | *fault_catcher = &jbuf; | ||
19 | if(sigsetjmp(jbuf, 1) == 0){ | ||
20 | (*op)(to, from, n); | ||
21 | ret = 0; | ||
22 | *faulted_out = 0; | ||
23 | } | ||
24 | else { | ||
25 | ret = *faddrp; | ||
26 | *faulted_out = 1; | ||
27 | } | ||
28 | *fault_addr = NULL; | ||
29 | *fault_catcher = NULL; | ||
30 | return ret; | ||
31 | } | ||
32 | |||