/[grub]/grub2/kern/i386/pc/startup.S
ViewVC logotype

Diff of /grub2/kern/i386/pc/startup.S

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.17 by chaac, Tue Aug 9 14:39:50 2005 UTC revision 1.18 by okuji, Wed Sep 28 23:04:26 2005 UTC
# Line 104  VARIABLE(grub_prefix) Line 104  VARIABLE(grub_prefix)
104    
105          . = EXT_C(start) + 0x50          . = EXT_C(start) + 0x50
106    
107    /*
108     * Support for booting GRUB from a Multiboot boot loader (e.g. GRUB itself).
109     * This uses the a.out kludge to load raw binary to the area starting at 1MB,
110     * and relocates itself after loaded.
111     */
112    multiboot_header:
113            /* magic */
114            .long   0x1BADB002
115            /* flags */
116            .long   (1 << 16)
117            /* checksum */
118            .long   -0x1BADB002 - (1 << 16)
119            /* header addr */
120            .long   multiboot_header - _start + 0x100000 + 0x200
121            /* load addr */
122            .long   0x100000
123            /* load end addr */
124            .long   0
125            /* bss end addr */
126            .long   0
127            /* entry addr */
128            .long   multiboot_entry - _start + 0x100000 + 0x200
129            
130    multiboot_entry:
131            .code32
132            /* obtain the boot device */
133            movl    12(%ebx), %edx
134    
135            /* relocate the code */
136            movl    $(GRUB_KERNEL_MACHINE_RAW_SIZE + 0x200), %ecx
137            addl    EXT_C(grub_compressed_size) - _start + 0x100000 + 0x200, %ecx
138            movl    $0x100000, %esi
139            movl    $GRUB_BOOT_MACHINE_KERNEL_ADDR, %edi
140            cld
141            rep
142            movsb
143            /* jump to the real address */
144            movl    $multiboot_trampoline, %eax
145            jmp     *%eax
146            
147    multiboot_trampoline:
148            /* fill the boot information */
149            movl    %edx, %eax
150            shrl    $8, %eax
151            xorl    %ebx, %ebx
152            cmpb    $0xFF, %al
153            je      1f
154            movb    %ah, %bl
155            movl    %ebx, EXT_C(grub_install_dos_part)
156    1:
157            cmpb    $0xFF, %ah
158            je      2f
159            movb    %al, %bl
160            movl    %ebx, EXT_C(grub_install_bsd_part)
161    2:
162            shrl    $24, %edx
163            /* enter the usual booting */
164            call    prot_to_real
165            .code16
166            
167  /* the real mode code continues... */  /* the real mode code continues... */
168  codestart:  codestart:
169          cli             /* we're not safe here! */          cli             /* we're not safe here! */

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26