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 sparc. 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 * SPARC support, see (solaris)sys/procfs_isa.h also 00075 */ 00076 00077 #ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_SPARC_H__ 00078 #define GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_SPARC_H__ 00079 00080 #define MD_FLOATINGSAVEAREA_SPARC_FPR_COUNT 32 00081 00082 typedef struct { 00083 00084 /* FPU floating point regs */ 00085 uint64_t regs[MD_FLOATINGSAVEAREA_SPARC_FPR_COUNT]; 00086 00087 uint64_t filler; 00088 uint64_t fsr; /* FPU status register */ 00089 } MDFloatingSaveAreaSPARC; /* FLOATING_SAVE_AREA */ 00090 00091 #define MD_CONTEXT_SPARC_GPR_COUNT 32 00092 00093 typedef struct { 00094 /* The next field determines the layout of the structure, and which parts 00095 * of it are populated 00096 */ 00097 uint32_t context_flags; 00098 uint32_t flag_pad; 00099 /* 00100 * General register access (SPARC). 00101 * Don't confuse definitions here with definitions in <sys/regset.h>. 00102 * Registers are 32 bits for ILP32, 64 bits for LP64. 00103 * SPARC V7/V8 is for 32bit, SPARC V9 is for 64bit 00104 */ 00105 00106 /* 32 Integer working registers */ 00107 00108 /* g_r[0-7] global registers(g0-g7) 00109 * g_r[8-15] out registers(o0-o7) 00110 * g_r[16-23] local registers(l0-l7) 00111 * g_r[24-31] in registers(i0-i7) 00112 */ 00113 uint64_t g_r[MD_CONTEXT_SPARC_GPR_COUNT]; 00114 00115 /* several control registers */ 00116 00117 /* Processor State register(PSR) for SPARC V7/V8 00118 * Condition Code register (CCR) for SPARC V9 00119 */ 00120 uint64_t ccr; 00121 00122 uint64_t pc; /* Program Counter register (PC) */ 00123 uint64_t npc; /* Next Program Counter register (nPC) */ 00124 uint64_t y; /* Y register (Y) */ 00125 00126 /* Address Space Identifier register (ASI) for SPARC V9 00127 * WIM for SPARC V7/V8 00128 */ 00129 uint64_t asi; 00130 00131 /* Floating-Point Registers State register (FPRS) for SPARC V9 00132 * TBR for for SPARC V7/V8 00133 */ 00134 uint64_t fprs; 00135 00136 /* The next field is included with MD_CONTEXT_SPARC_FLOATING_POINT */ 00137 MDFloatingSaveAreaSPARC float_save; 00138 00139 } MDRawContextSPARC; /* CONTEXT_SPARC */ 00140 00141 /* For (MDRawContextSPARC).context_flags. These values indicate the type of 00142 * context stored in the structure. MD_CONTEXT_SPARC is Breakpad-defined. Its 00143 * value was chosen to avoid likely conflicts with MD_CONTEXT_* for other 00144 * CPUs. */ 00145 #define MD_CONTEXT_SPARC 0x10000000 00146 #define MD_CONTEXT_SPARC_CONTROL (MD_CONTEXT_SPARC | 0x00000001) 00147 #define MD_CONTEXT_SPARC_INTEGER (MD_CONTEXT_SPARC | 0x00000002) 00148 #define MD_CONTEXT_SAPARC_FLOATING_POINT (MD_CONTEXT_SPARC | 0x00000004) 00149 #define MD_CONTEXT_SAPARC_EXTRA (MD_CONTEXT_SPARC | 0x00000008) 00150 00151 #define MD_CONTEXT_SPARC_FULL (MD_CONTEXT_SPARC_CONTROL | \ 00152 MD_CONTEXT_SPARC_INTEGER) 00153 00154 #define MD_CONTEXT_SPARC_ALL (MD_CONTEXT_SPARC_FULL | \ 00155 MD_CONTEXT_SAPARC_FLOATING_POINT | \ 00156 MD_CONTEXT_SAPARC_EXTRA) 00157 00158 #endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_SPARC_H__ */