]> git.saurik.com Git - apple/xnu.git/blob - libsa/libsa/mkext.h
xnu-1228.15.4.tar.gz
[apple/xnu.git] / libsa / libsa / mkext.h
1 #ifndef _MKEXT_H_
2 #define _MKEXT_H_ 1
3
4 #include <sys/cdefs.h>
5 #include <sys/types.h>
6
7 #include <mach/machine.h>
8
9 #define MKEXT_MAGIC 'MKXT'
10 #define MKEXT_SIGN 'MOSX'
11
12 #define MKEXT_EXTN ".mkext"
13
14 // All binary values are big-endian
15
16 // If all fields are 0 then this file slot is empty
17 // If compsize is zero then the file isn't compressed.
18 typedef struct mkext_file {
19 size_t offset; // 4 bytes
20 size_t compsize; // 4 bytes
21 size_t realsize; // 4 bytes
22 time_t modifiedsecs; // 4 bytes
23 } mkext_file;
24
25 // The plist file entry is mandatory, but module may be empty
26 typedef struct mkext_kext {
27 mkext_file plist; // 16 bytes
28 mkext_file module; // 16 bytes
29 } mkext_kext;
30
31 typedef struct mkext_header {
32 u_int32_t magic; // 'MKXT'
33 u_int32_t signature; // 'MOSX'
34 u_int32_t length;
35 u_int32_t adler32;
36 u_int32_t version; // vers resource, currently '1.0.0', 0x01008000
37 u_int32_t numkexts;
38 cpu_type_t cputype; // CPU_TYPE_ANY for fat executables
39 cpu_subtype_t cpusubtype; // CPU_SUBTYPE_MULITPLE for executables
40 mkext_kext kext[1]; // 64 bytes/entry
41 } mkext_header;
42
43 __BEGIN_DECLS
44 __private_extern__ u_int8_t *
45 compress_lzss(u_int8_t *dst, u_int32_t dstlen, u_int8_t *src, u_int32_t srclen);
46
47 __private_extern__ int
48 decompress_lzss(u_int8_t *dst, u_int8_t *src, u_int32_t srclen);
49
50 __private_extern__ u_int32_t
51 adler32(u_int8_t *src, int32_t length);
52
53 __END_DECLS
54
55 #endif /* _MKEXT_H_ */