Linux-2.6.12-rc2
[cascardo/linux.git] / arch / um / include / ptrace_user.h
1 /* 
2  * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3  * Licensed under the GPL
4  */
5
6 #ifndef __PTRACE_USER_H__
7 #define __PTRACE_USER_H__
8
9 #include "sysdep/ptrace_user.h"
10
11 extern int ptrace_getregs(long pid, unsigned long *regs_out);
12 extern int ptrace_setregs(long pid, unsigned long *regs_in);
13 extern int ptrace_getfpregs(long pid, unsigned long *regs_out);
14 extern int ptrace_setfpregs(long pid, unsigned long *regs);
15 extern void arch_enter_kernel(void *task, int pid);
16 extern void arch_leave_kernel(void *task, int pid);
17 extern void ptrace_pokeuser(unsigned long addr, unsigned long data);
18
19
20 /* syscall emulation path in ptrace */
21
22 #ifndef PTRACE_SYSEMU
23 #define PTRACE_SYSEMU 31
24 #endif
25 #ifndef PTRACE_SYSEMU_SINGLESTEP
26 #define PTRACE_SYSEMU_SINGLESTEP 32
27 #endif
28
29 /* On architectures, that started to support PTRACE_O_TRACESYSGOOD
30  * in linux 2.4, there are two different definitions of
31  * PTRACE_SETOPTIONS: linux 2.4 uses 21 while linux 2.6 uses 0x4200.
32  * For binary compatibility, 2.6 also supports the old "21", named
33  * PTRACE_OLDSETOPTION. On these architectures, UML always must use
34  * "21", to ensure the kernel runs on 2.4 and 2.6 host without
35  * recompilation. So, we use PTRACE_OLDSETOPTIONS in UML.
36  * We also want to be able to build the kernel on 2.4, which doesn't
37  * have PTRACE_OLDSETOPTIONS. So, if it is missing, we declare
38  * PTRACE_OLDSETOPTIONS to to be the same as PTRACE_SETOPTIONS.
39  *
40  * On architectures, that start to support PTRACE_O_TRACESYSGOOD on
41  * linux 2.6, PTRACE_OLDSETOPTIONS never is defined, and also isn't
42  * supported by the host kernel. In that case, our trick lets us use
43  * the new 0x4200 with the name PTRACE_OLDSETOPTIONS.
44  */
45 #ifndef PTRACE_OLDSETOPTIONS
46 #define PTRACE_OLDSETOPTIONS PTRACE_SETOPTIONS
47 #endif
48
49 void set_using_sysemu(int value);
50 int get_using_sysemu(void);
51 extern int sysemu_supported;
52
53 #define SELECT_PTRACE_OPERATION(sysemu_mode, singlestep_mode) \
54         (((int[3][3] ) { \
55                 { PTRACE_SYSCALL, PTRACE_SYSCALL, PTRACE_SINGLESTEP }, \
56                 { PTRACE_SYSEMU, PTRACE_SYSEMU, PTRACE_SINGLESTEP }, \
57                 { PTRACE_SYSEMU, PTRACE_SYSEMU_SINGLESTEP, PTRACE_SYSEMU_SINGLESTEP }}) \
58                 [sysemu_mode][singlestep_mode])
59
60 #endif