mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-23 15:49:23 +00:00
Reenable XNU
This commit is contained in:
1 parent
669a1c01fb
commit
cb1b2ad7e0
6 files changed
+148
-150
No files matched your search
+30
-13
@@ -45,10 +45,12 @@ grub_xnu_resume (char *imagename)
|
||||
grub_file_t file;
|
||||
grub_size_t total_header_size;
|
||||
struct grub_xnu_hibernate_header hibhead;
|
||||
grub_uint8_t *buf;
|
||||
|
||||
void *code;
|
||||
void *image;
|
||||
grub_uint32_t codedest;
|
||||
grub_uint32_t codesize;
|
||||
grub_addr_t target_image;
|
||||
grub_err_t err;
|
||||
|
||||
file = grub_file_open (imagename);
|
||||
if (! file)
|
||||
@@ -94,18 +96,35 @@ grub_xnu_resume (char *imagename)
|
||||
/* Try to allocate necessary space.
|
||||
FIXME: mm isn't good enough yet to handle huge allocations.
|
||||
*/
|
||||
grub_xnu_hibernate_image = buf = XNU_RELOCATOR (alloc) (hibhead.image_size
|
||||
+ codesize
|
||||
+ GRUB_XNU_PAGESIZE);
|
||||
if (! buf)
|
||||
grub_xnu_relocator = grub_relocator_new ();
|
||||
if (!grub_xnu_relocator)
|
||||
{
|
||||
grub_file_close (file);
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
err = grub_relocator_alloc_chunk_addr (grub_xnu_relocator, &code,
|
||||
codedest, codesize + GRUB_XNU_PAGESIZE);
|
||||
if (err)
|
||||
{
|
||||
grub_file_close (file);
|
||||
return err;
|
||||
}
|
||||
|
||||
err = grub_relocator_alloc_chunk_align (grub_xnu_relocator, &image,
|
||||
&target_image, 0,
|
||||
(0xffffffff - hibhead.image_size) + 1,
|
||||
hibhead.image_size,
|
||||
GRUB_XNU_PAGESIZE);
|
||||
if (err)
|
||||
{
|
||||
grub_file_close (file);
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Read code part. */
|
||||
if (grub_file_seek (file, total_header_size) == (grub_off_t) -1
|
||||
|| grub_file_read (file, buf, codesize)
|
||||
|| grub_file_read (file, code, codesize)
|
||||
!= (grub_ssize_t) codesize)
|
||||
{
|
||||
grub_file_close (file);
|
||||
@@ -114,8 +133,7 @@ grub_xnu_resume (char *imagename)
|
||||
|
||||
/* Read image. */
|
||||
if (grub_file_seek (file, 0) == (grub_off_t) -1
|
||||
|| grub_file_read (file, buf + codesize + GRUB_XNU_PAGESIZE,
|
||||
hibhead.image_size)
|
||||
|| grub_file_read (file, image, hibhead.image_size)
|
||||
!= (grub_ssize_t) hibhead.image_size)
|
||||
{
|
||||
grub_file_close (file);
|
||||
@@ -124,12 +142,11 @@ grub_xnu_resume (char *imagename)
|
||||
grub_file_close (file);
|
||||
|
||||
/* Setup variables needed by asm helper. */
|
||||
grub_xnu_heap_will_be_at = codedest;
|
||||
grub_xnu_heap_start = buf;
|
||||
grub_xnu_heap_size = codesize + GRUB_XNU_PAGESIZE + hibhead.image_size;
|
||||
grub_xnu_heap_target_start = codedest;
|
||||
grub_xnu_heap_size = target_image + hibhead.image_size - codedest;
|
||||
grub_xnu_stack = (codedest + hibhead.stack);
|
||||
grub_xnu_entry_point = (codedest + hibhead.entry_point);
|
||||
grub_xnu_arg1 = codedest + codesize + GRUB_XNU_PAGESIZE;
|
||||
grub_xnu_arg1 = target_image;
|
||||
|
||||
grub_dprintf ("xnu", "entry point 0x%x\n", codedest + hibhead.entry_point);
|
||||
grub_dprintf ("xnu", "image at 0x%x\n",
|
||||
|
||||
Reference in new issue
Block a user