- Timestamp:
- Feb 9, 2007, 6:12:22 AM (19 years ago)
- Location:
- trunk/kLdr
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kLdr/kLdr.h
r2956 r2958 541 541 KLDRENDIAN_32BIT_HACK = 0x7fffffff 542 542 } KLDRENDIAN; 543 544 545 /** @def KLDR_LITTLE_ENDIAN 546 * The kLdr build is for a little endian target. */ 547 /** @def KLDR_BIG_ENDIAN 548 * The kLdr build is for a big endian target. */ 549 #if !defined(KLDR_LITTLE_ENDIAN) && !defined(KLDR_BIG_ENDIAN) 550 # define KLDR_LITTLE_ENDIAN 551 #endif 552 #ifdef __DOXYGEN__ 553 # define KLDR_BIG_ENDIAN 554 #endif 543 555 544 556 -
trunk/kLdr/kLdrHlp.h
r2955 r2958 86 86 /** @def KLDRHLP_BE2H_U64 87 87 * Unsigned 64-bit big-endian to host endian. */ 88 #if 188 #ifdef KLDR_LITTLE_ENDIAN 89 89 # define KLDRHLP_LE2H_U16(u16) ((uint16_t)(u16)) 90 90 # define KLDRHLP_LE2H_U32(u32) ((uint32_t)(u32)) … … 93 93 # define KLDRHLP_BE2H_U32(u32) KLDRHLP_E2E_U32(u32) 94 94 # define KLDRHLP_BE2H_U64(u64) KLDRHLP_E2E_U64(u64) 95 #el se95 #elif defined(KLDR_BIG_ENDIAN) 96 96 # define KLDRHLP_LE2H_U16(u16) KLDRHLP_E2E_U16(u16) 97 97 # define KLDRHLP_LE2H_U32(u32) KLDRHLP_E2E_U32(u32) … … 100 100 # define KLDRHLP_BE2H_U32(u32) ((uint32_t)(u32)) 101 101 # define KLDRHLP_BE2H_U64(u64) ((uint32_t)(u32)) 102 #else 103 # error "KLDR_BIG_ENDIAN or KLDR_LITTLE_ENDIAN is supposed to be defined." 102 104 #endif 103 105 -
trunk/kLdr/kLdrModMachO.h
r2957 r2958 6 6 #ifndef __kLdrModMachO_h__ 7 7 #define __kLdrModMachO_h__ 8 9 /** @defgroup grp_mach_o The Mach-O Structures, Types, and Defines. 10 * @{ 11 */ 8 12 9 13 … … 273 277 /** @} */ 274 278 279 280 281 /** @defgroup grp_macho_o_lc Load Commands 282 * @{ */ 275 283 276 284 /** … … 624 632 /** @todo fvmfile_command (LC_FVMFILE) */ 625 633 626 627 628 629 634 /** @} */ 635 636 637 638 /** @defgroup grp_macho_o_syms Symbol Table 639 * @{ */ 630 640 631 641 /** … … 804 814 /** @} */ 805 815 816 /** @} */ 817 818 819 /** @defgroup grp_macho_o_relocs Relocations 820 * @{ */ 821 822 /** 823 * Relocation entry. 824 * 825 * Differs from a.out in the meaning of r_symbolnum when r_extern=0 and 826 * that r_pad is made into r_type. 827 * 828 * @remark This structure and type has been prefixed with macho_ to avoid 829 * confusion with the original a.out type. 830 */ 831 typedef struct macho_relocation_info 832 { 833 int32_t r_address; /**< Section relative address of the fixup. 834 The top bit (signed) indicates that this is a scattered 835 relocation if set, see scattered_relocation_info_t. */ 836 uint32_t r_symbolnum : 24, /**< r_extern=1: Symbol table index, relocate with the address of this symbol. 837 r_extern=0: Section ordinal, relocate with the address of this section. */ 838 r_pcrel : 1, /**< PC (program counter) relative fixup; subtract the fixup address. */ 839 r_length : 2, /**< Fixup length: 0=uint8_t, 1=uint16_t, 2=uint32_t, 3=uint64_t. */ 840 r_extern : 1, /**< External or internal fixup, decides the r_symbolnum interpretation.. */ 841 r_type : 4; /**< Relocation type; 0 is standard, non-zero are machine specific. */ 842 } macho_relocation_info_t; 843 844 /** Special section ordinal value for absolute relocations. */ 845 #define R_ABS 0 846 847 /** Flag in r_address indicating that the relocation is of the 848 * scattered_relocation_info_t kind and not macho_relocation_info_t. */ 849 #define R_SCATTERED UINT32_C(0x80000000) 850 851 /** 852 * Scattered relocation. 853 * 854 * This is a hack mainly for RISC machines which restricts section size 855 * to 16MB among other things. 856 * 857 * The reason for the big/little endian differences here is of course because 858 * of the R_SCATTERED mask and the way bitfields are implemented by the 859 * C/C++ compilers. 860 */ 861 typedef struct scattered_relocation_info 862 { 863 #ifdef KLDR_LITTLE_ENDIAN 864 uint32_t r_address : 24, /**< Section relative address of the fixup. (macho_relocation_info_t::r_address) */ 865 r_type : 4, /**< Relocation type; 0 is standard, non-zero are machine specific. (macho_relocation_info_t::r_type) */ 866 r_length : 2, /**< Fixup length: 0=uint8_t, 1=uint16_t, 2=uint32_t, 3=uint64_t. (macho_relocation_info_t::r_length) */ 867 r_pcrel : 1, /**< PC (program counter) relative fixup; subtract the fixup address. (macho_relocation_info_t::r_pcrel) */ 868 r_scattered : 1; /**< Set if scattered relocation, clear if normal relocation. */ 869 #elif defined(KLDR_BIG_ENDIAN) 870 uint32_t r_scattered : 1, /**< Set if scattered relocation, clear if normal relocation. */ 871 r_pcrel : 1, /**< PC (program counter) relative fixup; subtract the fixup address. (macho_relocation_info_t::r_pcrel) */ 872 r_length : 2, /**< Fixup length: 0=uint8_t, 1=uint16_t, 2=uint32_t, 3=uint64_t. (macho_relocation_info_t::r_length) */ 873 r_type : 4, /**< Relocation type; 0 is standard, non-zero are machine specific. (macho_relocation_info_t::r_type) */ 874 r_address : 24; /**< Section relative address of the fixup. (macho_relocation_info_t::r_address) */ 875 #else 876 # error "Neither KLDR_LITTLE_ENDIAN nor KLDR_BIG_ENDIAN is defined!" 806 877 #endif 807 878 int32_t r_value; /**< The value the fixup is refering to (Without offset added). */ 879 } scattered_relocation_info_t; 880 881 /** 882 * Relocation type values for a generic implementation (for r_type). 883 */ 884 typedef enum reloc_type_generic 885 { 886 GENERIC_RELOC_VANILLA = 0, /**< Standard relocation. */ 887 GENERIC_RELOC_PAIR, /**< Follows GENERIC_RELOC_SECTDIFF. */ 888 GENERIC_RELOC_SECTDIFF, /**< ??? */ 889 GENERIC_RELOC_PB_LA_PTR, /**< Prebound lazy pointer whatever that. */ 890 GENERIC_RELOC_LOCAL_SECTDIFF /**< ??? */ 891 } reloc_type_generic_t; 892 893 /** @} */ 894 895 896 /** @} */ 897 #endif 898
Note:
See TracChangeset
for help on using the changeset viewer.