merge mtrunk into xnu

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2009-12-18 03:57:32 +01:00
commit 7ea73643f5
224 changed files with 43437 additions and 7593 deletions

View file

@ -34,6 +34,8 @@
#include <grub/gzio.h>
char grub_xnu_cmdline[1024];
grub_uint32_t grub_xnu_heap_will_be_at;
grub_uint32_t grub_xnu_entry_point, grub_xnu_arg1, grub_xnu_stack;
/* Aliases set for some tables. */
struct tbl_alias
@ -56,21 +58,6 @@ struct grub_xnu_devprop_device_descriptor
int pathlen;
};
/* The following function is used to be able to debug xnu loader
with grub-emu. */
#ifdef GRUB_UTIL
static grub_err_t
grub_xnu_launch (void)
{
grub_printf ("Fake launch %x:%p:%p", grub_xnu_entry_point, grub_xnu_arg1,
grub_xnu_stack);
grub_getkey ();
return 0;
}
#else
static void (*grub_xnu_launch) (void) = 0;
#endif
static int
utf16_strlen (grub_uint16_t *in)
{
@ -835,6 +822,19 @@ grub_cpu_xnu_fill_devicetree (void)
return GRUB_ERR_NONE;
}
grub_err_t
grub_xnu_boot_resume (void)
{
struct grub_relocator32_state state;
state.esp = grub_xnu_stack;
state.eip = grub_xnu_entry_point;
state.eax = grub_xnu_arg1;
return grub_relocator32_boot (grub_xnu_heap_start, grub_xnu_heap_will_be_at,
state);
}
/* Boot xnu. */
grub_err_t
grub_xnu_boot (void)
@ -853,6 +853,7 @@ grub_xnu_boot (void)
void *devtree;
grub_size_t devtreelen;
int i;
struct grub_relocator32_state state;
err = grub_autoefi_prepare ();
if (err)
@ -938,7 +939,8 @@ grub_xnu_boot (void)
grub_memcpy (bootparams_relloc->cmdline, grub_xnu_cmdline,
sizeof (bootparams_relloc->cmdline));
bootparams_relloc->devtree = ((char *) devtree - grub_xnu_heap_start)
bootparams_relloc->devtree
= ((grub_uint8_t *) devtree - (grub_uint8_t *) grub_xnu_heap_start)
+ grub_xnu_heap_will_be_at;
bootparams_relloc->devtreelen = devtreelen;
@ -1003,15 +1005,6 @@ grub_xnu_boot (void)
grub_xnu_stack = bootparams_relloc->heap_start
+ bootparams_relloc->heap_size + GRUB_XNU_PAGESIZE;
grub_xnu_arg1 = bootparams_relloc_off + grub_xnu_heap_will_be_at;
#ifndef GRUB_UTIL
grub_xnu_launch = (void (*) (void))
(grub_xnu_heap_start + grub_xnu_heap_size);
#endif
grub_memcpy (grub_xnu_heap_start + grub_xnu_heap_size,
grub_xnu_launcher_start,
grub_xnu_launcher_end - grub_xnu_launcher_start);
if (! grub_autoefi_exit_boot_services (map_key))
return grub_error (GRUB_ERR_IO, "can't exit boot services");
@ -1019,10 +1012,11 @@ grub_xnu_boot (void)
grub_autoefi_set_virtual_address_map (memory_map_size, descriptor_size,
descriptor_version,memory_map);
grub_xnu_launch ();
/* Never reaches here. */
return 0;
state.eip = grub_xnu_entry_point;
state.eax = grub_xnu_arg1;
state.esp = grub_xnu_stack;
return grub_relocator32_boot (grub_xnu_heap_start, grub_xnu_heap_will_be_at,
state);
}
static grub_command_t cmd_devprop_load;