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
#include <grub/machine/memory.h>
21
#include <grub/cpu/linux.h>
22
#include <grub/offsets.h>
23
#include <multiboot.h>
24
#include <multiboot2.h>
27
* Note: GRUB is compiled with the options -mrtd and -mregparm=3.
28
* So the first three arguments are passed in %eax, %edx, and %ecx,
29
* respectively, and if a function has a fixed number of arguments
30
* and the number if greater than three, the function must return
31
* with "ret $N" where N is ((the number of arguments) - 3) * 4.
42
* This is a special data area at a fixed offset from the beginning.
45
. = _start + GRUB_KERNEL_MACHINE_PREFIX
48
/* to be filled by grub-mkimage */
51
* Leave some breathing room for the prefix.
54
. = _start + GRUB_KERNEL_MACHINE_DATA_END
57
* Support for booting GRUB from a Multiboot boot loader (e.g. GRUB itself).
59
.p2align 2 /* force 4-byte alignment */
64
.long MULTIBOOT_MEMORY_INFO
66
.long -0x1BADB002 - MULTIBOOT_MEMORY_INFO
69
#ifdef GRUB_MACHINE_MULTIBOOT
70
cmpl $MULTIBOOT_BOOTLOADER_MAGIC, %eax
72
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
* prot_to_real and associated structures (but NOT real_to_prot, that is
84
* only needed for BIOS gates).
86
#include "../realmode.S"
89
* Routines needed by Linux and Multiboot loaders.
91
#include "../loader.S"