aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDave Korn <dave.korn@artimi.com>2009-04-21 02:13:48 +0000
committerDave Korn <dave.korn@artimi.com>2009-04-21 02:13:48 +0000
commite48570bbf8cd1587282938c0fd5d4cbdc1537346 (patch)
tree859fa6c1c45c1f9fa2148aa12bfa5a5eec0d69d8 /include
parent73be22b84ad6944a1a46eb5982305012420855bc (diff)
downloadgdb-e48570bbf8cd1587282938c0fd5d4cbdc1537346.zip
gdb-e48570bbf8cd1587282938c0fd5d4cbdc1537346.tar.gz
gdb-e48570bbf8cd1587282938c0fd5d4cbdc1537346.tar.bz2
bfd/ChangeLog
2009-04-21 Kai Tietz <kai.tietz@onevision.com> * coff-x86_64.c (PEI_HEADERS): Protect includes. (bfd_pe_print_pdata): Remove #ifdef PE variation. * pei-x86_64.c (PEI_HEADERS): Define to prevent double include in coff-x86_64.c of headers. (PDATA_ROW_SIZE): New define. (pex_regs[]): New static array. (pex64_get_runtime_function): New static function. (pex64_get_unwind_info): Likewise. (pex64_get_scope_entry): Likewise. (pex64_xdata_print_uwd_codes): Likewise. (pep_get_section_by_rva): Likewise. (pex64_dump_xdata): Likewise. (pex64_bfd_print_pdata): Likewise. (bfd_pe_print_pdata): Define as pex64_bfd_print_pdata. * peXXigen.c (_bfd_pex64_print_pdata): Removed implementation. * libpei.h (_bfd_pex64_print_pdata): Removed declaration. include/ChangeLog 2009-04-21 Kai Tietz <kai.tietz@onevision.com> * coff/pe.h (pex64_runtime_function): New structure. (external_pex64_runtime_function): Likewise. (pex64_unwind_code): Likewise. (external_pex64_unwind_code): Likewise. (pex64_unwind_info): Likewise. (external_pex64_unwind_info): Likewise. (external_pex64_scope): Likewise. (pex64_scope): Likewise. (pex64_scope_entry): Likewise. (external_pex64_scope_entry): Likewise. (PEX64_IS_RUNTIME_FUNCTION_CHAINED): New macro. (PEX64_GET_UNWINDDATA_UNIFIED_RVA): Likewise. (PEX64_UNWCODE_CODE): Likewise. (PEX64_UNWCODE_INFO): Likewise. (UWOP_...): Add defines for unwind code. (UNW_FLAG_...): Add defined for unwind info flags. (PEX64_SCOPE_ENTRY_SIZE): New macro. (PEX64_UWI_VERSION): Likewise. (PEX64_UWI_FLAGS): Likewise. (PEX64_UWI_FRAMEREG): Likewise. (PEX64_UWI_FRAMEOFF): Likewise. (PEX64_UWI_SIZEOF_UWCODE_ARRAY): Likewise. (PEX64_OFFSET_TO_UNWIND_CODE): Likewise. (PEX64_OFFSET_TO_HANDLER_RVA): Likewise. (PEX64_OFFSET_TO_SCOPE_COUNT): Likewise. (PEX64_SCOPE_ENTRY): Likewise.
Diffstat (limited to 'include')
-rw-r--r--include/ChangeLog29
-rw-r--r--include/coff/pe.h150
2 files changed, 179 insertions, 0 deletions
diff --git a/include/ChangeLog b/include/ChangeLog
index dfe9fce..c94f74c 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,32 @@
+2009-04-21 Kai Tietz <kai.tietz@onevision.com>
+
+ * coff/pe.h (pex64_runtime_function): New structure.
+ (external_pex64_runtime_function): Likewise.
+ (pex64_unwind_code): Likewise.
+ (external_pex64_unwind_code): Likewise.
+ (pex64_unwind_info): Likewise.
+ (external_pex64_unwind_info): Likewise.
+ (external_pex64_scope): Likewise.
+ (pex64_scope): Likewise.
+ (pex64_scope_entry): Likewise.
+ (external_pex64_scope_entry): Likewise.
+ (PEX64_IS_RUNTIME_FUNCTION_CHAINED): New macro.
+ (PEX64_GET_UNWINDDATA_UNIFIED_RVA): Likewise.
+ (PEX64_UNWCODE_CODE): Likewise.
+ (PEX64_UNWCODE_INFO): Likewise.
+ (UWOP_...): Add defines for unwind code.
+ (UNW_FLAG_...): Add defined for unwind info flags.
+ (PEX64_SCOPE_ENTRY_SIZE): New macro.
+ (PEX64_UWI_VERSION): Likewise.
+ (PEX64_UWI_FLAGS): Likewise.
+ (PEX64_UWI_FRAMEREG): Likewise.
+ (PEX64_UWI_FRAMEOFF): Likewise.
+ (PEX64_UWI_SIZEOF_UWCODE_ARRAY): Likewise.
+ (PEX64_OFFSET_TO_UNWIND_CODE): Likewise.
+ (PEX64_OFFSET_TO_HANDLER_RVA): Likewise.
+ (PEX64_OFFSET_TO_SCOPE_COUNT): Likewise.
+ (PEX64_SCOPE_ENTRY): Likewise.
+
2009-04-08 H.J. Lu <hongjiu.lu@intel.com>
* bfdlink.h (bfd_link_info): Add warn_alternate_em.
diff --git a/include/coff/pe.h b/include/coff/pe.h
index c7e7bd2..e8bf681 100644
--- a/include/coff/pe.h
+++ b/include/coff/pe.h
@@ -358,4 +358,154 @@ typedef struct
#define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
#define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
+/* .pdata/.xdata defines and structures for x64 PE+ for exception handling. */
+
+/* .pdata in exception directory. */
+
+struct pex64_runtime_function
+{
+ bfd_vma rva_BeginAddress;
+ bfd_vma rva_EndAddress;
+ bfd_vma rva_UnwindData;
+ unsigned int isChained : 1;
+};
+
+struct external_pex64_runtime_function
+{
+ bfd_byte rva_BeginAddress[4];
+ bfd_byte rva_EndAddress[4];
+ bfd_byte rva_UnwindData[4];
+};
+
+/* If the lowest significant bit is set for rva_UnwindData RVA, it
+ means that the unified RVA points to another pex64_runtime_function
+ that this entry shares the unwind_info block with. */
+#define PEX64_IS_RUNTIME_FUNCTION_CHAINED(PTR_RTF) \
+ (((PTR_RTF)->rva_UnwindData & 1) != 0)
+#define PEX64_GET_UNWINDDATA_UNIFIED_RVA(PTR_RTF) \
+ ((PTR_RTF)->rva_UnwindData & ~1)
+
+/* The unwind codes. */
+#define UWOP_PUSH_NONVOL 0
+#define UWOP_ALLOC_LARGE 1
+#define UWOP_ALLOC_SMALL 2
+#define UWOP_SET_FPREG 3
+#define UWOP_SAVE_NONVOL 4
+#define UWOP_SAVE_NONVOL_FAR 5
+#define UWOP_SAVE_XMM 6
+#define UWOP_SAVE_XMM_FAR 7
+#define UWOP_SAVE_XMM128 8
+#define UWOP_SAVE_XMM128_FAR 9
+#define UWOP_PUSH_MACHFRAME 10
+
+struct pex64_unwind_code
+{
+ bfd_vma prologue_offset;
+ /* Contains Frame offset, or frame allocation size. */
+ bfd_vma frame_addr;
+ unsigned int uwop_code : 4;
+ /* xmm, mm, or standard register from 0 - 15. */
+ unsigned int reg : 4;
+ /* Used for UWOP_PUSH_MACHFRAME to indicate optional errorcode stack
+ argument. */
+ unsigned int has_errorcode : 1;
+};
+
+struct external_pex64_unwind_code
+{
+ bfd_byte dta[2];
+};
+
+#define PEX64_UNWCODE_CODE(VAL) ((VAL) & 0xf)
+#define PEX64_UNWCODE_INFO(VAL) (((VAL) >> 4) & 0xf)
+
+/* The unwind info. */
+#define UNW_FLAG_NHANDLER 0
+#define UNW_FLAG_EHANDLER 1
+#define UNW_FLAG_UHANDLER 2
+#define UNW_FLAG_FHANDLER 3
+#define UNW_FLAG_CHAININFO 4
+
+#define UNW_FLAG_MASK 0x1f
+
+struct pex64_unwind_info
+{
+ bfd_vma SizeOfBlock;
+ bfd_byte Version; /* Values from 0 up to 7 are possible. */
+ bfd_byte Flags; /* Values from 0 up to 31 are possible. */
+ bfd_vma SizeOfPrologue;
+ bfd_vma CountOfCodes; /* Amount of pex64_unwind_code elements. */
+ /* 0 = CFA, 1..15 are index of integer registers. */
+ unsigned int FrameRegister : 4;
+ bfd_vma FrameOffset;
+ bfd_vma sizeofUnwindCodes;
+ bfd_byte *rawUnwindCodes;
+ /* Valid for UNW_FLAG_EHANDLER and UNW_FLAG_UHANDLER. */
+ bfd_vma CountOfScopes;
+ bfd_byte *rawScopeEntries;
+ bfd_vma rva_ExceptionHandler; /* UNW_EHANDLER. */
+ bfd_vma rva_TerminationHandler; /* UNW_FLAG_UHANDLER. */
+ bfd_vma rva_FrameHandler; /* UNW_FLAG_FHANDLER. */
+ bfd_vma FrameHandlerArgument; /* UNW_FLAG_FHANDLER. */
+ bfd_vma rva_FunctionEntry; /* UNW_FLAG_CHAININFO. */
+};
+
+struct external_pex64_unwind_info
+{
+ bfd_byte Version_Flags;
+ bfd_byte SizeOfPrologue;
+ bfd_byte CountOfCodes;
+ bfd_byte FrameRegisterOffset;
+ /* external_pex64_unwind_code array. */
+ /* bfd_byte handler[4]; */
+ /* Optional language specific data. */
+};
+
+struct external_pex64_scope
+{
+ bfd_vma Count;
+};
+
+struct pex64_scope
+{
+ bfd_byte Count[4];
+};
+
+struct pex64_scope_entry
+{
+ bfd_vma rva_BeginAddress;
+ bfd_vma rva_EndAddress;
+ bfd_vma rva_HandlerAddress;
+ bfd_vma rva_JumpAddress;
+};
+#define PEX64_SCOPE_ENTRY_SIZE 16
+
+struct external_pex64_scope_entry
+{
+ bfd_byte rva_BeginAddress[4];
+ bfd_byte rva_EndAddress[4];
+ bfd_byte rva_HandlerAddress[4];
+ bfd_byte rva_JumpAddress[4];
+};
+
+#define PEX64_UWI_VERSION(VAL) ((VAL) & 7)
+#define PEX64_UWI_FLAGS(VAL) (((VAL) >> 3) & 0x1f)
+#define PEX64_UWI_FRAMEREG(VAL) ((VAL) & 0xf)
+#define PEX64_UWI_FRAMEOFF(VAL) (((VAL) >> 4) & 0xf)
+#define PEX64_UWI_SIZEOF_UWCODE_ARRAY(VAL) \
+ ((((VAL) + 1) & ~1) * 2)
+
+#define PEX64_OFFSET_TO_UNWIND_CODE 0x4
+
+#define PEX64_OFFSET_TO_HANDLER_RVA (COUNTOFUNWINDCODES) \
+ (PEX64_OFFSET_TO_UNWIND_CODE + \
+ PEX64_UWI_SIZEOF_UWCODE_ARRAY(COUNTOFUNWINDCODES))
+
+#define PEX64_OFFSET_TO_SCOPE_COUNT(COUNTOFUNWINDCODES) \
+ (PEX64_OFFSET_TO_HANDLER_RVA(COUNTOFUNWINDCODES) + 4)
+
+#define PEX64_SCOPE_ENTRY(COUNTOFUNWINDCODES, IDX) \
+ (PEX64_OFFSET_TO_SCOPE_COUNT(COUNTOFUNWINDCODES) + \
+ PEX64_SCOPE_ENTRY_SIZE * (IDX))
+
#endif /* _PE_H */