diff options
Diffstat (limited to 'arch/um/include/sysdep-i386/stub.h')
-rw-r--r-- | arch/um/include/sysdep-i386/stub.h | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/arch/um/include/sysdep-i386/stub.h b/arch/um/include/sysdep-i386/stub.h index 6ba8cbbe0d36..b492b12b4a10 100644 --- a/arch/um/include/sysdep-i386/stub.h +++ b/arch/um/include/sysdep-i386/stub.h | |||
@@ -6,8 +6,12 @@ | |||
6 | #ifndef __SYSDEP_STUB_H | 6 | #ifndef __SYSDEP_STUB_H |
7 | #define __SYSDEP_STUB_H | 7 | #define __SYSDEP_STUB_H |
8 | 8 | ||
9 | #include <sys/mman.h> | ||
9 | #include <asm/ptrace.h> | 10 | #include <asm/ptrace.h> |
10 | #include <asm/unistd.h> | 11 | #include <asm/unistd.h> |
12 | #include "stub-data.h" | ||
13 | #include "kern_constants.h" | ||
14 | #include "uml-config.h" | ||
11 | 15 | ||
12 | extern void stub_segv_handler(int sig); | 16 | extern void stub_segv_handler(int sig); |
13 | extern void stub_clone_handler(void); | 17 | extern void stub_clone_handler(void); |
@@ -76,23 +80,22 @@ static inline long stub_syscall5(long syscall, long arg1, long arg2, long arg3, | |||
76 | return ret; | 80 | return ret; |
77 | } | 81 | } |
78 | 82 | ||
79 | static inline long stub_syscall6(long syscall, long arg1, long arg2, long arg3, | 83 | static inline void trap_myself(void) |
80 | long arg4, long arg5, long arg6) | ||
81 | { | 84 | { |
82 | long ret; | 85 | __asm("int3"); |
83 | |||
84 | __asm__ volatile ("push %%ebp ; movl %%eax,%%ebp ; movl %1,%%eax ; " | ||
85 | "int $0x80 ; pop %%ebp" | ||
86 | : "=a" (ret) | ||
87 | : "g" (syscall), "b" (arg1), "c" (arg2), "d" (arg3), | ||
88 | "S" (arg4), "D" (arg5), "0" (arg6)); | ||
89 | |||
90 | return ret; | ||
91 | } | 86 | } |
92 | 87 | ||
93 | static inline void trap_myself(void) | 88 | static inline void remap_stack(int fd, unsigned long offset) |
94 | { | 89 | { |
95 | __asm("int3"); | 90 | __asm__ volatile ("movl %%eax,%%ebp ; movl %0,%%eax ; int $0x80 ;" |
91 | "movl %7, %%ebx ; movl %%eax, (%%ebx)" | ||
92 | : : "g" (STUB_MMAP_NR), "b" (UML_CONFIG_STUB_DATA), | ||
93 | "c" (UM_KERN_PAGE_SIZE), | ||
94 | "d" (PROT_READ | PROT_WRITE), | ||
95 | "S" (MAP_FIXED | MAP_SHARED), "D" (fd), | ||
96 | "a" (offset), | ||
97 | "i" (&((struct stub_data *) UML_CONFIG_STUB_DATA)->err) | ||
98 | : "memory"); | ||
96 | } | 99 | } |
97 | 100 | ||
98 | #endif | 101 | #endif |