VirtualBox

Changeset 74644 in vbox for trunk


Ignore:
Timestamp:
Oct 6, 2018 7:58:37 PM (6 years ago)
Author:
vboxsync
Message:

IPRT: More adjustments to the LX and Mach-O loader code from kStuff. bugref:9232

File:
1 edited

Legend:

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

    r74639 r74644  
    3535#include <iprt/assertcompile.h>
    3636
     37RT_C_DECLS_BEGIN
    3738
    3839#ifndef IMAGE_OS2_SIGNATURE_LX
     
    4142#endif
    4243
    43 #pragma pack(1) /** @todo mostly unnecessary. */
    4444
    4545/**
     
    4747 * This structure is exactly 196 bytes long.
    4848 */
    49 struct e32_exe
     49typedef struct e32_exe
    5050{
    5151    uint8_t             e32_magic[2];
     
    125125    uint32_t            e32_stacksize;
    126126    uint8_t             e32_res3[20];
    127 };
     127} e32_exe;
    128128AssertCompileSize(struct e32_exe, 196);
    129129
     
    198198/** @} */
    199199
     200
    200201/** @name Relocations (aka Fixups).
    201202 * @{ */
    202 typedef union _offset
     203typedef union r32_offset
    203204{
    204205    uint16_t            offset16;
    205206    uint32_t            offset32;
    206 } offset;
     207} r32_offset;
     208AssertCompileSize(r32_offset, 4);
    207209
    208210/** A relocation.
    209211 * @remark this structure isn't very usable since LX relocations comes in too many size variations.
    210212 */
    211 struct r32_rlc
     213#pragma pack(1)
     214typedef struct r32_rlc
    212215{
    213216    uint8_t             nr_stype;
     
    218221    union targetid
    219222    {
    220         offset          intref;
     223        r32_offset      intref;
    221224        union extfixup
    222225        {
    223             offset      proc;
     226            r32_offset  proc;
    224227            uint32_t    ord;
    225228        } extref;
     
    227230        {
    228231            uint16_t    entry;
    229             offset      addval;
     232            r32_offset  addval;
    230233        } addfix;
    231234    } r32_target;
    232235    uint16_t            r32_srccount;
    233236    uint16_t            r32_chain;
    234 };
     237} r32_rlc;
     238#pragma pack()
     239AssertCompileSize(r32_rlc, 16);
    235240
    236241/** @name Some attempt at size constanstants.
     
    283288
    284289/** The Object Table Entry. */
    285 struct o32_obj
     290typedef struct o32_obj
    286291{
    287292    /** The size of the object. */
     
    297302    /** Reserved */
    298303    uint32_t            o32_reserved;
    299 };
     304} o32_obj;
     305AssertCompileSize(o32_obj, 24);
    300306
    301307/** @name o32_flags
     
    343349
    344350/** A Object Page Map Entry. */
    345 struct o32_map
     351typedef struct o32_map
    346352{
    347353    /** The file offset of the page. */
     
    351357    /** Per page flags describing how the page is encoded in the file. */
    352358    uint16_t            o32_pageflags;
    353 };
     359} o32_map;
     360AssertCompileSize(o32_map, 8);
    354361
    355362/** @name o32 o32_pageflags
     
    372379
    373380/** Iteration Record format (RLE compressed page). */
    374 struct LX_Iter
     381#pragma pack(1)
     382typedef struct LX_Iter
    375383{
    376384    /** Number of iterations. */
     
    380388    /** The bytes. */
    381389    uint8_t             LX_Iterdata;
    382 };
     390} LX_Iter;
     391#pragma pack()
     392AssertCompileSize(LX_Iter, 5);
    383393
    384394/** @} */
     
    386396
    387397/** A Resource Table Entry */
    388 struct rsrc32
     398#pragma pack(1)
     399typedef struct rsrc32
    389400{
    390401    /** Resource Type. */
     
    398409    /** Offset of the resource that within the object. */
    399410    uint32_t            offset;
    400 };
     411} rsrc32;
     412#pragma pack()
     413AssertCompileSize(rsrc32, 14);
    401414
    402415
     
    406419/** Entry bundle.
    407420 * Header descripting up to 255 entries that follows immediatly after this structure. */
    408 struct b32_bundle
     421typedef struct b32_bundle
    409422{
    410423    /** The number of entries. */
     
    414427    /** The index of the object containing these entry points. */
    415428    uint16_t            b32_obj;
    416 };
     429} b32_bundle;
     430AssertCompileSize(b32_bundle, 4);
    417431
    418432/** @name b32_type
     
    434448
    435449/** Entry point. */
    436 struct e32_entry
     450#pragma pack(1)
     451typedef struct e32_entry
    437452{
    438453    /** Entry point flags */
     
    441456    {
    442457        /** ENTRY16 or ENTRY32. */
    443         offset          e32_offset;
     458        r32_offset      e32_offset;
    444459        /** GATE16 */
    445460        struct scallgate
     
    459474        } e32_fwd;
    460475    } e32_variant;
    461 };
     476} e32_entry;
     477#pragma pack()
    462478
    463479/** @name e32_flags
     
    481497/** @} */
    482498
    483 #pragma pack()
     499
     500RT_C_DECLS_END
    484501
    485502#endif
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