aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/sys-i386/shared/sysdep/stub.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-10-27 07:38:02 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-27 07:38:02 -0400
commit5292ae11babca23c3ff82593630d2d7eebc350a9 (patch)
tree30a6c8123b35686098f306ea39398b7621f42054 /arch/um/sys-i386/shared/sysdep/stub.h
parentb0f209898f1a177bd503d49215b8c6628797a81c (diff)
parent0173a3265b228da319ceb9c1ec6a5682fd1b2d92 (diff)
Merge commit 'v2.6.28-rc2' into x86/uv
Diffstat (limited to 'arch/um/sys-i386/shared/sysdep/stub.h')
-rw-r--r--arch/um/sys-i386/shared/sysdep/stub.h101
1 files changed, 101 insertions, 0 deletions
diff --git a/arch/um/sys-i386/shared/sysdep/stub.h b/arch/um/sys-i386/shared/sysdep/stub.h
new file mode 100644
index 000000000000..977dedd9221b
--- /dev/null
+++ b/arch/um/sys-i386/shared/sysdep/stub.h
@@ -0,0 +1,101 @@
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 <sys/mman.h>
10#include <asm/ptrace.h>
11#include <asm/unistd.h>
12#include "as-layout.h"
13#include "stub-data.h"
14#include "kern_constants.h"
15
16extern void stub_segv_handler(int sig);
17extern void stub_clone_handler(void);
18
19#define STUB_SYSCALL_RET EAX
20#define STUB_MMAP_NR __NR_mmap2
21#define MMAP_OFFSET(o) ((o) >> UM_KERN_PAGE_SHIFT)
22
23static inline long stub_syscall0(long syscall)
24{
25 long ret;
26
27 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall));
28
29 return ret;
30}
31
32static inline long stub_syscall1(long syscall, long arg1)
33{
34 long ret;
35
36 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1));
37
38 return ret;
39}
40
41static inline long stub_syscall2(long syscall, long arg1, long arg2)
42{
43 long ret;
44
45 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1),
46 "c" (arg2));
47
48 return ret;
49}
50
51static inline long stub_syscall3(long syscall, long arg1, long arg2, long arg3)
52{
53 long ret;
54
55 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1),
56 "c" (arg2), "d" (arg3));
57
58 return ret;
59}
60
61static inline long stub_syscall4(long syscall, long arg1, long arg2, long arg3,
62 long arg4)
63{
64 long ret;
65
66 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1),
67 "c" (arg2), "d" (arg3), "S" (arg4));
68
69 return ret;
70}
71
72static inline long stub_syscall5(long syscall, long arg1, long arg2, long arg3,
73 long arg4, long arg5)
74{
75 long ret;
76
77 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1),
78 "c" (arg2), "d" (arg3), "S" (arg4), "D" (arg5));
79
80 return ret;
81}
82
83static inline void trap_myself(void)
84{
85 __asm("int3");
86}
87
88static inline void remap_stack(int fd, unsigned long offset)
89{
90 __asm__ volatile ("movl %%eax,%%ebp ; movl %0,%%eax ; int $0x80 ;"
91 "movl %7, %%ebx ; movl %%eax, (%%ebx)"
92 : : "g" (STUB_MMAP_NR), "b" (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 *) STUB_DATA)->err)
98 : "memory");
99}
100
101#endif