diff options
Diffstat (limited to 'arch/um/sys-x86_64')
-rw-r--r-- | arch/um/sys-x86_64/Makefile | 13 | ||||
-rw-r--r-- | arch/um/sys-x86_64/kernel-offsets.c | 1 | ||||
-rw-r--r-- | arch/um/sys-x86_64/signal.c | 41 | ||||
-rw-r--r-- | arch/um/sys-x86_64/stub.S | 51 | ||||
-rw-r--r-- | arch/um/sys-x86_64/stub_segv.c | 3 |
5 files changed, 81 insertions, 28 deletions
diff --git a/arch/um/sys-x86_64/Makefile b/arch/um/sys-x86_64/Makefile index 7488206ce6f4..f0ab574d1e95 100644 --- a/arch/um/sys-x86_64/Makefile +++ b/arch/um/sys-x86_64/Makefile | |||
@@ -6,7 +6,7 @@ | |||
6 | 6 | ||
7 | #XXX: why into lib-y? | 7 | #XXX: why into lib-y? |
8 | lib-y = bitops.o bugs.o csum-partial.o delay.o fault.o mem.o memcpy.o \ | 8 | lib-y = bitops.o bugs.o csum-partial.o delay.o fault.o mem.o memcpy.o \ |
9 | ptrace.o ptrace_user.o semaphore.o sigcontext.o signal.o stub.o \ | 9 | ptrace.o ptrace_user.o sigcontext.o signal.o stub.o \ |
10 | stub_segv.o syscalls.o syscall_table.o sysrq.o thunk.o | 10 | stub_segv.o syscalls.o syscall_table.o sysrq.o thunk.o |
11 | 11 | ||
12 | obj-y := ksyms.o | 12 | obj-y := ksyms.o |
@@ -15,7 +15,7 @@ obj-$(CONFIG_MODULES) += module.o um_module.o | |||
15 | USER_OBJS := ptrace_user.o sigcontext.o | 15 | USER_OBJS := ptrace_user.o sigcontext.o |
16 | 16 | ||
17 | SYMLINKS = bitops.c csum-copy.S csum-partial.c csum-wrappers.c memcpy.S \ | 17 | SYMLINKS = bitops.c csum-copy.S csum-partial.c csum-wrappers.c memcpy.S \ |
18 | semaphore.c thunk.S module.c | 18 | thunk.S module.c |
19 | 19 | ||
20 | include arch/um/scripts/Makefile.rules | 20 | include arch/um/scripts/Makefile.rules |
21 | 21 | ||
@@ -24,17 +24,10 @@ csum-copy.S-dir = lib | |||
24 | csum-partial.c-dir = lib | 24 | csum-partial.c-dir = lib |
25 | csum-wrappers.c-dir = lib | 25 | csum-wrappers.c-dir = lib |
26 | memcpy.S-dir = lib | 26 | memcpy.S-dir = lib |
27 | semaphore.c-dir = kernel | ||
28 | thunk.S-dir = lib | 27 | thunk.S-dir = lib |
29 | module.c-dir = kernel | 28 | module.c-dir = kernel |
30 | 29 | ||
31 | STUB_CFLAGS = -Wp,-MD,$(depfile) $(call unprofile,$(USER_CFLAGS)) | 30 | $(obj)/stub_segv.o: _c_flags = $(call unprofile,$(CFLAGS)) |
32 | |||
33 | # _cflags works with kernel files, not with userspace ones, but c_flags does, | ||
34 | # why ask why? | ||
35 | $(obj)/stub_segv.o : c_flags = $(STUB_CFLAGS) | ||
36 | |||
37 | $(obj)/stub.o : a_flags = $(STUB_CFLAGS) | ||
38 | 31 | ||
39 | subdir- := util | 32 | subdir- := util |
40 | 33 | ||
diff --git a/arch/um/sys-x86_64/kernel-offsets.c b/arch/um/sys-x86_64/kernel-offsets.c index 220e875cbe29..998541eade41 100644 --- a/arch/um/sys-x86_64/kernel-offsets.c +++ b/arch/um/sys-x86_64/kernel-offsets.c | |||
@@ -2,6 +2,7 @@ | |||
2 | #include <linux/stddef.h> | 2 | #include <linux/stddef.h> |
3 | #include <linux/sched.h> | 3 | #include <linux/sched.h> |
4 | #include <linux/time.h> | 4 | #include <linux/time.h> |
5 | #include <linux/elf.h> | ||
5 | #include <asm/page.h> | 6 | #include <asm/page.h> |
6 | 7 | ||
7 | #define DEFINE(sym, val) \ | 8 | #define DEFINE(sym, val) \ |
diff --git a/arch/um/sys-x86_64/signal.c b/arch/um/sys-x86_64/signal.c index 8fdaed06c10d..fe1d065332b1 100644 --- a/arch/um/sys-x86_64/signal.c +++ b/arch/um/sys-x86_64/signal.c | |||
@@ -104,28 +104,35 @@ int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp, | |||
104 | int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext *from, | 104 | int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext *from, |
105 | int fpsize) | 105 | int fpsize) |
106 | { | 106 | { |
107 | struct _fpstate *to_fp, *from_fp; | 107 | struct _fpstate *to_fp, *from_fp; |
108 | unsigned long sigs; | 108 | unsigned long sigs; |
109 | int err; | 109 | int err; |
110 | 110 | ||
111 | to_fp = to->fpstate; | 111 | to_fp = to->fpstate; |
112 | from_fp = from->fpstate; | 112 | sigs = to->oldmask; |
113 | sigs = to->oldmask; | 113 | err = copy_from_user(to, from, sizeof(*to)); |
114 | err = copy_from_user(to, from, sizeof(*to)); | 114 | from_fp = to->fpstate; |
115 | to->oldmask = sigs; | 115 | to->fpstate = to_fp; |
116 | return(err); | 116 | to->oldmask = sigs; |
117 | if(to_fp != NULL) | ||
118 | err |= copy_from_user(to_fp, from_fp, fpsize); | ||
119 | return(err); | ||
117 | } | 120 | } |
118 | 121 | ||
119 | int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate *fp, | 122 | int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate *fp, |
120 | struct sigcontext *from, int fpsize) | 123 | struct sigcontext *from, int fpsize) |
121 | { | 124 | { |
122 | struct _fpstate *to_fp, *from_fp; | 125 | struct _fpstate *to_fp, *from_fp; |
123 | int err; | 126 | int err; |
124 | 127 | ||
125 | to_fp = (fp ? fp : (struct _fpstate *) (to + 1)); | 128 | to_fp = (fp ? fp : (struct _fpstate *) (to + 1)); |
126 | from_fp = from->fpstate; | 129 | from_fp = from->fpstate; |
127 | err = copy_to_user(to, from, sizeof(*to)); | 130 | err = copy_to_user(to, from, sizeof(*to)); |
128 | return(err); | 131 | if(from_fp != NULL){ |
132 | err |= copy_to_user(&to->fpstate, &to_fp, sizeof(to->fpstate)); | ||
133 | err |= copy_to_user(to_fp, from_fp, fpsize); | ||
134 | } | ||
135 | return(err); | ||
129 | } | 136 | } |
130 | 137 | ||
131 | #endif | 138 | #endif |
diff --git a/arch/um/sys-x86_64/stub.S b/arch/um/sys-x86_64/stub.S index 31c14925716b..03c279735784 100644 --- a/arch/um/sys-x86_64/stub.S +++ b/arch/um/sys-x86_64/stub.S | |||
@@ -13,3 +13,54 @@ syscall_stub: | |||
13 | or %rcx, %rbx | 13 | or %rcx, %rbx |
14 | movq %rax, (%rbx) | 14 | movq %rax, (%rbx) |
15 | int3 | 15 | int3 |
16 | |||
17 | .globl batch_syscall_stub | ||
18 | batch_syscall_stub: | ||
19 | mov $(UML_CONFIG_STUB_DATA >> 32), %rbx | ||
20 | sal $32, %rbx | ||
21 | mov $(UML_CONFIG_STUB_DATA & 0xffffffff), %rax | ||
22 | or %rax, %rbx | ||
23 | /* load pointer to first operation */ | ||
24 | mov %rbx, %rsp | ||
25 | add $0x10, %rsp | ||
26 | again: | ||
27 | /* load length of additional data */ | ||
28 | mov 0x0(%rsp), %rax | ||
29 | |||
30 | /* if(length == 0) : end of list */ | ||
31 | /* write possible 0 to header */ | ||
32 | mov %rax, 8(%rbx) | ||
33 | cmp $0, %rax | ||
34 | jz done | ||
35 | |||
36 | /* save current pointer */ | ||
37 | mov %rsp, 8(%rbx) | ||
38 | |||
39 | /* skip additional data */ | ||
40 | add %rax, %rsp | ||
41 | |||
42 | /* load syscall-# */ | ||
43 | pop %rax | ||
44 | |||
45 | /* load syscall params */ | ||
46 | pop %rdi | ||
47 | pop %rsi | ||
48 | pop %rdx | ||
49 | pop %r10 | ||
50 | pop %r8 | ||
51 | pop %r9 | ||
52 | |||
53 | /* execute syscall */ | ||
54 | syscall | ||
55 | |||
56 | /* check return value */ | ||
57 | pop %rcx | ||
58 | cmp %rcx, %rax | ||
59 | je again | ||
60 | |||
61 | done: | ||
62 | /* save return value */ | ||
63 | mov %rax, (%rbx) | ||
64 | |||
65 | /* stop */ | ||
66 | int3 | ||
diff --git a/arch/um/sys-x86_64/stub_segv.c b/arch/um/sys-x86_64/stub_segv.c index 161d1fe9c034..65a131b362b6 100644 --- a/arch/um/sys-x86_64/stub_segv.c +++ b/arch/um/sys-x86_64/stub_segv.c | |||
@@ -3,9 +3,10 @@ | |||
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <signal.h> | 6 | #include <asm/signal.h> |
7 | #include <linux/compiler.h> | 7 | #include <linux/compiler.h> |
8 | #include <asm/unistd.h> | 8 | #include <asm/unistd.h> |
9 | #include <asm/ucontext.h> | ||
9 | #include "uml-config.h" | 10 | #include "uml-config.h" |
10 | #include "sysdep/sigcontext.h" | 11 | #include "sysdep/sigcontext.h" |
11 | #include "sysdep/faultinfo.h" | 12 | #include "sysdep/faultinfo.h" |