ptrace.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * Copyright 2010 Tilera Corporation. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation, version 2.
  7. *
  8. * This program is distributed in the hope that it will be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  11. * NON INFRINGEMENT. See the GNU General Public License for
  12. * more details.
  13. */
  14. #ifndef _ASM_TILE_PTRACE_H
  15. #define _ASM_TILE_PTRACE_H
  16. #include <linux/compiler.h>
  17. #ifndef __ASSEMBLY__
  18. /* Benefit from consistent use of "long" on all chips. */
  19. typedef unsigned long pt_reg_t;
  20. #endif
  21. #include <uapi/asm/ptrace.h>
  22. #define PTRACE_O_MASK_TILE (PTRACE_O_TRACEMIGRATE)
  23. #define PT_TRACE_MIGRATE PT_EVENT_FLAG(PTRACE_EVENT_MIGRATE)
  24. /* Flag bits in pt_regs.flags */
  25. #define PT_FLAGS_DISABLE_IRQ 1 /* on return to kernel, disable irqs */
  26. #define PT_FLAGS_CALLER_SAVES 2 /* caller-save registers are valid */
  27. #define PT_FLAGS_RESTORE_REGS 4 /* restore callee-save regs on return */
  28. #ifndef __ASSEMBLY__
  29. #define regs_return_value(regs) ((regs)->regs[0])
  30. #define instruction_pointer(regs) ((regs)->pc)
  31. #define profile_pc(regs) instruction_pointer(regs)
  32. #define user_stack_pointer(regs) ((regs)->sp)
  33. /* Does the process account for user or for system time? */
  34. #define user_mode(regs) (EX1_PL((regs)->ex1) < KERNEL_PL)
  35. /* Fill in a struct pt_regs with the current kernel registers. */
  36. struct pt_regs *get_pt_regs(struct pt_regs *);
  37. /* Trace the current syscall. */
  38. extern int do_syscall_trace_enter(struct pt_regs *regs);
  39. extern void do_syscall_trace_exit(struct pt_regs *regs);
  40. #define arch_has_single_step() (1)
  41. /*
  42. * A structure for all single-stepper state.
  43. *
  44. * Also update defines in assembler section if it changes
  45. */
  46. struct single_step_state {
  47. /* the page to which we will write hacked-up bundles */
  48. void __user *buffer;
  49. union {
  50. int flags;
  51. struct {
  52. unsigned long is_enabled:1, update:1, update_reg:6;
  53. };
  54. };
  55. unsigned long orig_pc; /* the original PC */
  56. unsigned long next_pc; /* return PC if no branch (PC + 1) */
  57. unsigned long branch_next_pc; /* return PC if we did branch/jump */
  58. unsigned long update_value; /* value to restore to update_target */
  59. };
  60. /* Single-step the instruction at regs->pc */
  61. extern void single_step_once(struct pt_regs *regs);
  62. /* Clean up after execve(). */
  63. extern void single_step_execve(void);
  64. struct task_struct;
  65. extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs);
  66. #ifdef __tilegx__
  67. /* We need this since sigval_t has a user pointer in it, for GETSIGINFO etc. */
  68. #define __ARCH_WANT_COMPAT_SYS_PTRACE
  69. #endif
  70. #endif /* !__ASSEMBLY__ */
  71. #define SINGLESTEP_STATE_MASK_IS_ENABLED 0x1
  72. #define SINGLESTEP_STATE_MASK_UPDATE 0x2
  73. #define SINGLESTEP_STATE_TARGET_LB 2
  74. #define SINGLESTEP_STATE_TARGET_UB 7
  75. #endif /* _ASM_TILE_PTRACE_H */