Planeshift
|
00001 /* Copyright (c) 2006, Google Inc. 00002 * All rights reserved. 00003 * 00004 * Redistribution and use in source and binary forms, with or without 00005 * modification, are permitted provided that the following conditions are 00006 * met: 00007 * 00008 * * Redistributions of source code must retain the above copyright 00009 * notice, this list of conditions and the following disclaimer. 00010 * * Redistributions in binary form must reproduce the above 00011 * copyright notice, this list of conditions and the following disclaimer 00012 * in the documentation and/or other materials provided with the 00013 * distribution. 00014 * * Neither the name of Google Inc. nor the names of its 00015 * contributors may be used to endorse or promote products derived from 00016 * this software without specific prior written permission. 00017 * 00018 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00019 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00020 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00021 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00022 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00023 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00024 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00025 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00026 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00027 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00028 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 00029 00030 /* minidump_format.h: A cross-platform reimplementation of minidump-related 00031 * portions of DbgHelp.h from the Windows Platform SDK. 00032 * 00033 * (This is C99 source, please don't corrupt it with C++.) 00034 * 00035 * This file contains the necessary definitions to read minidump files 00036 * produced on ppc. These files may be read on any platform provided 00037 * that the alignments of these structures on the processing system are 00038 * identical to the alignments of these structures on the producing system. 00039 * For this reason, precise-sized types are used. The structures defined 00040 * by this file have been laid out to minimize alignment problems by ensuring 00041 * ensuring that all members are aligned on their natural boundaries. In 00042 * In some cases, tail-padding may be significant when different ABIs specify 00043 * different tail-padding behaviors. To avoid problems when reading or 00044 * writing affected structures, MD_*_SIZE macros are provided where needed, 00045 * containing the useful size of the structures without padding. 00046 * 00047 * Structures that are defined by Microsoft to contain a zero-length array 00048 * are instead defined here to contain an array with one element, as 00049 * zero-length arrays are forbidden by standard C and C++. In these cases, 00050 * *_minsize constants are provided to be used in place of sizeof. For a 00051 * cleaner interface to these sizes when using C++, see minidump_size.h. 00052 * 00053 * These structures are also sufficient to populate minidump files. 00054 * 00055 * These definitions may be extended to support handling minidump files 00056 * for other CPUs and other operating systems. 00057 * 00058 * Because precise data type sizes are crucial for this implementation to 00059 * function properly and portably in terms of interoperability with minidumps 00060 * produced by DbgHelp on Windows, a set of primitive types with known sizes 00061 * are used as the basis of each structure defined by this file. DbgHelp 00062 * on Windows is assumed to be the reference implementation; this file 00063 * seeks to provide a cross-platform compatible implementation. To avoid 00064 * collisions with the types and values defined and used by DbgHelp in the 00065 * event that this implementation is used on Windows, each type and value 00066 * defined here is given a new name, beginning with "MD". Names of the 00067 * equivalent types and values in the Windows Platform SDK are given in 00068 * comments. 00069 * 00070 * Author: Mark Mentovai 00071 * Change to split into its own file: Neal Sidhwaney */ 00072 00073 /* 00074 * Breakpad minidump extension for PowerPC support. Based on Darwin/Mac OS X' 00075 * mach/ppc/_types.h 00076 */ 00077 00078 #ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_PPC_H__ 00079 #define GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_PPC_H__ 00080 00081 #define MD_FLOATINGSAVEAREA_PPC_FPR_COUNT 32 00082 00083 typedef struct { 00084 /* fpregs is a double[32] in mach/ppc/_types.h, but a uint64_t is used 00085 * here for precise sizing. */ 00086 uint64_t fpregs[MD_FLOATINGSAVEAREA_PPC_FPR_COUNT]; 00087 uint32_t fpscr_pad; 00088 uint32_t fpscr; /* Status/control */ 00089 } MDFloatingSaveAreaPPC; /* Based on ppc_float_state */ 00090 00091 00092 #define MD_VECTORSAVEAREA_PPC_VR_COUNT 32 00093 00094 typedef struct { 00095 /* Vector registers (including vscr) are 128 bits, but mach/ppc/_types.h 00096 * exposes them as four 32-bit quantities. */ 00097 uint128_struct save_vr[MD_VECTORSAVEAREA_PPC_VR_COUNT]; 00098 uint128_struct save_vscr; /* Status/control */ 00099 uint32_t save_pad5[4]; 00100 uint32_t save_vrvalid; /* Indicates which vector registers are saved */ 00101 uint32_t save_pad6[7]; 00102 } MDVectorSaveAreaPPC; /* ppc_vector_state */ 00103 00104 00105 #define MD_CONTEXT_PPC_GPR_COUNT 32 00106 00107 /* Use the same 32-bit alignment when accessing this structure from 64-bit code 00108 * as is used natively in 32-bit code. #pragma pack is a MSVC extension 00109 * supported by gcc. */ 00110 #if defined(__SUNPRO_C) || defined(__SUNPRO_CC) 00111 #pragma pack(4) 00112 #else 00113 #pragma pack(push, 4) 00114 #endif 00115 00116 typedef struct { 00117 /* context_flags is not present in ppc_thread_state, but it aids 00118 * identification of MDRawContextPPC among other raw context types, 00119 * and it guarantees alignment when we get to float_save. */ 00120 uint32_t context_flags; 00121 00122 uint32_t srr0; /* Machine status save/restore: stores pc 00123 * (instruction) */ 00124 uint32_t srr1; /* Machine status save/restore: stores msr 00125 * (ps, program/machine state) */ 00126 /* ppc_thread_state contains 32 fields, r0 .. r31. Here, an array is 00127 * used for brevity. */ 00128 uint32_t gpr[MD_CONTEXT_PPC_GPR_COUNT]; 00129 uint32_t cr; /* Condition */ 00130 uint32_t xer; /* Integer (fiXed-point) exception */ 00131 uint32_t lr; /* Link */ 00132 uint32_t ctr; /* Count */ 00133 uint32_t mq; /* Multiply/Quotient (PPC 601, POWER only) */ 00134 uint32_t vrsave; /* Vector save */ 00135 00136 /* float_save and vector_save aren't present in ppc_thread_state, but 00137 * are represented in separate structures that still define a thread's 00138 * context. */ 00139 MDFloatingSaveAreaPPC float_save; 00140 MDVectorSaveAreaPPC vector_save; 00141 } MDRawContextPPC; /* Based on ppc_thread_state */ 00142 00143 #if defined(__SUNPRO_C) || defined(__SUNPRO_CC) 00144 #pragma pack(0) 00145 #else 00146 #pragma pack(pop) 00147 #endif 00148 00149 /* For (MDRawContextPPC).context_flags. These values indicate the type of 00150 * context stored in the structure. MD_CONTEXT_PPC is Breakpad-defined. Its 00151 * value was chosen to avoid likely conflicts with MD_CONTEXT_* for other 00152 * CPUs. */ 00153 #define MD_CONTEXT_PPC 0x20000000 00154 #define MD_CONTEXT_PPC_BASE (MD_CONTEXT_PPC | 0x00000001) 00155 #define MD_CONTEXT_PPC_FLOATING_POINT (MD_CONTEXT_PPC | 0x00000008) 00156 #define MD_CONTEXT_PPC_VECTOR (MD_CONTEXT_PPC | 0x00000020) 00157 00158 #define MD_CONTEXT_PPC_FULL MD_CONTEXT_PPC_BASE 00159 #define MD_CONTEXT_PPC_ALL (MD_CONTEXT_PPC_FULL | \ 00160 MD_CONTEXT_PPC_FLOATING_POINT | \ 00161 MD_CONTEXT_PPC_VECTOR) 00162 00163 #endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_PPC_H__ */