0009-third-party-breakpad-breakpad-header.patch 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. diff --git a/src/google_breakpad/common/minidump_cpu_riscv64.h b/src/google_breakpad/common/minidump_cpu_riscv64.h
  2. new file mode 100644
  3. index 00000000..801aa821
  4. --- /dev/null
  5. +++ b/src/google_breakpad/common/minidump_cpu_riscv64.h
  6. @@ -0,0 +1,121 @@
  7. +/* Copyright 2013 Google Inc.
  8. + * All rights reserved.
  9. + *
  10. + * Redistribution and use in source and binary forms, with or without
  11. + * modification, are permitted provided that the following conditions are
  12. + * met:
  13. + *
  14. + * * Redistributions of source code must retain the above copyright
  15. + * notice, this list of conditions and the following disclaimer.
  16. + * * Redistributions in binary form must reproduce the above
  17. + * copyright notice, this list of conditions and the following disclaimer
  18. + * in the documentation and/or other materials provided with the
  19. + * distribution.
  20. + * * Neither the name of Google Inc. nor the names of its
  21. + * contributors may be used to endorse or promote products derived from
  22. + * this software without specific prior written permission.
  23. + *
  24. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  25. + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  26. + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  27. + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  28. + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  29. + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  30. + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  31. + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  32. + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  33. + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  34. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
  35. +
  36. +/* minidump_format.h: A cross-platform reimplementation of minidump-related
  37. + * portions of DbgHelp.h from the Windows Platform SDK.
  38. + *
  39. + * (This is C99 source, please don't corrupt it with C.)
  40. + *
  41. + * This file contains the necessary definitions to read minidump files
  42. + * produced on ARM. These files may be read on any platform provided
  43. + * that the alignments of these structures on the processing system are
  44. + * identical to the alignments of these structures on the producing system.
  45. + * For this reason, precise-sized types are used. The structures defined
  46. + * by this file have been laid out to minimize alignment problems by
  47. + * ensuring that all members are aligned on their natural boundaries.
  48. + * In some cases, tail-padding may be significant when different ABIs specify
  49. + * different tail-padding behaviors. To avoid problems when reading or
  50. + * writing affected structures, MD_*_SIZE macros are provided where needed,
  51. + * containing the useful size of the structures without padding.
  52. + *
  53. + * Structures that are defined by Microsoft to contain a zero-length array
  54. + * are instead defined here to contain an array with one element, as
  55. + * zero-length arrays are forbidden by standard C and C. In these cases,
  56. + * *_minsize constants are provided to be used in place of sizeof. For a
  57. + * cleaner interface to these sizes when using C, see minidump_size.h.
  58. + *
  59. + * These structures are also sufficient to populate minidump files.
  60. + *
  61. + * Because precise data type sizes are crucial for this implementation to
  62. + * function properly and portably, a set of primitive types with known sizes
  63. + * are used as the basis of each structure defined by this file.
  64. + *
  65. + * Author: Colin Blundell
  66. + */
  67. +
  68. +/*
  69. + * RISCV64 support
  70. + */
  71. +
  72. +#ifndef GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_RISCV64_H__
  73. +#define GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_RISCV64_H__
  74. +
  75. +#include "google_breakpad/common/breakpad_types.h"
  76. +
  77. +#define MD_FLOATINGSAVEAREA_RISCV64_FPR_COUNT 32
  78. +#define MD_CONTEXT_RISCV64_GPR_COUNT 32
  79. +
  80. +typedef struct {
  81. + /* 32 64-bit floating point registers, f0 .. f31. */
  82. + uint64_t regs[MD_FLOATINGSAVEAREA_RISCV64_FPR_COUNT];
  83. +
  84. + uint32_t fcsr; /* FPU control and status register */
  85. +} MDFloatingSaveAreaRISCV64;
  86. +
  87. +/* For (MDRawContextRISCV64).context_flags. These values indicate the type of
  88. + * context stored in the structure. */
  89. +#define MD_CONTEXT_RISCV64 0x00400000
  90. +#define MD_CONTEXT_RISCV64_CONTROL (MD_CONTEXT_RISCV64 | 0x00000001)
  91. +#define MD_CONTEXT_RISCV64_INTEGER (MD_CONTEXT_RISCV64 | 0x00000002)
  92. +#define MD_CONTEXT_RISCV64_FLOATING_POINT (MD_CONTEXT_RISCV64 | 0x00000004)
  93. +#define MD_CONTEXT_RISCV64_DEBUG (MD_CONTEXT_RISCV64 | 0x00000008)
  94. +#define MD_CONTEXT_RISCV64_FULL (MD_CONTEXT_RISCV64_CONTROL | \
  95. + MD_CONTEXT_RISCV64_INTEGER | \
  96. + MD_CONTEXT_RISCV64_FLOATING_POINT)
  97. +#define MD_CONTEXT_RISCV64_ALL (MD_CONTEXT_RISCV64_FULL | MD_CONTEXT_RISCV64_DEBUG)
  98. +
  99. +typedef struct {
  100. + /* Determines which fields of this struct are populated */
  101. + uint32_t context_flags;
  102. +
  103. + /* 32 64-bit integer registers, x1 .. x31 the PC
  104. + * Note the following fixed uses:
  105. + * x8 is the frame pointer
  106. + * x1 is the link register
  107. + * x2 is the stack pointer
  108. + * The PC is effectively x0.
  109. + */
  110. + uint64_t iregs[MD_CONTEXT_RISCV64_GPR_COUNT];
  111. +
  112. + /* The next field is included with MD_CONTEXT64_ARM_FLOATING_POINT */
  113. + MDFloatingSaveAreaRISCV64 float_save;
  114. +
  115. +} MDRawContextRISCV64;
  116. +
  117. +/* Indices into iregs for registers with a dedicated or conventional
  118. + * purpose.
  119. + */
  120. +enum MDRISCV64RegisterNumbers {
  121. + MD_CONTEXT_RISCV64_REG_FP = 8,
  122. + MD_CONTEXT_RISCV64_REG_RA = 1,
  123. + MD_CONTEXT_RISCV64_REG_SP = 2,
  124. + MD_CONTEXT_RISCV64_REG_PC = 0
  125. +};
  126. +
  127. +#endif /* GOOGLE_BREAKPAD_COMMON_MINIDUMP_CPU_RISCV64_H__ */