ptrace_user.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.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. /* syscall emulation path in ptrace */
  11. #ifndef PTRACE_SYSEMU
  12. #define PTRACE_SYSEMU 31
  13. #endif
  14. #ifndef PTRACE_SYSEMU_SINGLESTEP
  15. #define PTRACE_SYSEMU_SINGLESTEP 32
  16. #endif
  17. /* On architectures, that started to support PTRACE_O_TRACESYSGOOD
  18. * in linux 2.4, there are two different definitions of
  19. * PTRACE_SETOPTIONS: linux 2.4 uses 21 while linux 2.6 uses 0x4200.
  20. * For binary compatibility, 2.6 also supports the old "21", named
  21. * PTRACE_OLDSETOPTION. On these architectures, UML always must use
  22. * "21", to ensure the kernel runs on 2.4 and 2.6 host without
  23. * recompilation. So, we use PTRACE_OLDSETOPTIONS in UML.
  24. * We also want to be able to build the kernel on 2.4, which doesn't
  25. * have PTRACE_OLDSETOPTIONS. So, if it is missing, we declare
  26. * PTRACE_OLDSETOPTIONS to to be the same as PTRACE_SETOPTIONS.
  27. *
  28. * On architectures, that start to support PTRACE_O_TRACESYSGOOD on
  29. * linux 2.6, PTRACE_OLDSETOPTIONS never is defined, and also isn't
  30. * supported by the host kernel. In that case, our trick lets us use
  31. * the new 0x4200 with the name PTRACE_OLDSETOPTIONS.
  32. */
  33. #ifndef PTRACE_OLDSETOPTIONS
  34. #define PTRACE_OLDSETOPTIONS PTRACE_SETOPTIONS
  35. #endif
  36. void set_using_sysemu(int value);
  37. int get_using_sysemu(void);
  38. extern int sysemu_supported;
  39. #define SELECT_PTRACE_OPERATION(sysemu_mode, singlestep_mode) \
  40. (((int[3][3] ) { \
  41. { PTRACE_SYSCALL, PTRACE_SYSCALL, PTRACE_SINGLESTEP }, \
  42. { PTRACE_SYSEMU, PTRACE_SYSEMU, PTRACE_SINGLESTEP }, \
  43. { PTRACE_SYSEMU, PTRACE_SYSEMU_SINGLESTEP, \
  44. PTRACE_SYSEMU_SINGLESTEP } }) \
  45. [sysemu_mode][singlestep_mode])
  46. #endif