2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 1999,2000,2001,2002,2003,2005,2006,2007,2008 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/>.
19 #include <grub/symbol.h>
20 /* For stack parameters. */
21 #include <grub/i386/pc/memory.h>
22 #include <grub/machine/memory.h>
23 #include <grub/cpu/linux.h>
24 #include <grub/offsets.h>
25 #include <multiboot.h>
26 #include <multiboot2.h>
29 * Note: GRUB is compiled with the options -mrtd and -mregparm=3.
30 * So the first three arguments are passed in %eax, %edx, and %ecx,
31 * respectively, and if a function has a fixed number of arguments
32 * and the number if greater than three, the function must return
33 * with "ret $N" where N is ((the number of arguments) - 3) * 4.
41 #ifdef GRUB_MACHINE_MULTIBOOT
42 cmpl $MULTIBOOT_BOOTLOADER_MAGIC, %eax
44 movl %ebx, EXT_C(startup_multiboot_info)
48 /* initialize the stack */
49 movl $GRUB_MEMORY_MACHINE_PROT_STACK, %esp
51 /* jump to the main body of C code */
55 * Support for booting GRUB from a Multiboot boot loader (e.g. GRUB itself).
57 .p2align 2 /* force 4-byte alignment */
62 .long MULTIBOOT_MEMORY_INFO
64 .long -0x1BADB002 - MULTIBOOT_MEMORY_INFO
67 * prot_to_real and associated structures (but NOT real_to_prot, that is
68 * only needed for BIOS gates).
70 #include "../realmode.S"