/thirdparty/breakpad/google_breakpad/common/minidump_cpu_sparc.h

http://github.com/tomahawk-player/tomahawk · C++ Header · 158 lines · 32 code · 22 blank · 104 comment · 0 complexity · 692262c5b5cfd816c47e6b413c2fb627 MD5 · raw file

  1. /* Copyright (c) 2006, 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 sparc. 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 ensuring
  40. * ensuring that all members are aligned on their natural boundaries. In
  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. * These definitions may be extended to support handling minidump files
  55. * for other CPUs and other operating systems.
  56. *
  57. * Because precise data type sizes are crucial for this implementation to
  58. * function properly and portably in terms of interoperability with minidumps
  59. * produced by DbgHelp on Windows, a set of primitive types with known sizes
  60. * are used as the basis of each structure defined by this file. DbgHelp
  61. * on Windows is assumed to be the reference implementation; this file
  62. * seeks to provide a cross-platform compatible implementation. To avoid
  63. * collisions with the types and values defined and used by DbgHelp in the
  64. * event that this implementation is used on Windows, each type and value
  65. * defined here is given a new name, beginning with "MD". Names of the
  66. * equivalent types and values in the Windows Platform SDK are given in
  67. * comments.
  68. *
  69. * Author: Mark Mentovai
  70. * Change to split into its own file: Neal Sidhwaney */
  71. /*
  72. * SPARC support, see (solaris)sys/procfs_isa.h also
  73. */
  74. #ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_SPARC_H__
  75. #define GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_SPARC_H__
  76. #define MD_FLOATINGSAVEAREA_SPARC_FPR_COUNT 32
  77. typedef struct {
  78. /* FPU floating point regs */
  79. u_int64_t regs[MD_FLOATINGSAVEAREA_SPARC_FPR_COUNT];
  80. u_int64_t filler;
  81. u_int64_t fsr; /* FPU status register */
  82. } MDFloatingSaveAreaSPARC; /* FLOATING_SAVE_AREA */
  83. #define MD_CONTEXT_SPARC_GPR_COUNT 32
  84. typedef struct {
  85. /* The next field determines the layout of the structure, and which parts
  86. * of it are populated
  87. */
  88. u_int32_t context_flags;
  89. u_int32_t flag_pad;
  90. /*
  91. * General register access (SPARC).
  92. * Don't confuse definitions here with definitions in <sys/regset.h>.
  93. * Registers are 32 bits for ILP32, 64 bits for LP64.
  94. * SPARC V7/V8 is for 32bit, SPARC V9 is for 64bit
  95. */
  96. /* 32 Integer working registers */
  97. /* g_r[0-7] global registers(g0-g7)
  98. * g_r[8-15] out registers(o0-o7)
  99. * g_r[16-23] local registers(l0-l7)
  100. * g_r[24-31] in registers(i0-i7)
  101. */
  102. u_int64_t g_r[MD_CONTEXT_SPARC_GPR_COUNT];
  103. /* several control registers */
  104. /* Processor State register(PSR) for SPARC V7/V8
  105. * Condition Code register (CCR) for SPARC V9
  106. */
  107. u_int64_t ccr;
  108. u_int64_t pc; /* Program Counter register (PC) */
  109. u_int64_t npc; /* Next Program Counter register (nPC) */
  110. u_int64_t y; /* Y register (Y) */
  111. /* Address Space Identifier register (ASI) for SPARC V9
  112. * WIM for SPARC V7/V8
  113. */
  114. u_int64_t asi;
  115. /* Floating-Point Registers State register (FPRS) for SPARC V9
  116. * TBR for for SPARC V7/V8
  117. */
  118. u_int64_t fprs;
  119. /* The next field is included with MD_CONTEXT_SPARC_FLOATING_POINT */
  120. MDFloatingSaveAreaSPARC float_save;
  121. } MDRawContextSPARC; /* CONTEXT_SPARC */
  122. /* For (MDRawContextSPARC).context_flags. These values indicate the type of
  123. * context stored in the structure. MD_CONTEXT_SPARC is Breakpad-defined. Its
  124. * value was chosen to avoid likely conflicts with MD_CONTEXT_* for other
  125. * CPUs. */
  126. #define MD_CONTEXT_SPARC 0x10000000
  127. #define MD_CONTEXT_SPARC_CONTROL (MD_CONTEXT_SPARC | 0x00000001)
  128. #define MD_CONTEXT_SPARC_INTEGER (MD_CONTEXT_SPARC | 0x00000002)
  129. #define MD_CONTEXT_SAPARC_FLOATING_POINT (MD_CONTEXT_SPARC | 0x00000004)
  130. #define MD_CONTEXT_SAPARC_EXTRA (MD_CONTEXT_SPARC | 0x00000008)
  131. #define MD_CONTEXT_SPARC_FULL (MD_CONTEXT_SPARC_CONTROL | \
  132. MD_CONTEXT_SPARC_INTEGER)
  133. #define MD_CONTEXT_SPARC_ALL (MD_CONTEXT_SPARC_FULL | \
  134. MD_CONTEXT_SAPARC_FLOATING_POINT | \
  135. MD_CONTEXT_SAPARC_EXTRA)
  136. #endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_SPARC_H__ */