]> Git Repo - linux.git/blame - arch/um/sys-i386/sysdep/stub.h
x86, um: merge Kconfig.i386 and Kconfig.x86_64
[linux.git] / arch / um / sys-i386 / sysdep / stub.h
CommitLineData
d67b569f
JD
1/*
2 * Copyright (C) 2004 Jeff Dike ([email protected])
3 * Licensed under the GPL
4 */
5
6#ifndef __SYSDEP_STUB_H
7#define __SYSDEP_STUB_H
8
5b7b15af 9#include <sys/mman.h>
d67b569f
JD
10#include <asm/ptrace.h>
11#include <asm/unistd.h>
54ae36f2 12#include "as-layout.h"
5b7b15af
JD
13#include "stub-data.h"
14#include "kern_constants.h"
15#include "uml-config.h"
d67b569f
JD
16
17extern void stub_segv_handler(int sig);
9786a8f3 18extern void stub_clone_handler(void);
d67b569f
JD
19
20#define STUB_SYSCALL_RET EAX
21#define STUB_MMAP_NR __NR_mmap2
71f926f2 22#define MMAP_OFFSET(o) ((o) >> UM_KERN_PAGE_SHIFT)
d67b569f 23
17d46971
JD
24static inline long stub_syscall0(long syscall)
25{
26 long ret;
27
28 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall));
29
30 return ret;
31}
32
4f027241
PBG
33static inline long stub_syscall1(long syscall, long arg1)
34{
35 long ret;
36
37 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1));
38
39 return ret;
40}
41
9786a8f3
BS
42static inline long stub_syscall2(long syscall, long arg1, long arg2)
43{
44 long ret;
45
4f027241
PBG
46 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1),
47 "c" (arg2));
48
49 return ret;
9786a8f3
BS
50}
51
52static inline long stub_syscall3(long syscall, long arg1, long arg2, long arg3)
53{
4f027241
PBG
54 long ret;
55
56 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1),
57 "c" (arg2), "d" (arg3));
58
59 return ret;
9786a8f3
BS
60}
61
62static inline long stub_syscall4(long syscall, long arg1, long arg2, long arg3,
63 long arg4)
64{
4f027241
PBG
65 long ret;
66
67 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1),
68 "c" (arg2), "d" (arg3), "S" (arg4));
69
70 return ret;
71}
72
73static inline long stub_syscall5(long syscall, long arg1, long arg2, long arg3,
74 long arg4, long arg5)
75{
76 long ret;
77
78 __asm__ volatile ("int $0x80" : "=a" (ret) : "0" (syscall), "b" (arg1),
79 "c" (arg2), "d" (arg3), "S" (arg4), "D" (arg5));
80
81 return ret;
9786a8f3
BS
82}
83
5b7b15af 84static inline void trap_myself(void)
9786a8f3 85{
5b7b15af 86 __asm("int3");
9786a8f3
BS
87}
88
5b7b15af 89static inline void remap_stack(int fd, unsigned long offset)
9786a8f3 90{
5b7b15af
JD
91 __asm__ volatile ("movl %%eax,%%ebp ; movl %0,%%eax ; int $0x80 ;"
92 "movl %7, %%ebx ; movl %%eax, (%%ebx)"
54ae36f2
JD
93 : : "g" (STUB_MMAP_NR), "b" (STUB_DATA),
94 "c" (UM_KERN_PAGE_SIZE),
5b7b15af 95 "d" (PROT_READ | PROT_WRITE),
54ae36f2
JD
96 "S" (MAP_FIXED | MAP_SHARED), "D" (fd),
97 "a" (offset),
98 "i" (&((struct stub_data *) STUB_DATA)->err)
5b7b15af 99 : "memory");
9786a8f3
BS
100}
101
d67b569f 102#endif
This page took 0.396747 seconds and 4 git commands to generate.