VirtualBox

Changeset 73386 in vbox for trunk/include/iprt


Ignore:
Timestamp:
Jul 27, 2018 3:18:50 PM (6 years ago)
Author:
vboxsync
Message:

iprt/formats/pecoff.h: More AMD64 unwind stuff.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/formats/pecoff.h

    r73374 r73386  
    670670    uint32_t    UnwindInfoAddress;
    671671} IMAGE_RUNTIME_FUNCTION_ENTRY;
     672AssertCompileSize(IMAGE_RUNTIME_FUNCTION_ENTRY, 12);
    672673typedef IMAGE_RUNTIME_FUNCTION_ENTRY *PIMAGE_RUNTIME_FUNCTION_ENTRY;
    673674typedef IMAGE_RUNTIME_FUNCTION_ENTRY const *PCIMAGE_RUNTIME_FUNCTION_ENTRY;
    674675
     676/**
     677 * An unwind code for AMD64 and ARM64.
     678 *
     679 * @note Also known as UNWIND_CODE or _UNWIND_CODE.
     680 */
     681typedef union IMAGE_UNWIND_CODE
     682{
     683    struct
     684    {
     685        /** The prolog offset where the change takes effect.
     686         * This means the instruction following the one being described.  */
     687        uint8_t CodeOffset;
     688        /** Unwind opcode.
     689         * For AMD64 see IMAGE_AMD64_UNWIND_OP_CODES. */
     690        uint8_t UnwindOp : 4;
     691        /** Opcode specific. */
     692        uint8_t OpInfo   : 4;
     693    } u;
     694    uint16_t    FrameOffset;
     695} IMAGE_UNWIND_CODE;
     696AssertCompileSize(IMAGE_UNWIND_CODE, 2);
     697
     698/**
     699 * Unwind information for AMD64 and ARM64.
     700 *
     701 * Pointed to by IMAGE_RUNTIME_FUNCTION_ENTRY::UnwindInfoAddress,
     702 *
     703 * @note Also known as UNWIND_INFO or _UNWIND_INFO.
     704 */
     705typedef struct IMAGE_UNWIND_INFO
     706{
     707    /** Version, currently 1.   */
     708    uint8_t             Version : 3;
     709    /** IMAGE_UNW_FLAG_XXX */
     710    uint8_t             Flags : 5;
     711    /** Size of function prolog. */
     712    uint8_t             SizeOfProlog;
     713    /** Number of opcodes in aOpcodes. */
     714    uint8_t             CountOfCodes;
     715    /** Initial frame register. */
     716    uint8_t             FrameRegister : 4;
     717    /** Scaled frame register offset. */
     718    uint8_t             FrameOffset : 4;
     719    /** Unwind opcodes. */
     720    IMAGE_UNWIND_CODE   aOpcodes[RT_FLEXIBLE_ARRAY];
     721} IMAGE_UNWIND_INFO;
     722AssertCompileMemberOffset(IMAGE_UNWIND_INFO, aOpcodes, 4);
     723typedef IMAGE_UNWIND_INFO *PIMAGE_UNWIND_INFO;
     724typedef IMAGE_UNWIND_INFO const *PCIMAGE_UNWIND_INFO;
     725
     726/** IMAGE_UNW_FLAGS_XXX - IMAGE_UNWIND_INFO::Flags.
     727 * @{  */
     728/** No handler.
     729 * @note Aslo know as UNW_FLAG_NHANDLER. */
     730#define IMAGE_UNW_FLAGS_NHANDLER        0
     731/** Have exception handler (RVA after codes, dword aligned.)
     732 * @note Aslo know as UNW_FLAG_NHANDLER. */
     733#define IMAGE_UNW_FLAGS_EHANDLER        1
     734/** Have unwind handler (RVA after codes, dword aligned.)
     735 * @note Aslo know as UNW_FLAG_NHANDLER. */
     736#define IMAGE_UNW_FLAGS_UHANDLER        2
     737/** Set if not primary unwind info for a function.  An
     738 * IMAGE_RUNTIME_FUNCTION_ENTRY giving the chained unwind info follows the
     739 * aOpcodes array at a dword aligned offset. */
     740#define IMAGE_UNW_FLAGS_CHAININFO       4
     741/** @}  */
     742
     743/**
     744 * AMD64 unwind opcodes.
     745 */
     746typedef enum IMAGE_AMD64_UNWIND_OP_CODES
     747{
     748    /** Push non-volatile register (OpInfo).
     749     * YASM: [pushreg reg]
     750     * MASM: .PUSHREG reg */
     751    IMAGE_AMD64_UWOP_PUSH_NONVOL = 0,
     752    /** Stack allocation: Size stored in the next two slots (dword).
     753     * YASM: [allocstack size]
     754     * MASM: .ALLOCSTACK size */
     755    IMAGE_AMD64_UWOP_ALLOC_LARGE,
     756    /** Stack allocation: OpInfo = size / 8 - 1.
     757     * YASM: [allocstack size]
     758     * MASM: .ALLOCSTACK size  */
     759    IMAGE_AMD64_UWOP_ALLOC_SMALL,
     760    /** Set frame pointer register: RSP + FrameOffset * 16.
     761     * YASM: [setframe reg, offset]
     762     * MASM: .SETFRAME reg, offset
     763     * @code
     764     *      LEA     RBP, [RSP + 20h]
     765     *      [setframe RBP, 20h]
     766     * @endcode */
     767    IMAGE_AMD64_UWOP_SET_FPREG,
     768    /** Save non-volatile register (OpInfo) on stack (RSP/FP + next slot).
     769     * YASM: [savereg reg, offset]
     770     * MASM: .SAVEREG reg, offset */
     771    IMAGE_AMD64_UWOP_SAVE_NONVOL,
     772    /** Save non-volatile register (OpInfo) on stack (RSP/FP + next two slots).
     773     * YASM: [savereg reg, offset]
     774     * MASM: .SAVEREG reg, offset  */
     775    IMAGE_AMD64_UWOP_SAVE_NONVOL_FAR,
     776    IMAGE_AMD64_UWOP_RESERVED_6,
     777    IMAGE_AMD64_UWOP_RESERVED_7,
     778    /** Save 128-bit XMM register (OpInfo) on stack (RSP/FP + next slot).
     779     * YASM: [savexmm128 reg, offset]
     780     * MASM: .SAVEXMM128 reg, offset */
     781    IMAGE_AMD64_UWOP_SAVE_XMM128,
     782    /** Save 128-bit XMM register (OpInfo) on stack (RSP/FP + next two slots).
     783     * YASM: [savexmm128 reg, offset]
     784     * MASM: .SAVEXMM128 reg, offset  */
     785    IMAGE_AMD64_UWOP_SAVE_XMM128_FAR,
     786    /** IRET frame, OpInfo serves as error code indicator.
     787     * YASM: [pushframe with-code]
     788     * MASM: .pushframe with-code  */
     789    IMAGE_AMD64_UWOP_PUSH_MACHFRAME
     790} IMAGE_AMD64_UNWIND_OP_CODES;
    675791/** @} */
    676792
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette