19276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek/* Copyright (c) 2009, Google Inc. 29276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * All rights reserved. 39276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * 49276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * Redistribution and use in source and binary forms, with or without 59276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * modification, are permitted provided that the following conditions are 69276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * met: 79276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * 89276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * * Redistributions of source code must retain the above copyright 99276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * notice, this list of conditions and the following disclaimer. 109276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * * Redistributions in binary form must reproduce the above 119276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * copyright notice, this list of conditions and the following disclaimer 129276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * in the documentation and/or other materials provided with the 139276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * distribution. 149276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * * Neither the name of Google Inc. nor the names of its 159276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * contributors may be used to endorse or promote products derived from 169276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * this software without specific prior written permission. 179276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * 189276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 199276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 209276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 219276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 229276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 239276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 249276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 259276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 269276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 279276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 289276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 299276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek 309276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek/* minidump_format.h: A cross-platform reimplementation of minidump-related 319276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * portions of DbgHelp.h from the Windows Platform SDK. 329276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * 339276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * (This is C99 source, please don't corrupt it with C++.) 349276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * 359276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * This file contains the necessary definitions to read minidump files 369276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * produced on ARM. These files may be read on any platform provided 379276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * that the alignments of these structures on the processing system are 389276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * identical to the alignments of these structures on the producing system. 399276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * For this reason, precise-sized types are used. The structures defined 409276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * by this file have been laid out to minimize alignment problems by 419276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * ensuring that all members are aligned on their natural boundaries. 429276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * In some cases, tail-padding may be significant when different ABIs specify 439276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * different tail-padding behaviors. To avoid problems when reading or 449276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * writing affected structures, MD_*_SIZE macros are provided where needed, 459276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * containing the useful size of the structures without padding. 469276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * 479276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * Structures that are defined by Microsoft to contain a zero-length array 489276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * are instead defined here to contain an array with one element, as 499276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * zero-length arrays are forbidden by standard C and C++. In these cases, 509276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * *_minsize constants are provided to be used in place of sizeof. For a 519276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * cleaner interface to these sizes when using C++, see minidump_size.h. 529276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * 539276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * These structures are also sufficient to populate minidump files. 549276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * 559276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * Because precise data type sizes are crucial for this implementation to 569276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * function properly and portably, a set of primitive types with known sizes 579276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * are used as the basis of each structure defined by this file. 589276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * 599276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * Author: Julian Seward 609276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek */ 619276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek 629276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek/* 639276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * ARM support 649276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek */ 659276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek 669276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_ARM_H__ 679276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_ARM_H__ 689276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek 699276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek#define MD_FLOATINGSAVEAREA_ARM_FPR_COUNT 32 709276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek#define MD_FLOATINGSAVEAREA_ARM_FPEXTRA_COUNT 8 719276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek 729276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek/* 739276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * Note that these structures *do not* map directly to the CONTEXT 749276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * structure defined in WinNT.h in the Windows Mobile SDK. That structure 759276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * does not accomodate VFPv3, and I'm unsure if it was ever used in the 769276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * wild anyway, as Windows CE only seems to produce "cedumps" which 779276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * are not exactly minidumps. 789276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek */ 799276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarektypedef struct { 806162aed3c3fcfc53373c963ac375d39a5dfa5a25ted.mielczarek@gmail.com uint64_t fpscr; /* FPU status register */ 819276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek 829276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek /* 32 64-bit floating point registers, d0 .. d31. */ 836162aed3c3fcfc53373c963ac375d39a5dfa5a25ted.mielczarek@gmail.com uint64_t regs[MD_FLOATINGSAVEAREA_ARM_FPR_COUNT]; 849276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek 859276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek /* Miscellaneous control words */ 866162aed3c3fcfc53373c963ac375d39a5dfa5a25ted.mielczarek@gmail.com uint32_t extra[MD_FLOATINGSAVEAREA_ARM_FPEXTRA_COUNT]; 879276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek} MDFloatingSaveAreaARM; 889276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek 899276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek#define MD_CONTEXT_ARM_GPR_COUNT 16 909276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek 919276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarektypedef struct { 929276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek /* The next field determines the layout of the structure, and which parts 939276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * of it are populated 949276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek */ 956162aed3c3fcfc53373c963ac375d39a5dfa5a25ted.mielczarek@gmail.com uint32_t context_flags; 969276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek 979276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek /* 16 32-bit integer registers, r0 .. r15 989276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * Note the following fixed uses: 999276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * r13 is the stack pointer 1009276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * r14 is the link register 1019276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * r15 is the program counter 1029276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek */ 1036162aed3c3fcfc53373c963ac375d39a5dfa5a25ted.mielczarek@gmail.com uint32_t iregs[MD_CONTEXT_ARM_GPR_COUNT]; 1049276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek 1059276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek /* CPSR (flags, basically): 32 bits: 1069276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek bit 31 - N (negative) 1079276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek bit 30 - Z (zero) 1089276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek bit 29 - C (carry) 1099276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek bit 28 - V (overflow) 1109276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek bit 27 - Q (saturation flag, sticky) 1119276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek All other fields -- ignore */ 1126162aed3c3fcfc53373c963ac375d39a5dfa5a25ted.mielczarek@gmail.com uint32_t cpsr; 1139276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek 1149276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek /* The next field is included with MD_CONTEXT_ARM_FLOATING_POINT */ 1159276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek MDFloatingSaveAreaARM float_save; 1169276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek 1179276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek} MDRawContextARM; 1189276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek 1196162aed3c3fcfc53373c963ac375d39a5dfa5a25ted.mielczarek@gmail.com/* Indices into iregs for registers with a dedicated or conventional 120c609f474a955e1f617802ff1185efaa5ef9659f9jimblandy * purpose. 121c609f474a955e1f617802ff1185efaa5ef9659f9jimblandy */ 122c609f474a955e1f617802ff1185efaa5ef9659f9jimblandyenum MDARMRegisterNumbers { 1230fd250335b66b12609aaf1b749384b711ecddaa9qsr@chromium.org MD_CONTEXT_ARM_REG_IOS_FP = 7, 1240fd250335b66b12609aaf1b749384b711ecddaa9qsr@chromium.org MD_CONTEXT_ARM_REG_FP = 11, 1250fd250335b66b12609aaf1b749384b711ecddaa9qsr@chromium.org MD_CONTEXT_ARM_REG_SP = 13, 1260fd250335b66b12609aaf1b749384b711ecddaa9qsr@chromium.org MD_CONTEXT_ARM_REG_LR = 14, 1270fd250335b66b12609aaf1b749384b711ecddaa9qsr@chromium.org MD_CONTEXT_ARM_REG_PC = 15 128c609f474a955e1f617802ff1185efaa5ef9659f9jimblandy}; 129c609f474a955e1f617802ff1185efaa5ef9659f9jimblandy 1309276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek/* For (MDRawContextARM).context_flags. These values indicate the type of 1319276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek * context stored in the structure. */ 1321a1890a52aaf8bfbea34a8d918423e6c81f3ea80ted.mielczarek/* CONTEXT_ARM from the Windows CE 5.0 SDK. This value isn't correct 1331a1890a52aaf8bfbea34a8d918423e6c81f3ea80ted.mielczarek * because this bit can be used for flags. Presumably this value was 1341a1890a52aaf8bfbea34a8d918423e6c81f3ea80ted.mielczarek * never actually used in minidumps, but only in "CEDumps" which 1351a1890a52aaf8bfbea34a8d918423e6c81f3ea80ted.mielczarek * are a whole parallel minidump file format for Windows CE. 1361a1890a52aaf8bfbea34a8d918423e6c81f3ea80ted.mielczarek * Therefore, Breakpad defines its own value for ARM CPUs. 1371a1890a52aaf8bfbea34a8d918423e6c81f3ea80ted.mielczarek */ 1381a1890a52aaf8bfbea34a8d918423e6c81f3ea80ted.mielczarek#define MD_CONTEXT_ARM_OLD 0x00000040 1391a1890a52aaf8bfbea34a8d918423e6c81f3ea80ted.mielczarek/* This value was chosen to avoid likely conflicts with MD_CONTEXT_* 1401a1890a52aaf8bfbea34a8d918423e6c81f3ea80ted.mielczarek * for other CPUs. */ 1411a1890a52aaf8bfbea34a8d918423e6c81f3ea80ted.mielczarek#define MD_CONTEXT_ARM 0x40000000 1429276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek#define MD_CONTEXT_ARM_INTEGER (MD_CONTEXT_ARM | 0x00000002) 1439276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek#define MD_CONTEXT_ARM_FLOATING_POINT (MD_CONTEXT_ARM | 0x00000004) 1449276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek 1459276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek#define MD_CONTEXT_ARM_FULL (MD_CONTEXT_ARM_INTEGER | \ 1469276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek MD_CONTEXT_ARM_FLOATING_POINT) 1479276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek 1489276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek#define MD_CONTEXT_ARM_ALL (MD_CONTEXT_ARM_INTEGER | \ 1499276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek MD_CONTEXT_ARM_FLOATING_POINT) 1509276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek 1519276b0d3017ad5ca93c8b593cacf317e1eaa114eted.mielczarek#endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_ARM_H__ */ 152