1 2 /* some structures for Win64 SEH */ 3 4 /* .pdata items */ 5 6 typedef struct _IMAGE_RUNTIME_FUNCTION_ENTRY 7 { 8 uint_32 BeginAddress; 9 uint_32 EndAddress; 10 uint_32 UnwindData; /* RVA of UNWIND_INFO */ 11 } IMAGE_RUNTIME_FUNCTION_ENTRY; 12 13 /* .xdata items */ 14 15 enum { 16 UWOP_PUSH_NONVOL = 0, /* .PUSHREG - push nonvolative gpr */ 17 UWOP_ALLOC_LARGE = 1, /* .ALLOCSTACK - alloc large-sized area on stack */ 18 UWOP_ALLOC_SMALL = 2, /* .ALLOCSTACK - alloc small-sized area (8-128) on stack */ 19 UWOP_SET_FPREG = 3, /* .SETFRAME - set frame pointer */ 20 UWOP_SAVE_NONVOL = 4, /* .SAVEREG - save nonvolative gpr using MOV instead of PUSH */ 21 UWOP_SAVE_NONVOL_FAR = 5, /* .SAVEREG - save nonvolative gpr using MOV instead of PUSH */ 22 UWOP_SAVE_XMM = 6, /* */ 23 UWOP_SAVE_XMM_FAR = 7, /* */ 24 UWOP_SAVE_XMM128 = 8, /* .SAVEXMM128 - save all 128bits of nonvolative XMM register on stack */ 25 UWOP_SAVE_XMM128_FAR = 9, /* .SAVEXMM128 - save all 128bits of nonvolative XMM register on stack */ 26 UWOP_PUSH_MACHFRAME = 10 /* .PUSHFRAME - push a machine frame ( SS, RSP, EFL, CS, RIP [ERRCODE] ) */ 27 }; 28 29 typedef union _UNWIND_CODE { 30 struct { 31 uint_8 CodeOffset; /* offset within prolog */ 32 uint_8 UnwindOp : 4; /* see UWOP_ values */ 33 uint_8 OpInfo : 4; 34 }; 35 uint_16 FrameOffset; 36 } UNWIND_CODE; 37 38 enum { 39 UNW_FLAG_NHANDLER = 0, 40 UNW_FLAG_EHANDLER = 1, /* function to examine exceptions */ 41 UNW_FLAG_UHANDLER = 2, /* function to unwind an exception */ 42 UNW_FLAG_FHANDLER = 3, /* inofficial, is E+U */ 43 UNW_FLAG_CHAININFO = 4 44 }; 45 46 typedef struct _UNWIND_INFO { 47 uint_8 Version : 3; /* is 1 */ 48 uint_8 Flags : 5; /* see UNW_FLAG_ values */ 49 uint_8 SizeOfProlog; /* size of prolog in bytes */ 50 uint_8 CountOfCodes; /* number of UNWIND_CODE entries */ 51 uint_8 FrameRegister : 4; /* if nonzero, function uses a frame pointer */ 52 uint_8 FrameOffset : 4; /* offset frame reg from RSP * 16 */ 53 #if 0 54 UNWIND_CODE UnwindCode[1]; /* unwind codes array */ 55 union { 56 uint_32 ExceptionHandler; /* if UNW_FLAG_EHANDLER or UNW_FLAG_UHANDLER is set: RVA of language specific handler */ 57 uint_32 FunctionEntry; /* if UNW_FLAG_CHAININFO is set: see IMAGE_RUNTIME_FUNCTION_ENTRY */ 58 }; 59 uint_32 ExceptionData[]; 60 #endif 61 } UNWIND_INFO; 62 63 #define UNW_VERSION 1 64 65