multiboot: disentangle multiboot and multiboot2.
[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 MULTIBOOT2_INITIAL_STATE  { .eax = MULTIBOOT2_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_INITIAL_STATE  { .eax = MULTIBOOT_BOOTLOADER_MAGIC,   \
30     .ecx = 0,                                                           \
31     .edx = 0,                                                           \
32     /* Set esp to some random location in low memory to avoid breaking */ \
33     /* non-compliant kernels.  */                                       \
34     .esp = 0x7ff00                                                      \
35       }
36 #define MULTIBOOT_ENTRY_REGISTER eip
37 #define MULTIBOOT_MBI_REGISTER ebx
38 #define MULTIBOOT2_ARCHITECTURE_CURRENT MULTIBOOT2_ARCHITECTURE_I386
39
40 #ifdef GRUB_MACHINE_EFI
41 #ifdef __x86_64__
42 #define MULTIBOOT_EFI_INITIAL_STATE  { .rax = MULTIBOOT_BOOTLOADER_MAGIC,       \
43     .rcx = 0,                                                                   \
44     .rdx = 0,                                                                   \
45       }
46 #define MULTIBOOT_EFI_ENTRY_REGISTER rip
47 #define MULTIBOOT_EFI_MBI_REGISTER rbx
48 #endif
49 #endif
50
51 #define MULTIBOOT_ELF32_MACHINE EM_386
52 #define MULTIBOOT_ELF64_MACHINE EM_X86_64
53
54 #endif /* ! GRUB_MULTIBOOT_CPU_HEADER */