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/>.
21 #include <grub/symbol.h>
22 #include <grub/machine/memory.h>
23 #include <grub/cpu/linux.h>
24 #include <grub/cpu/kernel.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.
44 * This is a special data area at a fixed offset from the beginning.
47 . = EXT_C(start) + GRUB_KERNEL_CPU_PREFIX
50 /* to be filled by grub-mkimage */
53 * Leave some breathing room for the prefix.
56 . = EXT_C(start) + GRUB_KERNEL_CPU_DATA_END
59 * Support for booting GRUB from a Multiboot boot loader (e.g. GRUB itself).
61 .p2align 2 /* force 4-byte alignment */
66 .long MULTIBOOT_MEMORY_INFO
68 .long -0x1BADB002 - MULTIBOOT_MEMORY_INFO
71 cmpl $MULTIBOOT_MAGIC2, %eax
73 movl %ebx, EXT_C(startup_multiboot_info)
76 /* initialize the stack */
77 movl $GRUB_MEMORY_MACHINE_PROT_STACK, %esp
79 /* jump to the main body of C code */
83 * This call is special... it never returns... in fact it should simply
91 * prot_to_real and associated structures (but NOT real_to_prot, that is
92 * only needed for BIOS gates).
94 #include "../realmode.S"
97 * Routines needed by Linux and Multiboot loaders.
99 #include "../loader.S"