VirtualBox

Changeset 74638 in vbox for trunk/src/VBox/Runtime/include


Ignore:
Timestamp:
Oct 6, 2018 6:31:59 PM (6 years ago)
Author:
vboxsync
Message:

IPRT: Initial adaption of the kstuff loader code. bugref:9232

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/include/internal/ldr.h

    r73494 r74638  
    7373#undef IMAGE_DOS_SIGNATURE
    7474#undef IMAGE_NT_SIGNATURE
     75#undef IMAGE_LX_SIGNATURE
    7576
    7677
     
    8788/** Little endian uint16_t MZ signature ("MZ"). */
    8889#define IMAGE_DOS_SIGNATURE ('M' | ('Z' << 8))
     90
     91
     92/** Kind of missing flag. */
     93#define RTMEM_PROT_WRITECOPY        RTMEM_PROT_WRITE
     94
     95
     96/** @name Load symbol kind flags (from kStuff, expose later).
     97 * @{ */
     98/** The bitness doesn't matter. */
     99#define RTLDRSYMKIND_NO_BIT                 UINT32_C(0x00000000)
     100/** 16-bit symbol. */
     101#define RTLDRSYMKIND_16BIT                  UINT32_C(0x00000001)
     102/** 32-bit symbol. */
     103#define RTLDRSYMKIND_32BIT                  UINT32_C(0x00000002)
     104/** 64-bit symbol. */
     105#define RTLDRSYMKIND_64BIT                  UINT32_C(0x00000003)
     106/** Mask out the bit.*/
     107#define RTLDRSYMKIND_BIT_MASK               UINT32_C(0x00000003)
     108/** We don't know the type of symbol. */
     109#define RTLDRSYMKIND_NO_TYPE                UINT32_C(0x00000000)
     110/** The symbol is a code object (method/function/procedure/whateveryouwannacallit). */
     111#define RTLDRSYMKIND_CODE                   UINT32_C(0x00000010)
     112/** The symbol is a data object. */
     113#define RTLDRSYMKIND_DATA                   UINT32_C(0x00000020)
     114/** Mask out the symbol type. */
     115#define RTLDRSYMKIND_TYPE_MASK              UINT32_C(0x00000030)
     116/** Valid symbol kind mask. */
     117#define RTLDRSYMKIND_MASK                   UINT32_C(0x00000033)
     118/** Weak symbol. */
     119#define RTLDRSYMKIND_WEAK                   UINT32_C(0x00000100)
     120/** Forwarder symbol. */
     121#define RTLDRSYMKIND_FORWARDER              UINT32_C(0x00000200)
     122/** Request a flat symbol address. */
     123#define RTLDRSYMKIND_REQ_FLAT               UINT32_C(0x00000000)
     124/** Request a segmented symbol address. */
     125#define RTLDRSYMKIND_REQ_SEGMENTED          UINT32_C(0x40000000)
     126/** Request type mask. */
     127#define RTLDRSYMKIND_REQ_TYPE_MASK          UINT32_C(0x40000000)
     128/** @} */
     129
     130/** Align a RTLDRADDR value. */
     131#define RTLDR_ALIGN_ADDR(val, align) ( ((val) + ((align) - 1)) & ~(RTLDRADDR)((align) - 1) )
     132
     133/** Special base address value alias for the link address.
     134 * Consider propagating...  */
     135#define RTLDR_BASEADDRESS_LINK              (~(RTLDRADDR)1)
     136
    89137
    90138
     
    108156    LDR_STATE_32BIT_HACK = 0x7fffffff
    109157} RTLDRSTATE;
     158
     159
     160/**
     161 * CPU models (from kStuff, expose later some time).
     162 */
     163typedef enum RTLDRCPU
     164{
     165    /** The usual invalid cpu. */
     166    RTLDRCPU_INVALID = 0,
     167
     168    /** @name K_ARCH_X86_16
     169     * @{ */
     170    RTLDRCPU_I8086,
     171    RTLDRCPU_I8088,
     172    RTLDRCPU_I80186,
     173    RTLDRCPU_I80286,
     174    RTLDRCPU_I386_16,
     175    RTLDRCPU_I486_16,
     176    RTLDRCPU_I486SX_16,
     177    RTLDRCPU_I586_16,
     178    RTLDRCPU_I686_16,
     179    RTLDRCPU_P4_16,
     180    RTLDRCPU_CORE2_16,
     181    RTLDRCPU_K6_16,
     182    RTLDRCPU_K7_16,
     183    RTLDRCPU_K8_16,
     184    RTLDRCPU_FIRST_X86_16 = RTLDRCPU_I8086,
     185    RTLDRCPU_LAST_X86_16 = RTLDRCPU_K8_16,
     186    /** @} */
     187
     188    /** @name K_ARCH_X86_32
     189     * @{ */
     190    RTLDRCPU_X86_32_BLEND,
     191    RTLDRCPU_I386,
     192    RTLDRCPU_I486,
     193    RTLDRCPU_I486SX,
     194    RTLDRCPU_I586,
     195    RTLDRCPU_I686,
     196    RTLDRCPU_P4,
     197    RTLDRCPU_CORE2_32,
     198    RTLDRCPU_K6,
     199    RTLDRCPU_K7,
     200    RTLDRCPU_K8_32,
     201    RTLDRCPU_FIRST_X86_32 = RTLDRCPU_I386,
     202    RTLDRCPU_LAST_X86_32 = RTLDRCPU_K8_32,
     203    /** @} */
     204
     205    /** @name K_ARCH_AMD64
     206     * @{ */
     207    RTLDRCPU_AMD64_BLEND,
     208    RTLDRCPU_K8,
     209    RTLDRCPU_P4_64,
     210    RTLDRCPU_CORE2,
     211    RTLDRCPU_FIRST_AMD64 = RTLDRCPU_K8,
     212    RTLDRCPU_LAST_AMD64 = RTLDRCPU_CORE2,
     213    /** @} */
     214
     215    /** The end of the valid cpu values (exclusive). */
     216    RTLDRCPU_END,
     217    /** Hack to blow the type up to 32-bit. */
     218    RTLDRCPU_32BIT_HACK = 0x7fffffff
     219} RTLDRCPU;
    110220
    111221
     
    498608 * @param   pErrInfo        Where to return extended error information. Optional.
    499609 */
    500 int rtldrNativeLoad(const char *pszFilename, uintptr_t *phHandle, uint32_t fFlags, PRTERRINFO pErrInfo);
     610DECLHIDDEN(int) rtldrNativeLoad(const char *pszFilename, uintptr_t *phHandle, uint32_t fFlags, PRTERRINFO pErrInfo);
    501611
    502612/**
     
    509619 * @param   phLdrMod        Where to return the module handle on success.
    510620 */
    511 int rtldrNativeLoadSystem(const char *pszFilename, const char *pszExt, uint32_t fFlags, PRTLDRMOD phLdrMod);
    512 
    513 int rtldrPEOpen(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, RTFOFF offNtHdrs, PRTLDRMOD phLdrMod, PRTERRINFO pErrInfo);
    514 int rtldrELFOpen(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, PRTLDRMOD phLdrMod, PRTERRINFO pErrInfo);
    515 int rtldrkLdrOpen(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, PRTLDRMOD phLdrMod, PRTERRINFO pErrInfo);
    516 /*int rtldrLXOpen(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, RTFOFF offLX, PRTLDRMOD phLdrMod);
    517 int rtldrMachoOpen(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, RTFOFF offSomething, PRTLDRMOD phLdrMod);*/
     621DECLHIDDEN(int) rtldrNativeLoadSystem(const char *pszFilename, const char *pszExt, uint32_t fFlags, PRTLDRMOD phLdrMod);
     622
     623DECLHIDDEN(int) rtldrPEOpen(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, RTFOFF offNtHdrs, PRTLDRMOD phLdrMod, PRTERRINFO pErrInfo);
     624DECLHIDDEN(int) rtldrELFOpen(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, PRTLDRMOD phLdrMod, PRTERRINFO pErrInfo);
     625DECLHIDDEN(int) rtldrLXOpen(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, RTFOFF offLxHdr, PRTLDRMOD phLdrMod, PRTERRINFO pErrInfo);
     626DECLHIDDEN(int) rtldrMachOOpen(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, RTFOFF offImage, PRTLDRMOD phLdrMod, PRTERRINFO pErrInfo);
     627DECLHIDDEN(int) rtldrFatOpen(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, PRTLDRMOD phLdrMod, PRTERRINFO pErrInfo);
     628DECLHIDDEN(int) rtldrkLdrOpen(PRTLDRREADER pReader, uint32_t fFlags, RTLDRARCH enmArch, PRTLDRMOD phLdrMod, PRTERRINFO pErrInfo);
    518629
    519630
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