ptrace_user.h 2.1 KB

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