2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2009 Free Software Foundation, Inc.
5 * GRUB is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
22 #include <grub/bitmap.h>
24 /* Header of a hibernation image. */
25 struct grub_xnu_hibernate_header
27 /* Size of the image. Notice that file containing image is usually bigger. */
28 grub_uint64_t image_size
;
29 grub_uint8_t unknown1
[8];
30 /* Where to copy launchcode? */
31 grub_uint32_t launchcode_target_page
;
32 /* How many pages of launchcode? */
33 grub_uint32_t launchcode_numpages
;
35 grub_uint32_t entry_point
;
38 grub_uint8_t unknown2
[44];
39 #define GRUB_XNU_HIBERNATE_MAGIC 0x73696d65
41 grub_uint8_t unknown3
[28];
42 /* This value is non-zero if page is encrypted. Unsupported. */
43 grub_uint64_t encoffset
;
44 grub_uint8_t unknown4
[360];
45 /* The size of additional header used to locate image without parsing FS.
48 grub_uint32_t extmapsize
;
49 } __attribute__ ((packed
));
51 /* In-memory structure for temporary keeping device tree. */
52 struct grub_xnu_devtree_key
55 int datasize
; /* -1 for not leaves. */
58 struct grub_xnu_devtree_key
*first_child
;
61 struct grub_xnu_devtree_key
*next
;
64 /* A structure used in memory-map values. */
70 } __attribute__ ((packed
));
72 /* Header describing extension in the memory. */
73 struct grub_xnu_extheader
75 grub_uint32_t infoplistaddr
;
76 grub_uint32_t infoplistsize
;
77 grub_uint32_t binaryaddr
;
78 grub_uint32_t binarysize
;
79 } __attribute__ ((packed
));
81 struct grub_xnu_devtree_key
*grub_xnu_create_key (struct grub_xnu_devtree_key
**parent
,
84 extern struct grub_xnu_devtree_key
*grub_xnu_devtree_root
;
86 void grub_xnu_free_devtree (struct grub_xnu_devtree_key
*cur
);
88 grub_err_t
grub_xnu_writetree_toheap (void **start
, grub_size_t
*size
);
89 struct grub_xnu_devtree_key
*grub_xnu_create_value (struct grub_xnu_devtree_key
**parent
,
92 void grub_xnu_lock (void);
93 void grub_xnu_unlock (void);
94 grub_err_t
grub_xnu_resume (char *imagename
);
95 struct grub_xnu_devtree_key
*grub_xnu_find_key (struct grub_xnu_devtree_key
*parent
,
97 grub_err_t
grub_xnu_align_heap (int align
);
98 grub_err_t
grub_xnu_scan_dir_for_kexts (char *dirname
, char *osbundlerequired
,
100 grub_err_t
grub_xnu_load_kext_from_dir (char *dirname
, char *osbundlerequired
,
102 void *grub_xnu_heap_malloc (int size
);
103 extern grub_uint32_t grub_xnu_heap_real_start
;
104 extern grub_size_t grub_xnu_heap_size
;
105 extern char *grub_xnu_heap_start
;
106 extern struct grub_video_bitmap
*grub_xnu_bitmap
;