aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/include/sysdep-i386
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um/include/sysdep-i386')
-rw-r--r--arch/um/include/sysdep-i386/stub.h64
1 files changed, 44 insertions, 20 deletions
diff --git a/arch/um/include/sysdep-i386/stub.h b/arch/um/include/sysdep-i386/stub.h
index d3699fe1c613..a49ceb199ee5 100644
--- a/arch/um/include/sysdep-i386/stub.h
+++ b/arch/um/include/sysdep-i386/stub.h
@@ -16,45 +16,69 @@ extern void stub_clone_handler(void);
16#define STUB_MMAP_NR __NR_mmap2 16#define STUB_MMAP_NR __NR_mmap2
17#define MMAP_OFFSET(o) ((o) >> PAGE_SHIFT) 17#define MMAP_OFFSET(o) ((o) >> PAGE_SHIFT)
18 18
19static inline long stub_syscall1(long syscall, long arg1)
20{
21 long ret;
22
23 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1));
24
25 return ret;
26}
27
19static inline long stub_syscall2(long syscall, long arg1, long arg2) 28static inline long stub_syscall2(long syscall, long arg1, long arg2)
20{ 29{
21 long ret; 30 long ret;
22 31
23 __asm__("movl %0, %%ecx; " : : "g" (arg2) : "%ecx"); 32 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1),
24 __asm__("movl %0, %%ebx; " : : "g" (arg1) : "%ebx"); 33 "c" (arg2));
25 __asm__("movl %0, %%eax; " : : "g" (syscall) : "%eax"); 34
26 __asm__("int $0x80;" : : : "%eax"); 35 return ret;
27 __asm__ __volatile__("movl %%eax, %0; " : "=g" (ret) :);
28 return(ret);
29} 36}
30 37
31static inline long stub_syscall3(long syscall, long arg1, long arg2, long arg3) 38static inline long stub_syscall3(long syscall, long arg1, long arg2, long arg3)
32{ 39{
33 __asm__("movl %0, %%edx; " : : "g" (arg3) : "%edx"); 40 long ret;
34 return(stub_syscall2(syscall, arg1, arg2)); 41
42 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1),
43 "c" (arg2), "d" (arg3));
44
45 return ret;
35} 46}
36 47
37static inline long stub_syscall4(long syscall, long arg1, long arg2, long arg3, 48static inline long stub_syscall4(long syscall, long arg1, long arg2, long arg3,
38 long arg4) 49 long arg4)
39{ 50{
40 __asm__("movl %0, %%esi; " : : "g" (arg4) : "%esi"); 51 long ret;
41 return(stub_syscall3(syscall, arg1, arg2, arg3)); 52
53 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1),
54 "c" (arg2), "d" (arg3), "S" (arg4));
55
56 return ret;
57}
58
59static inline long stub_syscall5(long syscall, long arg1, long arg2, long arg3,
60 long arg4, long arg5)
61{
62 long ret;
63
64 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1),
65 "c" (arg2), "d" (arg3), "S" (arg4), "D" (arg5));
66
67 return ret;
42} 68}
43 69
44static inline long stub_syscall6(long syscall, long arg1, long arg2, long arg3, 70static inline long stub_syscall6(long syscall, long arg1, long arg2, long arg3,
45 long arg4, long arg5, long arg6) 71 long arg4, long arg5, long arg6)
46{ 72{
47 long ret; 73 long ret;
48 __asm__("movl %0, %%eax; " : : "g" (syscall) : "%eax"); 74
49 __asm__("movl %0, %%ebx; " : : "g" (arg1) : "%ebx"); 75 __asm__ volatile ("push %%ebp ; movl %%eax,%%ebp ; movl %1,%%eax ; "
50 __asm__("movl %0, %%ecx; " : : "g" (arg2) : "%ecx"); 76 "int $0x80 ; pop %%ebp"
51 __asm__("movl %0, %%edx; " : : "g" (arg3) : "%edx"); 77 : "=a" (ret)
52 __asm__("movl %0, %%esi; " : : "g" (arg4) : "%esi"); 78 : "g" (syscall), "b" (arg1), "c" (arg2), "d" (arg3),
53 __asm__("movl %0, %%edi; " : : "g" (arg5) : "%edi"); 79 "S" (arg4), "D" (arg5), "0" (arg6));
54 __asm__ __volatile__("pushl %%ebp ; movl %1, %%ebp; " 80
55 "int $0x80; popl %%ebp ; " 81 return ret;
56 "movl %%eax, %0; " : "=g" (ret) : "g" (arg6) : "%eax");
57 return(ret);
58} 82}
59 83
60static inline void trap_myself(void) 84static inline void trap_myself(void)