mips: rename offsets.c to asm-offsets.c
[linux-2.6/verdex.git] / arch / um / include / sysdep-i386 / stub.h
blobd3699fe1c6133b001e9b09c50e904f3fc5b944d5
1 /*
2 * Copyright (C) 2004 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
4 */
6 #ifndef __SYSDEP_STUB_H
7 #define __SYSDEP_STUB_H
9 #include <asm/ptrace.h>
10 #include <asm/unistd.h>
12 extern void stub_segv_handler(int sig);
13 extern void stub_clone_handler(void);
15 #define STUB_SYSCALL_RET EAX
16 #define STUB_MMAP_NR __NR_mmap2
17 #define MMAP_OFFSET(o) ((o) >> PAGE_SHIFT)
19 static inline long stub_syscall2(long syscall, long arg1, long arg2)
21 long ret;
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);
31 static inline long stub_syscall3(long syscall, long arg1, long arg2, long arg3)
33 __asm__("movl %0, %%edx; " : : "g" (arg3) : "%edx");
34 return(stub_syscall2(syscall, arg1, arg2));
37 static inline long stub_syscall4(long syscall, long arg1, long arg2, long arg3,
38 long arg4)
40 __asm__("movl %0, %%esi; " : : "g" (arg4) : "%esi");
41 return(stub_syscall3(syscall, arg1, arg2, arg3));
44 static inline long stub_syscall6(long syscall, long arg1, long arg2, long arg3,
45 long arg4, long arg5, long arg6)
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);
60 static inline void trap_myself(void)
62 __asm("int3");
65 #endif