807a1de27f900c8393476736051e20ee1af6717c
[grub.git] / include / grub / i386 / multiboot.h
1 /*
2  *  GRUB  --  GRand Unified Bootloader
3  *  Copyright (C) 2002,2003,2004,2007,2008,2009  Free Software Foundation, Inc.
4  *
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.
9  *
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.
14  *
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/>.
17  */
18
19 #ifndef GRUB_MULTIBOOT_CPU_HEADER
20 #define GRUB_MULTIBOOT_CPU_HEADER       1
21
22 #define MULTIBOOT_INITIAL_STATE  { .eax = MULTIBOOT_BOOTLOADER_MAGIC,   \
23     .ecx = 0,                                                           \
24     .edx = 0,                                                           \
25     /* Set esp to some random location in low memory to avoid breaking */ \
26     /* non-compliant kernels.  */                                       \
27     .esp = 0x7ff00                                                      \
28       }
29 #define MULTIBOOT_ENTRY_REGISTER eip
30 #define MULTIBOOT_MBI_REGISTER ebx
31 #define MULTIBOOT_ARCHITECTURE_CURRENT MULTIBOOT_ARCHITECTURE_I386
32
33 #ifdef GRUB_MACHINE_EFI
34 #ifdef __x86_64__
35 #define MULTIBOOT_EFI_INITIAL_STATE  { .rax = MULTIBOOT_BOOTLOADER_MAGIC,       \
36     .rcx = 0,                                                                   \
37     .rdx = 0,                                                                   \
38       }
39 #define MULTIBOOT_EFI_ENTRY_REGISTER rip
40 #define MULTIBOOT_EFI_MBI_REGISTER rbx
41 #endif
42 #endif
43
44 #define MULTIBOOT_ELF32_MACHINE EM_386
45 #define MULTIBOOT_ELF64_MACHINE EM_X86_64
46
47 #endif /* ! GRUB_MULTIBOOT_CPU_HEADER */