ptrace.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * Copyright (C) 2013 Altera Corporation
  3. * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
  4. * Copyright (C) 2004 Microtronix Datacom Ltd
  5. *
  6. * based on m68k asm/processor.h
  7. *
  8. * This file is subject to the terms and conditions of the GNU General Public
  9. * License. See the file "COPYING" in the main directory of this archive
  10. * for more details.
  11. */
  12. #ifndef _ASM_NIOS2_PTRACE_H
  13. #define _ASM_NIOS2_PTRACE_H
  14. #include <uapi/asm/ptrace.h>
  15. /* This struct defines the way the registers are stored on the
  16. stack during a system call. */
  17. #ifndef __ASSEMBLY__
  18. struct pt_regs {
  19. unsigned long r8; /* r8-r15 Caller-saved GP registers */
  20. unsigned long r9;
  21. unsigned long r10;
  22. unsigned long r11;
  23. unsigned long r12;
  24. unsigned long r13;
  25. unsigned long r14;
  26. unsigned long r15;
  27. unsigned long r1; /* Assembler temporary */
  28. unsigned long r2; /* Retval LS 32bits */
  29. unsigned long r3; /* Retval MS 32bits */
  30. unsigned long r4; /* r4-r7 Register arguments */
  31. unsigned long r5;
  32. unsigned long r6;
  33. unsigned long r7;
  34. unsigned long orig_r2; /* Copy of r2 ?? */
  35. unsigned long ra; /* Return address */
  36. unsigned long fp; /* Frame pointer */
  37. unsigned long sp; /* Stack pointer */
  38. unsigned long gp; /* Global pointer */
  39. unsigned long estatus;
  40. unsigned long ea; /* Exception return address (pc) */
  41. unsigned long orig_r7;
  42. };
  43. /*
  44. * This is the extended stack used by signal handlers and the context
  45. * switcher: it's pushed after the normal "struct pt_regs".
  46. */
  47. struct switch_stack {
  48. unsigned long r16; /* r16-r23 Callee-saved GP registers */
  49. unsigned long r17;
  50. unsigned long r18;
  51. unsigned long r19;
  52. unsigned long r20;
  53. unsigned long r21;
  54. unsigned long r22;
  55. unsigned long r23;
  56. unsigned long fp;
  57. unsigned long gp;
  58. unsigned long ra;
  59. };
  60. #define user_mode(regs) (((regs)->estatus & ESTATUS_EU))
  61. #define instruction_pointer(regs) ((regs)->ra)
  62. #define profile_pc(regs) instruction_pointer(regs)
  63. #define user_stack_pointer(regs) ((regs)->sp)
  64. extern void show_regs(struct pt_regs *);
  65. #define current_pt_regs() \
  66. ((struct pt_regs *)((unsigned long)current_thread_info() + THREAD_SIZE)\
  67. - 1)
  68. int do_syscall_trace_enter(void);
  69. void do_syscall_trace_exit(void);
  70. #endif /* __ASSEMBLY__ */
  71. #endif /* _ASM_NIOS2_PTRACE_H */