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

@ -23,7 +23,6 @@
#include <grub/machine/init.h>
#include <grub/machine/memory.h>
#include <grub/memory.h>
#include <grub/machine/machine.h>
#include <grub/file.h>
#include <grub/err.h>
#include <grub/dl.h>

View file

@ -469,21 +469,22 @@ find_framebuf (grub_uint32_t *fb_base, grub_uint32_t *line_len)
{
int found = 0;
auto int NESTED_FUNC_ATTR find_card (int bus, int dev, int func,
auto int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev,
grub_pci_id_t pciid);
int NESTED_FUNC_ATTR find_card (int bus, int dev, int func,
int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev,
grub_pci_id_t pciid)
{
grub_pci_address_t addr;
addr = grub_pci_make_address (bus, dev, func, 2);
addr = grub_pci_make_address (dev, 2);
if (grub_pci_read (addr) >> 24 == 0x3)
{
int i;
grub_printf ("Display controller: %d:%d.%d\nDevice id: %x\n",
bus, dev, func, pciid);
grub_pci_get_bus (dev), grub_pci_get_device (dev),
grub_pci_get_function (dev), pciid);
addr += 8;
for (i = 0; i < 6; i++, addr += 4)
{

View file

@ -71,21 +71,22 @@ find_framebuf (grub_uint32_t *fb_base, grub_uint32_t *line_len)
{
int found = 0;
auto int NESTED_FUNC_ATTR find_card (int bus, int dev, int func,
auto int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev,
grub_pci_id_t pciid);
int NESTED_FUNC_ATTR find_card (int bus, int dev, int func,
int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev,
grub_pci_id_t pciid)
{
grub_pci_address_t addr;
addr = grub_pci_make_address (bus, dev, func, 2);
addr = grub_pci_make_address (dev, 2);
if (grub_pci_read (addr) >> 24 == 0x3)
{
int i;
grub_printf ("Display controller: %d:%d.%d\nDevice id: %x\n",
bus, dev, func, pciid);
grub_pci_get_bus (dev), grub_pci_get_device (dev),
grub_pci_get_function (dev), pciid);
addr += 8;
for (i = 0; i < 6; i++, addr += 4)
{

View file

@ -17,7 +17,6 @@
*/
#include <grub/loader.h>
#include <grub/machine/machine.h>
#include <grub/machine/memory.h>
#include <grub/machine/loader.h>
#include <grub/normal.h>

View file

@ -48,18 +48,36 @@
#include <grub/device.h>
#include <grub/partition.h>
#endif
#include <grub/i386/relocator.h>
extern grub_dl_t my_mod;
static struct grub_multiboot_info *mbi, *mbi_dest;
static grub_addr_t entry;
static struct multiboot_info *mbi, *mbi_dest;
static char *playground = 0;
static grub_size_t code_size;
char *grub_multiboot_payload_orig;
grub_addr_t grub_multiboot_payload_dest;
grub_size_t grub_multiboot_payload_size;
grub_uint32_t grub_multiboot_payload_eip;
static grub_err_t
grub_multiboot_boot (void)
{
grub_multiboot_real_boot (entry, mbi_dest);
struct grub_relocator32_state state =
{
.eax = MULTIBOOT_MAGIC2,
.ebx = PTR_TO_UINT32 (mbi_dest),
.ecx = 0,
.edx = 0,
.eip = grub_multiboot_payload_eip,
/* Set esp to some random location in low memory to avoid breaking
non-compliant kernels. */
.esp = 0x7ff00
};
grub_relocator32_boot (grub_multiboot_payload_orig,
grub_multiboot_payload_dest,
state);
/* Not reached. */
return GRUB_ERR_NONE;
@ -68,22 +86,22 @@ grub_multiboot_boot (void)
static grub_err_t
grub_multiboot_unload (void)
{
if (playground)
if (mbi)
{
unsigned int i;
for (i = 0; i < mbi->mods_count; i++)
{
grub_free ((void *)
((struct grub_mod_list *) mbi->mods_addr)[i].mod_start);
((struct multiboot_mod_list *) mbi->mods_addr)[i].mod_start);
grub_free ((void *)
((struct grub_mod_list *) mbi->mods_addr)[i].cmdline);
((struct multiboot_mod_list *) mbi->mods_addr)[i].cmdline);
}
grub_free ((void *) mbi->mods_addr);
grub_free (playground);
}
grub_relocator32_free (grub_multiboot_payload_orig);
mbi = NULL;
playground = NULL;
grub_multiboot_payload_orig = NULL;
grub_dl_unref (my_mod);
return GRUB_ERR_NONE;
@ -107,14 +125,14 @@ grub_get_multiboot_mmap_len (void)
grub_mmap_iterate (hook);
return count * sizeof (struct grub_multiboot_mmap_entry);
return count * sizeof (struct multiboot_mmap_entry);
}
/* Fill previously allocated Multiboot mmap. */
static void
grub_fill_multiboot_mmap (struct grub_multiboot_mmap_entry *first_entry)
grub_fill_multiboot_mmap (struct multiboot_mmap_entry *first_entry)
{
struct grub_multiboot_mmap_entry *mmap_entry = (struct grub_multiboot_mmap_entry *) first_entry;
struct multiboot_mmap_entry *mmap_entry = (struct multiboot_mmap_entry *) first_entry;
auto int NESTED_FUNC_ATTR hook (grub_uint64_t, grub_uint64_t, grub_uint32_t);
int NESTED_FUNC_ATTR hook (grub_uint64_t addr, grub_uint64_t size, grub_uint32_t type)
@ -122,7 +140,7 @@ grub_fill_multiboot_mmap (struct grub_multiboot_mmap_entry *first_entry)
mmap_entry->addr = addr;
mmap_entry->len = size;
mmap_entry->type = type;
mmap_entry->size = sizeof (struct grub_multiboot_mmap_entry) - sizeof (mmap_entry->size);
mmap_entry->size = sizeof (struct multiboot_mmap_entry) - sizeof (mmap_entry->size);
mmap_entry++;
return 0;
@ -197,7 +215,7 @@ grub_multiboot (int argc, char *argv[])
{
grub_file_t file = 0;
char buffer[MULTIBOOT_SEARCH], *cmdline = 0, *p;
struct grub_multiboot_header *header;
struct multiboot_header *header;
grub_ssize_t len, cmdline_length, boot_loader_name_length;
grub_uint32_t mmap_length;
int i;
@ -228,9 +246,9 @@ grub_multiboot (int argc, char *argv[])
/* Look for the multiboot header in the buffer. The header should
be at least 12 bytes and aligned on a 4-byte boundary. */
for (header = (struct grub_multiboot_header *) buffer;
for (header = (struct multiboot_header *) buffer;
((char *) header <= buffer + len - 12) || (header = 0);
header = (struct grub_multiboot_header *) ((char *) header + 4))
header = (struct multiboot_header *) ((char *) header + 4))
{
if (header->magic == MULTIBOOT_MAGIC
&& !(header->magic + header->flags + header->checksum))
@ -250,11 +268,8 @@ grub_multiboot (int argc, char *argv[])
goto fail;
}
if (playground)
{
grub_free (playground);
playground = NULL;
}
grub_relocator32_free (grub_multiboot_payload_orig);
grub_multiboot_payload_orig = NULL;
mmap_length = grub_get_multiboot_mmap_len ();
@ -275,12 +290,12 @@ grub_multiboot (int argc, char *argv[])
#define boot_loader_name_addr(x) \
((void *) ((x) + code_size + cmdline_length))
#define mbi_addr(x) ((void *) ((x) + code_size + cmdline_length + boot_loader_name_length))
#define mmap_addr(x) ((void *) ((x) + code_size + cmdline_length + boot_loader_name_length + sizeof (struct grub_multiboot_info)))
#define mmap_addr(x) ((void *) ((x) + code_size + cmdline_length + boot_loader_name_length + sizeof (struct multiboot_info)))
grub_multiboot_payload_size = cmdline_length
/* boot_loader_name_length might need to grow for mbi,etc to be aligned (see below) */
+ boot_loader_name_length + 3
+ sizeof (struct grub_multiboot_info) + mmap_length;
+ sizeof (struct multiboot_info) + mmap_length;
if (header->flags & MULTIBOOT_AOUT_KLUDGE)
{
@ -296,13 +311,14 @@ grub_multiboot (int argc, char *argv[])
grub_multiboot_payload_dest = header->load_addr;
grub_multiboot_payload_size += code_size;
playground = grub_malloc (RELOCATOR_SIZEOF(forward) + grub_multiboot_payload_size + RELOCATOR_SIZEOF(backward));
if (! playground)
grub_multiboot_payload_orig
= grub_relocator32_alloc (grub_multiboot_payload_size);
if (! grub_multiboot_payload_orig)
goto fail;
grub_multiboot_payload_orig = (long) playground + RELOCATOR_SIZEOF(forward);
if ((grub_file_seek (file, offset)) == (grub_off_t) - 1)
if ((grub_file_seek (file, offset)) == (grub_off_t) -1)
goto fail;
grub_file_read (file, (void *) grub_multiboot_payload_orig, load_size);
@ -313,7 +329,7 @@ grub_multiboot (int argc, char *argv[])
grub_memset ((void *) (grub_multiboot_payload_orig + load_size), 0,
header->bss_end_addr - header->load_addr - load_size);
grub_multiboot_payload_entry_offset = header->entry_addr - header->load_addr;
grub_multiboot_payload_eip = header->entry_addr;
}
else if (grub_multiboot_load_elf (file, buffer) != GRUB_ERR_NONE)
@ -324,7 +340,7 @@ grub_multiboot (int argc, char *argv[])
mbi = mbi_addr (grub_multiboot_payload_orig);
mbi_dest = mbi_addr (grub_multiboot_payload_dest);
grub_memset (mbi, 0, sizeof (struct grub_multiboot_info));
grub_memset (mbi, 0, sizeof (struct multiboot_info));
mbi->mmap_length = mmap_length;
grub_fill_multiboot_mmap (mmap_addr (grub_multiboot_payload_orig));
@ -334,23 +350,6 @@ grub_multiboot (int argc, char *argv[])
mbi->mmap_addr = (grub_uint32_t) mmap_addr (grub_multiboot_payload_dest);
mbi->flags |= MULTIBOOT_INFO_MEM_MAP;
if (grub_multiboot_payload_dest >= grub_multiboot_payload_orig)
{
grub_memmove (playground, &grub_multiboot_forward_relocator, RELOCATOR_SIZEOF(forward));
entry = (grub_addr_t) playground;
}
else
{
grub_memmove ((char *) (grub_multiboot_payload_orig + grub_multiboot_payload_size),
&grub_multiboot_backward_relocator, RELOCATOR_SIZEOF(backward));
entry = (grub_addr_t) grub_multiboot_payload_orig + grub_multiboot_payload_size;
}
grub_dprintf ("multiboot_loader", "dest=%p, size=0x%x, entry_offset=0x%x\n",
(void *) grub_multiboot_payload_dest,
grub_multiboot_payload_size,
grub_multiboot_payload_entry_offset);
/* Convert from bytes to kilobytes. */
mbi->mem_lower = grub_mmap_get_lower () / 1024;
mbi->mem_upper = grub_mmap_get_upper () / 1024;
@ -462,10 +461,10 @@ grub_module (int argc, char *argv[])
if (mbi->flags & MULTIBOOT_INFO_MODS)
{
struct grub_mod_list *modlist = (struct grub_mod_list *) mbi->mods_addr;
struct multiboot_mod_list *modlist = (struct multiboot_mod_list *) mbi->mods_addr;
modlist = grub_realloc (modlist, (mbi->mods_count + 1)
* sizeof (struct grub_mod_list));
* sizeof (struct multiboot_mod_list));
if (! modlist)
goto fail;
mbi->mods_addr = (grub_uint32_t) modlist;
@ -478,7 +477,7 @@ grub_module (int argc, char *argv[])
}
else
{
struct grub_mod_list *modlist = grub_zalloc (sizeof (struct grub_mod_list));
struct multiboot_mod_list *modlist = grub_zalloc (sizeof (struct multiboot_mod_list));
if (! modlist)
goto fail;
modlist->mod_start = (grub_uint32_t) module;

View file

@ -32,6 +32,8 @@
#error "I'm confused"
#endif
#include <grub/i386/relocator.h>
#define CONCAT(a,b) CONCAT_(a, b)
#define CONCAT_(a,b) a ## b
@ -99,11 +101,12 @@ CONCAT(grub_multiboot_load_elf, XX) (grub_file_t file, void *buffer)
grub_multiboot_payload_dest = phdr(lowest_segment)->p_paddr;
grub_multiboot_payload_size += code_size;
playground = grub_malloc (RELOCATOR_SIZEOF(forward) + grub_multiboot_payload_size + RELOCATOR_SIZEOF(backward));
if (! playground)
return grub_errno;
grub_multiboot_payload_orig = (long) playground + RELOCATOR_SIZEOF(forward);
grub_multiboot_payload_orig
= grub_relocator32_alloc (grub_multiboot_payload_size);
if (!grub_multiboot_payload_orig)
return grub_errno;
/* Load every loadable segment in memory. */
for (i = 0; i < ehdr->e_phnum; i++)
@ -135,8 +138,8 @@ CONCAT(grub_multiboot_load_elf, XX) (grub_file_t file, void *buffer)
if (phdr(i)->p_vaddr <= ehdr->e_entry
&& phdr(i)->p_vaddr + phdr(i)->p_memsz > ehdr->e_entry)
{
grub_multiboot_payload_entry_offset = (ehdr->e_entry - phdr(i)->p_vaddr)
+ (phdr(i)->p_paddr - phdr(lowest_segment)->p_paddr);
grub_multiboot_payload_eip = grub_multiboot_payload_dest
+ (ehdr->e_entry - phdr(i)->p_vaddr) + (phdr(i)->p_paddr - phdr(lowest_segment)->p_paddr);
break;
}

View file

@ -22,81 +22,6 @@
.p2align 2 /* force 4-byte alignment */
/*
* This starts the multiboot kernel.
*/
VARIABLE(grub_multiboot_payload_size)
.long 0
VARIABLE(grub_multiboot_payload_orig)
.long 0
VARIABLE(grub_multiboot_payload_dest)
.long 0
VARIABLE(grub_multiboot_payload_entry_offset)
.long 0
/*
* The relocators below understand the following parameters:
* ecx: Size of the block to be copied.
* esi: Where to copy from (always lowest address, even if we're relocating
* backwards).
* edi: Where to copy to (likewise).
* edx: Offset of the entry point (relative to the beginning of the block).
*/
VARIABLE(grub_multiboot_forward_relocator)
/* Add entry offset. */
addl %edi, %edx
/* Forward copy. */
cld
rep
movsb
jmp *%edx
VARIABLE(grub_multiboot_forward_relocator_end)
VARIABLE(grub_multiboot_backward_relocator)
/* Add entry offset (before %edi is mangled). */
addl %edi, %edx
/* Backward movsb is implicitly off-by-one. compensate that. */
decl %esi
decl %edi
/* Backward copy. */
std
addl %ecx, %esi
addl %ecx, %edi
rep
movsb
cld
jmp *%edx
VARIABLE(grub_multiboot_backward_relocator_end)
FUNCTION(grub_multiboot_real_boot)
/* Push the entry address on the stack. */
pushl %eax
/* Move the address of the multiboot information structure to ebx. */
movl %edx,%ebx
/* Interrupts should be disabled. */
cli
/* Where do we copy what from. */
movl EXT_C(grub_multiboot_payload_size), %ecx
movl EXT_C(grub_multiboot_payload_orig), %esi
movl EXT_C(grub_multiboot_payload_dest), %edi
movl EXT_C(grub_multiboot_payload_entry_offset), %edx
/* Move the magic value into eax. */
movl $MULTIBOOT_MAGIC2, %eax
/* Jump to the relocator. */
popl %ebp
jmp *%ebp
/*
* This starts the multiboot 2 kernel.
*/

View file

@ -95,17 +95,17 @@ grub_mb2_arch_boot (grub_addr_t entry, void *tags)
}
void
grub_mb2_arch_unload (struct multiboot_tag_header *tags)
grub_mb2_arch_unload (struct multiboot2_tag_header *tags)
{
struct multiboot_tag_header *tag;
struct multiboot2_tag_header *tag;
/* Free all module memory in the tag list. */
for_each_tag (tag, tags)
{
if (tag->key == MULTIBOOT2_TAG_MODULE)
{
struct multiboot_tag_module *module =
(struct multiboot_tag_module *) tag;
struct multiboot2_tag_module *module =
(struct multiboot2_tag_module *) tag;
grub_free((void *) module->addr);
}
}

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;

View file

@ -1,211 +0,0 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/symbol.h>
.p2align 4 /* force 16-byte alignment */
VARIABLE(grub_xnu_launcher_start)
base:
cli
#ifndef __x86_64__
/* mov imm32, %eax */
.byte 0xb8
VARIABLE(grub_xnu_heap_will_be_at)
.long 0
mov %eax, %edi
/* mov imm32, %eax */
.byte 0xb8
VARIABLE(grub_xnu_heap_start)
.long 0
mov %eax, %esi
/* mov imm32, %ecx */
.byte 0xb9
VARIABLE(grub_xnu_heap_size)
.long 0
mov %edi, %eax
add %ecx, %eax
/* %rax now contains our starting position after relocation. */
/* One more page to copy: ourselves. */
add $0x403, %ecx
shr $2, %ecx
/* Forward copy. */
cld
rep
movsl
mov %eax, %esi
add $(cont0-base), %eax
jmp *%eax
cont0:
#else
xorq %rax, %rax
/* mov imm32, %eax */
.byte 0xb8
VARIABLE(grub_xnu_heap_will_be_at)
.long 0
mov %rax, %rdi
/* mov imm32, %rax */
.byte 0x48
.byte 0xb8
VARIABLE(grub_xnu_heap_start)
.long 0
.long 0
mov %rax, %rsi
/* mov imm32, %rcx */
.byte 0x48
.byte 0xb9
VARIABLE(grub_xnu_heap_size)
.long 0
.long 0
mov %rdi, %rax
add %rcx, %rax
/* %rax now contains our starting position after relocation. */
/* One more page to copy: ourselves. */
add $0x403, %rcx
shr $2, %rcx
/* Forward copy. */
cld
rep
movsl
mov %rax, %rsi
#ifdef APPLE_CC
add $(cont0-base), %eax
#else
add $(cont0-base), %rax
#endif
jmp *%rax
cont0:
#ifdef APPLE_CC
lea (cont1 - base) (%esi, 1), %eax
mov %eax, (jump_vector - base) (%esi, 1)
lea (gdt - base) (%esi, 1), %eax
mov %eax, (gdt_addr - base) (%esi, 1)
/* Switch to compatibility mode. */
lgdt (gdtdesc - base) (%esi, 1)
/* Update %cs. Thanks to David Miller for pointing this mistake out. */
ljmp *(jump_vector - base) (%esi,1)
#else
lea (cont1 - base) (%rsi, 1), %rax
mov %eax, (jump_vector - base) (%rsi, 1)
lea (gdt - base) (%rsi, 1), %rax
mov %rax, (gdt_addr - base) (%rsi, 1)
/* Switch to compatibility mode. */
lgdt (gdtdesc - base) (%rsi, 1)
/* Update %cs. Thanks to David Miller for pointing this mistake out. */
ljmp *(jump_vector - base) (%rsi, 1)
#endif
cont1:
.code32
/* Update other registers. */
mov $0x18, %eax
mov %eax, %ds
mov %eax, %es
mov %eax, %fs
mov %eax, %gs
mov %eax, %ss
/* Disable paging. */
mov %cr0, %eax
and $0x7fffffff, %eax
mov %eax, %cr0
/* Disable amd64. */
mov $0xc0000080, %ecx
rdmsr
and $0xfffffeff, %eax
wrmsr
/* Turn off PAE. */
movl %cr4, %eax
and $0xffffffcf, %eax
mov %eax, %cr4
jmp cont2
cont2:
#endif
.code32
/* Registers on XNU boot: eip, esp and eax. */
/* mov imm32, %ecx */
.byte 0xb9
VARIABLE (grub_xnu_entry_point)
.long 0
/* mov imm32, %eax */
.byte 0xb8
VARIABLE (grub_xnu_arg1)
.long 0
/* mov imm32, %ebx */
.byte 0xbb
VARIABLE (grub_xnu_stack)
.long 0
movl %ebx, %esp
jmp *%ecx
#ifdef __x86_64__
/* GDT. Copied from loader/i386/linux.c. */
.p2align 4
gdt:
/* NULL. */
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
/* Reserved. */
.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
/* Code segment. */
.byte 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x9A, 0xCF, 0x00
/* Data segment. */
.byte 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x92, 0xCF, 0x00
gdtdesc:
.word 31
gdt_addr:
/* Filled by the code. */
.quad 0
.p2align 4
jump_vector:
/* Jump location. Is filled by the code */
.long 0
.long 0x10
#endif
VARIABLE(grub_xnu_launcher_end)