diff options
Diffstat (limited to 'arch/um/include')
-rw-r--r-- | arch/um/include/sysdep-i386/stub.h | 47 | ||||
-rw-r--r-- | arch/um/include/sysdep-x86_64/stub.h | 39 | ||||
-rw-r--r-- | arch/um/include/time_user.h | 1 |
3 files changed, 87 insertions, 0 deletions
diff --git a/arch/um/include/sysdep-i386/stub.h b/arch/um/include/sysdep-i386/stub.h index fed9ff1cea52..d3699fe1c613 100644 --- a/arch/um/include/sysdep-i386/stub.h +++ b/arch/um/include/sysdep-i386/stub.h | |||
@@ -10,9 +10,56 @@ | |||
10 | #include <asm/unistd.h> | 10 | #include <asm/unistd.h> |
11 | 11 | ||
12 | extern void stub_segv_handler(int sig); | 12 | extern void stub_segv_handler(int sig); |
13 | extern void stub_clone_handler(void); | ||
13 | 14 | ||
14 | #define STUB_SYSCALL_RET EAX | 15 | #define STUB_SYSCALL_RET EAX |
15 | #define STUB_MMAP_NR __NR_mmap2 | 16 | #define STUB_MMAP_NR __NR_mmap2 |
16 | #define MMAP_OFFSET(o) ((o) >> PAGE_SHIFT) | 17 | #define MMAP_OFFSET(o) ((o) >> PAGE_SHIFT) |
17 | 18 | ||
19 | static inline long stub_syscall2(long syscall, long arg1, long arg2) | ||
20 | { | ||
21 | long ret; | ||
22 | |||
23 | __asm__("movl %0, %%ecx; " : : "g" (arg2) : "%ecx"); | ||
24 | __asm__("movl %0, %%ebx; " : : "g" (arg1) : "%ebx"); | ||
25 | __asm__("movl %0, %%eax; " : : "g" (syscall) : "%eax"); | ||
26 | __asm__("int $0x80;" : : : "%eax"); | ||
27 | __asm__ __volatile__("movl %%eax, %0; " : "=g" (ret) :); | ||
28 | return(ret); | ||
29 | } | ||
30 | |||
31 | static inline long stub_syscall3(long syscall, long arg1, long arg2, long arg3) | ||
32 | { | ||
33 | __asm__("movl %0, %%edx; " : : "g" (arg3) : "%edx"); | ||
34 | return(stub_syscall2(syscall, arg1, arg2)); | ||
35 | } | ||
36 | |||
37 | static inline long stub_syscall4(long syscall, long arg1, long arg2, long arg3, | ||
38 | long arg4) | ||
39 | { | ||
40 | __asm__("movl %0, %%esi; " : : "g" (arg4) : "%esi"); | ||
41 | return(stub_syscall3(syscall, arg1, arg2, arg3)); | ||
42 | } | ||
43 | |||
44 | static inline long stub_syscall6(long syscall, long arg1, long arg2, long arg3, | ||
45 | long arg4, long arg5, long arg6) | ||
46 | { | ||
47 | long ret; | ||
48 | __asm__("movl %0, %%eax; " : : "g" (syscall) : "%eax"); | ||
49 | __asm__("movl %0, %%ebx; " : : "g" (arg1) : "%ebx"); | ||
50 | __asm__("movl %0, %%ecx; " : : "g" (arg2) : "%ecx"); | ||
51 | __asm__("movl %0, %%edx; " : : "g" (arg3) : "%edx"); | ||
52 | __asm__("movl %0, %%esi; " : : "g" (arg4) : "%esi"); | ||
53 | __asm__("movl %0, %%edi; " : : "g" (arg5) : "%edi"); | ||
54 | __asm__ __volatile__("pushl %%ebp ; movl %1, %%ebp; " | ||
55 | "int $0x80; popl %%ebp ; " | ||
56 | "movl %%eax, %0; " : "=g" (ret) : "g" (arg6) : "%eax"); | ||
57 | return(ret); | ||
58 | } | ||
59 | |||
60 | static inline void trap_myself(void) | ||
61 | { | ||
62 | __asm("int3"); | ||
63 | } | ||
64 | |||
18 | #endif | 65 | #endif |
diff --git a/arch/um/include/sysdep-x86_64/stub.h b/arch/um/include/sysdep-x86_64/stub.h index 6b5447ad590d..f599058d8263 100644 --- a/arch/um/include/sysdep-x86_64/stub.h +++ b/arch/um/include/sysdep-x86_64/stub.h | |||
@@ -11,9 +11,48 @@ | |||
11 | #include <sysdep/ptrace_user.h> | 11 | #include <sysdep/ptrace_user.h> |
12 | 12 | ||
13 | extern void stub_segv_handler(int sig); | 13 | extern void stub_segv_handler(int sig); |
14 | extern void stub_clone_handler(void); | ||
14 | 15 | ||
15 | #define STUB_SYSCALL_RET PT_INDEX(RAX) | 16 | #define STUB_SYSCALL_RET PT_INDEX(RAX) |
16 | #define STUB_MMAP_NR __NR_mmap | 17 | #define STUB_MMAP_NR __NR_mmap |
17 | #define MMAP_OFFSET(o) (o) | 18 | #define MMAP_OFFSET(o) (o) |
18 | 19 | ||
20 | static inline long stub_syscall2(long syscall, long arg1, long arg2) | ||
21 | { | ||
22 | long ret; | ||
23 | |||
24 | __asm__("movq %0, %%rsi; " : : "g" (arg2) : "%rsi"); | ||
25 | __asm__("movq %0, %%rdi; " : : "g" (arg1) : "%rdi"); | ||
26 | __asm__("movq %0, %%rax; " : : "g" (syscall) : "%rax"); | ||
27 | __asm__("syscall;" : : : "%rax", "%r11", "%rcx"); | ||
28 | __asm__ __volatile__("movq %%rax, %0; " : "=g" (ret) :); | ||
29 | return(ret); | ||
30 | } | ||
31 | |||
32 | static inline long stub_syscall3(long syscall, long arg1, long arg2, long arg3) | ||
33 | { | ||
34 | __asm__("movq %0, %%rdx; " : : "g" (arg3) : "%rdx"); | ||
35 | return(stub_syscall2(syscall, arg1, arg2)); | ||
36 | } | ||
37 | |||
38 | static inline long stub_syscall4(long syscall, long arg1, long arg2, long arg3, | ||
39 | long arg4) | ||
40 | { | ||
41 | __asm__("movq %0, %%r10; " : : "g" (arg4) : "%r10"); | ||
42 | return(stub_syscall3(syscall, arg1, arg2, arg3)); | ||
43 | } | ||
44 | |||
45 | static inline long stub_syscall6(long syscall, long arg1, long arg2, long arg3, | ||
46 | long arg4, long arg5, long arg6) | ||
47 | { | ||
48 | __asm__("movq %0, %%r9; " : : "g" (arg6) : "%r9"); | ||
49 | __asm__("movq %0, %%r8; " : : "g" (arg5) : "%r8"); | ||
50 | return(stub_syscall4(syscall, arg1, arg2, arg3, arg4)); | ||
51 | } | ||
52 | |||
53 | static inline void trap_myself(void) | ||
54 | { | ||
55 | __asm("int3"); | ||
56 | } | ||
57 | |||
19 | #endif | 58 | #endif |
diff --git a/arch/um/include/time_user.h b/arch/um/include/time_user.h index f64ef77019a3..17d7ef2141f4 100644 --- a/arch/um/include/time_user.h +++ b/arch/um/include/time_user.h | |||
@@ -10,6 +10,7 @@ extern void timer(void); | |||
10 | extern void switch_timers(int to_real); | 10 | extern void switch_timers(int to_real); |
11 | extern void idle_sleep(int secs); | 11 | extern void idle_sleep(int secs); |
12 | extern void enable_timer(void); | 12 | extern void enable_timer(void); |
13 | extern void prepare_timer(void * ptr); | ||
13 | extern void disable_timer(void); | 14 | extern void disable_timer(void); |
14 | extern unsigned long time_lock(void); | 15 | extern unsigned long time_lock(void); |
15 | extern void time_unlock(unsigned long); | 16 | extern void time_unlock(unsigned long); |