common2.h 761 B

1234567891011121314151617181920212223242526
  1. #ifndef COMMON_H
  2. #define COMMON_H
  3. #include <stdint.h> // uint*_t
  4. #include <Foundation/Foundation.h>
  5. #define LOG(str, args...) do { NSLog(@str "\n", ##args); } while(0)
  6. #ifdef __LP64__
  7. # define ADDR "0x%016llx"
  8. # define MACH_HEADER_MAGIC MH_MAGIC_64
  9. # define MACH_LC_SEGMENT LC_SEGMENT_64
  10. typedef struct mach_header_64 mach_hdr_t;
  11. typedef struct segment_command_64 mach_seg_t;
  12. typedef uint64_t kptr_t;
  13. #else
  14. # define ADDR "0x%08x"
  15. # define MACH_HEADER_MAGIC MH_MAGIC
  16. # define MACH_LC_SEGMENT LC_SEGMENT
  17. typedef struct mach_header mach_hdr_t;
  18. typedef struct segment_command mach_seg_t;
  19. typedef uint32_t kptr_t;
  20. #endif
  21. typedef struct load_command mach_lc_t;
  22. #endif