VirtualBox

Changeset 48 in kStuff for trunk


Ignore:
Timestamp:
Aug 26, 2012 3:53:57 PM (12 years ago)
Author:
bird
Message:

mach-o: Added new load commands from 10.6 and 10.7. Made the loader ignore version requirements and code signatures.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/k/kLdrFmts/mach-o.h

    r32 r48  
    55
    66/*
    7  * Copyright (c) 2006-2007 Knut St. Osmundsen <[email protected]>
     7 * Copyright (c) 2006-2012 Knut St. Osmundsen <[email protected]>
    88 *
    99 * Permission is hereby granted, free of charge, to any person
     
    362362#define LC_ROUTINES_64      KU32_C(0x1a)  /**< Image routines (64-bit). See routines_command_32. */
    363363#define LC_UUID             KU32_C(0x1b)  /**< The UUID of the object module. See uuid_command.  */
     364#define LC_RPATH            KU32_C(0x1c | LC_REQ_DYLD) /**< Runpth additions. See rpath_command. */
     365#define LC_CODE_SIGNATURE   KU32_C(0x1d)  /**< Code signature location. See linkedit_data_command. */
     366#define LC_SEGMENT_SPLIT_INFO KU32_C(0x1e)/**< Segment split info location. See linkedit_data_command. */
     367#define LC_REEXPORT_DYLIB   KU32_C(0x1f | LC_REQ_DYLD)/**< Load and re-export the given dylib - DLL forwarding. See dylib_command. */
     368#define LC_LAZY_LOAD_DYLIB  KU32_C(0x20)  /**< Delays loading of the given dylib until used. See dylib_command? */
     369#define LC_ENCRYPTION_INFO  KU32_C(0x21)  /**< Segment encryption information. See encryption_info_command. */
     370#define LC_DYLD_INFO        KU32_C(0x22)  /**< Compressed dylib relocation information, alternative present. See dyld_info_command. */
     371#define LC_DYLD_INFO_ONLY   KU32_C(0x22 | LC_REQ_DYLD) /**< Compressed dylib relocation information, no alternative. See dyld_info_command. */
     372#define LC_LOAD_UPWARD_DYLIB KU32_C(0x23) /**< ???? */
     373#define LC_VERSION_MIN_MACOSX KU32_C(0x24)   /**< The image requires the given Mac OS X version. See version_min_command. */
     374#define LC_VERSION_MIN_IPHONEOS KU32_C(0x25) /**< The image requires the given iOS version. See version_min_command. */
     375#define LC_FUNCTION_STARTS  KU32_C(0x26)  /**< Where to find the compress function start addresses. See linkedit_data_command. */
     376#define LC_DYLD_ENVIRONMENT KU32_C(0x26)  /**< Environment variable for the dynamic linker. See dylinker_command. */
    364377/** @} */
    365378
     
    593606/** @todo fvmlib_command (LC_IDFVMLIB or LC_LOADFVMLIB) */
    594607/** @todo dylib */
    595 /** @todo dylib_command (LC_ID_DYLIB, LC_LOAD_DYLIB, LC_LOAD_WEAK_DYLIB) */
     608/** @todo dylib_command (LC_ID_DYLIB, LC_LOAD_DYLIB, LC_LOAD_WEAK_DYLIB,
     609 *        LC_REEXPORT_DYLIB, LC_LAZY_LOAD_DYLIB) */
    596610/** @todo sub_framework_command (LC_SUB_FRAMEWORK) */
    597611/** @todo sub_client_command (LC_SUB_CLIENT) */
     
    599613/** @todo sub_library_command (LC_SUB_LIBRARY) */
    600614/** @todo prebound_dylib_command (LC_PREBOUND_DYLIB) */
    601 /** @todo dylinker_command (LC_ID_DYLINKER or LC_LOAD_DYLINKER) */
    602 
     615/** @todo dylinker_command (LC_ID_DYLINKER or LC_LOAD_DYLINKER,
     616 *        LC_DYLD_ENVIRONMENT) */
    603617
    604618/**
     
    664678/** @todo ident_command (LC_IDENT) */
    665679/** @todo fvmfile_command (LC_FVMFILE) */
     680/** @todo rpath_command (LC_RPATH) */
     681
     682typedef struct linkedit_data_command
     683{
     684    KU32            cmd;        /**< LC_CODE_SIGNATURE, LC_SEGMENT_SPLIT_INFO, LC_FUNCTION_STARTS */
     685    KU32            cmdsize;    /**< size of this structure. */
     686    KU32            dataoff;    /**< Offset into the file of the data. */
     687    KU32            datasize;   /**< The size of the data. */
     688} linkedit_data_command_t;
     689
     690/** @todo encryption_info_command (LC_ENCRYPTION_INFO) */
     691/** @todo dyld_info_command (LC_DYLD_INFO, LC_DYLD_INFO_ONLY) */
     692
     693typedef struct version_min_command
     694{
     695    KU32            cmd;        /**< LC_VERSION_MIN_MACOSX, LC_VERSION_MIN_IPHONEOS */
     696    KU32            cmdsize;    /**< size of this structure. */
     697    KU32            version;    /**< 31..16=major, 15..8=minor, 7..0=patch. */
     698    KU32            reserved;   /**< MBZ. */
     699} version_min_command_t;
    666700
    667701/** @} */
  • trunk/kLdr/kLdrModMachO.c

    r47 r48  
    10081008                    return KLDR_ERR_MACHO_BAD_LOAD_COMMAND;
    10091009                /** @todo Check anything here need converting? */
     1010                break;
     1011
     1012            case LC_CODE_SIGNATURE:
     1013                if (u.pUuid->cmdsize != sizeof(linkedit_data_command_t))
     1014                    return KLDR_ERR_MACHO_BAD_LOAD_COMMAND;
     1015                break;
     1016
     1017            case LC_VERSION_MIN_MACOSX:
     1018            case LC_VERSION_MIN_IPHONEOS:
     1019                if (u.pUuid->cmdsize != sizeof(version_min_command_t))
     1020                    return KLDR_ERR_MACHO_BAD_LOAD_COMMAND;
    10101021                break;
    10111022
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