ptrace.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. #ifndef ARCH_ARM_PTRACE_H
  2. #define ARCH_ARM_PTRACE_H
  3. /*
  4. * Copyright (C) 2008 by Duane Ellis
  5. *
  6. * All rights reserved.
  7. *
  8. * The original code had been released as part of the LoastARM Project
  9. * under GPL Version 2 and is published here under the following license
  10. * with kind permission from the author:
  11. *
  12. * Redistribution and use in source and binary forms, with or without
  13. * modification, are permitted provided that the following conditions
  14. * are met:
  15. *
  16. * 1. Redistributions of source code must retain the above copyright
  17. * notice, this list of conditions and the following disclaimer.
  18. * 2. Redistributions in binary form must reproduce the above copyright
  19. * notice, this list of conditions and the following disclaimer in the
  20. * documentation and/or other materials provided with the distribution.
  21. * 3. Neither the name of the copyright holders nor the names of
  22. * contributors may be used to endorse or promote products derived
  23. * from this software without specific prior written permission.
  24. *
  25. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  26. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  27. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  28. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  29. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  30. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  31. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  32. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  33. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  34. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  35. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  36. * SUCH DAMAGE.
  37. *
  38. * For additional information see http://lostarm.sourceforge.net/
  39. */
  40. /*!
  41. * \file include/arch/arm/ptrace.h
  42. *
  43. * \verbatim
  44. * $Id: ptrace.h 4115 2012-04-12 21:06:13Z olereinhardt $
  45. * \endverbatim
  46. */
  47. /*
  48. * Names are identical, so that this 'plays nicely with' linux
  49. * documentation and other associated code.
  50. */
  51. #define PTRACE_R0_idx 0
  52. #define PTRACE_R1_idx 1
  53. #define PTRACE_R2_idx 2
  54. #define PTRACE_R3_idx 3
  55. #define PTRACE_R4_idx 4
  56. #define PTRACE_R5_idx 5
  57. #define PTRACE_R6_idx 6
  58. #define PTRACE_R7_idx 7
  59. #define PTRACE_R8_idx 8
  60. #define PTRACE_R9_idx 9
  61. #define PTRACE_R10_idx 10
  62. #define PTRACE_R11_idx 11
  63. #define PTRACE_R12_idx 12
  64. #define PTRACE_R13_idx 13
  65. #define PTRACE_SP_idx PTRACE_R13_idx
  66. #define PTRACE_R14_idx 14
  67. #define PTRACE_LR_idx PTRACE_R14_idx
  68. #define PTRACE_R15_idx 15
  69. #define PTRACE_PC_idx PTRACE_R15_idx
  70. #define PTRACE_CPSR_idx 16
  71. #define PTRACE_R0_retval_idx 17
  72. #define PTRACE_FRAMETYPE_idx 18
  73. #define PTRACE_SWICODE_idx 19
  74. #define PTRACE_FRAME_size 20 /* in bytes */
  75. #define ARM_CPSR_V_BIT (1<<28)
  76. #define ARM_CPSR_C_BIT (1<<29)
  77. #define ARM_CPSR_Z_BIT (1<<30)
  78. #define ARM_CPSR_N_BIT (1<<31)
  79. #define ARM_USR_MODE (0x10) /**< no priv mode */
  80. #define ARM_FIQ_MODE (0x11) /**< fiq occured */
  81. #define ARM_IRQ_MODE (0x12) /**< irq occured */
  82. #define ARM_SVC_MODE (0x13) /**< swi occured */
  83. #define ARM_ABT_MODE (0x17) /**< pfa or udf */
  84. #define ARM_UND_MODE (0x1b) /**< bad opcode */
  85. #define ARM_SYS_MODE (0x1f) /**< normal supervisor */
  86. #ifndef ARM_MODE_MASK
  87. #define ARM_MODE_MASK (0x1f)
  88. #endif
  89. #define PTRACE_FRAME_isirq(X) ( (X)->uregs[ PTRACE_FRAMETYPE ] < 32 )
  90. #define PTRACE_FRAMETYPE_reset 32 /* in vector order */
  91. #define PTRACE_FRAMETYPE_udf 33
  92. #define PTRACE_FRAMETYPE_swi 34
  93. #define PTRACE_FRAMETYPE_pfa 35
  94. #define PTRACE_FRAMETYPE_da 36
  95. #define PTRACE_FRAMETYPE_notused 37
  96. /* #define PTRACE_FRAMETYPE_irq is above, ie: 0..32 for each irq vector */
  97. #define PTRACE_FRAMETYPE_fiq 38
  98. #define PTRACE_FRAMETYPE_thread 39 /* thread saved state */
  99. #if __ASSEMBLER__
  100. /* nothing here */
  101. #else
  102. #if __cplusplus
  103. extern "C" {
  104. #endif
  105. struct pt_regs {
  106. long uregs[ 20 ];
  107. };
  108. void ARM_UDF_Handler( struct pt_regs *p );
  109. void ARM_SWI_Handler( struct pt_regs *p );
  110. void ARM_PFA_Handler( struct pt_regs *p );
  111. void ARM_DA_Handler ( struct pt_regs *p );
  112. void ARM_IRQ_Handler( struct pt_regs *p );
  113. void ARM_FIQ_Handler( struct pt_regs *p );
  114. void ARM_NOTUSED_Handler( struct pt_regs *p );
  115. void ARM_COMMON_Handler_crash( struct pt_regs *p, const char *name );
  116. #if __cplusplus
  117. }
  118. #endif
  119. #endif /* __ASSEMBLER__ */
  120. #endif /* CPU_ARM_PTRACE_H */