Upgraded GRUB2 to 2.00 release.
[AROS.git] / arch / all-pc / boot / grub2-aros / grub-core / kern / i386 / coreboot / startup.S
blobdc2c62a25f4a5ce9bea8367b4fe1366fef9b1515
1 /*
2  *  GRUB  --  GRand Unified Bootloader
3  *  Copyright (C) 1999,2000,2001,2002,2003,2005,2006,2007,2008 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  */
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.
34  */
36         .file   "startup.S"
37         .text
38         .globl  start, _start
39 start:
40 _start:
41 #ifdef GRUB_MACHINE_MULTIBOOT
42         cmpl    $MULTIBOOT_BOOTLOADER_MAGIC, %eax
43         jne 0f
44         movl    %ebx, EXT_C(startup_multiboot_info)
46 #endif
48         /* initialize the stack */
49         movl $GRUB_MEMORY_MACHINE_PROT_STACK, %esp
51         /* jump to the main body of C code */
52         jmp EXT_C(grub_main)
55  *  Support for booting GRUB from a Multiboot boot loader (e.g. GRUB itself).
56  */
57         .p2align        2       /* force 4-byte alignment */
58 multiboot_header:
59         /* magic */
60         .long   0x1BADB002
61         /* flags */
62         .long   MULTIBOOT_MEMORY_INFO
63         /* checksum */
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).
69  */
70 #include "../realmode.S"
72 #include "../int.S"