um: take arch/um/sys-x86 to arch/x86/um
[deliverable/linux.git] / arch / x86 / um / shared / sysdep / stub_32.h
1 /*
2 * Copyright (C) 2004 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
4 */
5
6 #ifndef __SYSDEP_STUB_H
7 #define __SYSDEP_STUB_H
8
9 #include <asm/ptrace.h>
10
11 #define STUB_SYSCALL_RET EAX
12 #define STUB_MMAP_NR __NR_mmap2
13 #define MMAP_OFFSET(o) ((o) >> UM_KERN_PAGE_SHIFT)
14
15 static inline long stub_syscall0(long syscall)
16 {
17 long ret;
18
19 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall));
20
21 return ret;
22 }
23
24 static inline long stub_syscall1(long syscall, long arg1)
25 {
26 long ret;
27
28 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1));
29
30 return ret;
31 }
32
33 static inline long stub_syscall2(long syscall, long arg1, long arg2)
34 {
35 long ret;
36
37 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1),
38 "c" (arg2));
39
40 return ret;
41 }
42
43 static inline long stub_syscall3(long syscall, long arg1, long arg2, long arg3)
44 {
45 long ret;
46
47 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1),
48 "c" (arg2), "d" (arg3));
49
50 return ret;
51 }
52
53 static inline long stub_syscall4(long syscall, long arg1, long arg2, long arg3,
54 long arg4)
55 {
56 long ret;
57
58 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1),
59 "c" (arg2), "d" (arg3), "S" (arg4));
60
61 return ret;
62 }
63
64 static inline long stub_syscall5(long syscall, long arg1, long arg2, long arg3,
65 long arg4, long arg5)
66 {
67 long ret;
68
69 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1),
70 "c" (arg2), "d" (arg3), "S" (arg4), "D" (arg5));
71
72 return ret;
73 }
74
75 static inline void trap_myself(void)
76 {
77 __asm("int3");
78 }
79
80 static inline void remap_stack(int fd, unsigned long offset)
81 {
82 __asm__ volatile ("movl %%eax,%%ebp ; movl %0,%%eax ; int $0x80 ;"
83 "movl %7, %%ebx ; movl %%eax, (%%ebx)"
84 : : "g" (STUB_MMAP_NR), "b" (STUB_DATA),
85 "c" (UM_KERN_PAGE_SIZE),
86 "d" (PROT_READ | PROT_WRITE),
87 "S" (MAP_FIXED | MAP_SHARED), "D" (fd),
88 "a" (offset),
89 "i" (&((struct stub_data *) STUB_DATA)->err)
90 : "memory");
91 }
92
93 #endif
This page took 0.040981 seconds and 5 git commands to generate.