2 * Copyright (c) 2015 Apple Inc. All rights reserved.
5 #include "loader_additions.h"
6 #include "dyld_shared_cache.h"
9 #include <mach-o/loader.h>
10 #include <mach/mach.h>
11 #include <mach/mach_vm.h>
12 #include <sys/types.h>
18 typedef struct mach_header_64 native_mach_header_t
;
19 typedef struct segment_command_64 native_segment_command_t
;
20 #define NATIVE_MH_MAGIC MH_MAGIC_64
21 #define NATIVE_LC_SEGMENT LC_SEGMENT_64
23 typedef struct mach_header native_mach_header_t
;
24 typedef struct segment_command native_segment_command_t
;
25 #define NATIVE_MH_MAGIC MH_MAGIC
26 #define NATIVE_LC_SEGMENT LC_SEGMENT
29 extern native_mach_header_t
*make_corefile_mach_header(void *);
30 extern struct proto_coreinfo_command
*make_coreinfo_command(native_mach_header_t
*, void *, const uuid_t
, uint64_t, uint64_t);
33 mach_header_inc_ncmds(native_mach_header_t
*mh
, uint32_t inc
) {
38 mach_header_inc_sizeofcmds(native_mach_header_t
*mh
, uint32_t inc
) {
39 mh
->sizeofcmds
+= inc
;
43 unsigned long count
; /* number-of-objects */
44 size_t headersize
; /* size in mach header */
45 mach_vm_offset_t memsize
; /* size in memory */
48 struct size_segment_data
{
49 struct size_core ssd_vanilla
; /* full segments with data */
50 struct size_core ssd_sparse
; /* sparse segments with data */
51 struct size_core ssd_fileref
; /* full & sparse segments with file references */
52 struct size_core ssd_zfod
; /* full segments with zfod pages */
55 struct write_segment_data
{
57 native_mach_header_t
*wsd_mh
;
64 #endif /* _COREFILE_H */