PageRenderTime 723ms CodeModel.GetById 32ms RepoModel.GetById 0ms app.codeStats 0ms

/thirdparty/breakpad/google_breakpad/common/minidump_cpu_arm.h

http://github.com/tomahawk-player/tomahawk
C Header | 151 lines | 32 code | 18 blank | 101 comment | 0 complexity | c788b0f893362c87040ffbb21a5279a5 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-3-Clause, GPL-3.0, GPL-2.0
  1. /* Copyright (c) 2009, Google Inc.
  2. * All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions are
  6. * met:
  7. *
  8. * * Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * * Redistributions in binary form must reproduce the above
  11. * copyright notice, this list of conditions and the following disclaimer
  12. * in the documentation and/or other materials provided with the
  13. * distribution.
  14. * * Neither the name of Google Inc. nor the names of its
  15. * contributors may be used to endorse or promote products derived from
  16. * this software without specific prior written permission.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  19. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  20. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  21. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  22. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  23. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  24. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  25. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  26. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  28. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
  29. /* minidump_format.h: A cross-platform reimplementation of minidump-related
  30. * portions of DbgHelp.h from the Windows Platform SDK.
  31. *
  32. * (This is C99 source, please don't corrupt it with C++.)
  33. *
  34. * This file contains the necessary definitions to read minidump files
  35. * produced on ARM. These files may be read on any platform provided
  36. * that the alignments of these structures on the processing system are
  37. * identical to the alignments of these structures on the producing system.
  38. * For this reason, precise-sized types are used. The structures defined
  39. * by this file have been laid out to minimize alignment problems by
  40. * ensuring that all members are aligned on their natural boundaries.
  41. * In some cases, tail-padding may be significant when different ABIs specify
  42. * different tail-padding behaviors. To avoid problems when reading or
  43. * writing affected structures, MD_*_SIZE macros are provided where needed,
  44. * containing the useful size of the structures without padding.
  45. *
  46. * Structures that are defined by Microsoft to contain a zero-length array
  47. * are instead defined here to contain an array with one element, as
  48. * zero-length arrays are forbidden by standard C and C++. In these cases,
  49. * *_minsize constants are provided to be used in place of sizeof. For a
  50. * cleaner interface to these sizes when using C++, see minidump_size.h.
  51. *
  52. * These structures are also sufficient to populate minidump files.
  53. *
  54. * Because precise data type sizes are crucial for this implementation to
  55. * function properly and portably, a set of primitive types with known sizes
  56. * are used as the basis of each structure defined by this file.
  57. *
  58. * Author: Julian Seward
  59. */
  60. /*
  61. * ARM support
  62. */
  63. #ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_ARM_H__
  64. #define GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_ARM_H__
  65. #define MD_FLOATINGSAVEAREA_ARM_FPR_COUNT 32
  66. #define MD_FLOATINGSAVEAREA_ARM_FPEXTRA_COUNT 8
  67. /*
  68. * Note that these structures *do not* map directly to the CONTEXT
  69. * structure defined in WinNT.h in the Windows Mobile SDK. That structure
  70. * does not accomodate VFPv3, and I'm unsure if it was ever used in the
  71. * wild anyway, as Windows CE only seems to produce "cedumps" which
  72. * are not exactly minidumps.
  73. */
  74. typedef struct {
  75. u_int64_t fpscr; /* FPU status register */
  76. /* 32 64-bit floating point registers, d0 .. d31. */
  77. u_int64_t regs[MD_FLOATINGSAVEAREA_ARM_FPR_COUNT];
  78. /* Miscellaneous control words */
  79. u_int32_t extra[MD_FLOATINGSAVEAREA_ARM_FPEXTRA_COUNT];
  80. } MDFloatingSaveAreaARM;
  81. #define MD_CONTEXT_ARM_GPR_COUNT 16
  82. typedef struct {
  83. /* The next field determines the layout of the structure, and which parts
  84. * of it are populated
  85. */
  86. u_int32_t context_flags;
  87. /* 16 32-bit integer registers, r0 .. r15
  88. * Note the following fixed uses:
  89. * r13 is the stack pointer
  90. * r14 is the link register
  91. * r15 is the program counter
  92. */
  93. u_int32_t iregs[MD_CONTEXT_ARM_GPR_COUNT];
  94. /* CPSR (flags, basically): 32 bits:
  95. bit 31 - N (negative)
  96. bit 30 - Z (zero)
  97. bit 29 - C (carry)
  98. bit 28 - V (overflow)
  99. bit 27 - Q (saturation flag, sticky)
  100. All other fields -- ignore */
  101. u_int32_t cpsr;
  102. /* The next field is included with MD_CONTEXT_ARM_FLOATING_POINT */
  103. MDFloatingSaveAreaARM float_save;
  104. } MDRawContextARM;
  105. /* Indices into iregs for registers with a dedicated or conventional
  106. * purpose.
  107. */
  108. enum MDARMRegisterNumbers {
  109. MD_CONTEXT_ARM_REG_IOS_FP = 7,
  110. MD_CONTEXT_ARM_REG_FP = 11,
  111. MD_CONTEXT_ARM_REG_SP = 13,
  112. MD_CONTEXT_ARM_REG_LR = 14,
  113. MD_CONTEXT_ARM_REG_PC = 15
  114. };
  115. /* For (MDRawContextARM).context_flags. These values indicate the type of
  116. * context stored in the structure. */
  117. /* CONTEXT_ARM from the Windows CE 5.0 SDK. This value isn't correct
  118. * because this bit can be used for flags. Presumably this value was
  119. * never actually used in minidumps, but only in "CEDumps" which
  120. * are a whole parallel minidump file format for Windows CE.
  121. * Therefore, Breakpad defines its own value for ARM CPUs.
  122. */
  123. #define MD_CONTEXT_ARM_OLD 0x00000040
  124. /* This value was chosen to avoid likely conflicts with MD_CONTEXT_*
  125. * for other CPUs. */
  126. #define MD_CONTEXT_ARM 0x40000000
  127. #define MD_CONTEXT_ARM_INTEGER (MD_CONTEXT_ARM | 0x00000002)
  128. #define MD_CONTEXT_ARM_FLOATING_POINT (MD_CONTEXT_ARM | 0x00000004)
  129. #define MD_CONTEXT_ARM_FULL (MD_CONTEXT_ARM_INTEGER | \
  130. MD_CONTEXT_ARM_FLOATING_POINT)
  131. #define MD_CONTEXT_ARM_ALL (MD_CONTEXT_ARM_INTEGER | \
  132. MD_CONTEXT_ARM_FLOATING_POINT)
  133. #endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_ARM_H__ */