Make mb header to protected part
This commit is contained in:
parent
3ac9e79207
commit
25e09515ad
2 changed files with 53 additions and 57 deletions
|
@ -109,7 +109,58 @@ bss_start:
|
||||||
bss_end:
|
bss_end:
|
||||||
.long 0
|
.long 0
|
||||||
#endif
|
#endif
|
||||||
|
/*
|
||||||
|
* This is the area for all of the special variables.
|
||||||
|
*/
|
||||||
|
|
||||||
|
VARIABLE(grub_boot_drive)
|
||||||
|
.byte 0
|
||||||
|
|
||||||
|
/* the real mode code continues... */
|
||||||
|
LOCAL (codestart):
|
||||||
|
cli /* we're not safe here! */
|
||||||
|
|
||||||
|
/* set up %ds, %ss, and %es */
|
||||||
|
xorw %ax, %ax
|
||||||
|
movw %ax, %ds
|
||||||
|
movw %ax, %ss
|
||||||
|
movw %ax, %es
|
||||||
|
|
||||||
|
/* set up the real mode/BIOS stack */
|
||||||
|
movl $GRUB_MEMORY_MACHINE_REAL_STACK, %ebp
|
||||||
|
movl %ebp, %esp
|
||||||
|
|
||||||
|
sti /* we're safe again */
|
||||||
|
|
||||||
|
/* save the boot drive */
|
||||||
|
ADDR32 movb %dl, EXT_C(grub_boot_drive)
|
||||||
|
|
||||||
|
/* reset disk system (%ah = 0) */
|
||||||
|
int $0x13
|
||||||
|
|
||||||
|
/* transition to protected mode */
|
||||||
|
DATA32 call real_to_prot
|
||||||
|
|
||||||
|
/* The ".code32" directive takes GAS out of 16-bit mode. */
|
||||||
|
.code32
|
||||||
|
|
||||||
|
incl %eax
|
||||||
|
call grub_gate_a20
|
||||||
|
|
||||||
|
movl EXT_C(grub_compressed_size), %edx
|
||||||
|
addl $(GRUB_KERNEL_MACHINE_RAW_SIZE - GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART), %edx
|
||||||
|
movl reed_solomon_redundancy, %ecx
|
||||||
|
leal _start + GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART, %eax
|
||||||
|
testl %edx, %edx
|
||||||
|
jz post_reed_solomon
|
||||||
|
call EXT_C (grub_reed_solomon_recover)
|
||||||
|
jmp post_reed_solomon
|
||||||
|
|
||||||
|
#include <rs_decoder.S>
|
||||||
|
|
||||||
|
.text
|
||||||
|
|
||||||
|
. = _start + GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART
|
||||||
/*
|
/*
|
||||||
* Support for booting GRUB from a Multiboot boot loader (e.g. GRUB itself).
|
* Support for booting GRUB from a Multiboot boot loader (e.g. GRUB itself).
|
||||||
* This uses the a.out kludge to load raw binary to the area starting at 1MB,
|
* This uses the a.out kludge to load raw binary to the area starting at 1MB,
|
||||||
|
@ -173,53 +224,7 @@ multiboot_trampoline:
|
||||||
movb $0xFF, %dh
|
movb $0xFF, %dh
|
||||||
/* enter the usual booting */
|
/* enter the usual booting */
|
||||||
call prot_to_real
|
call prot_to_real
|
||||||
.code16
|
|
||||||
|
|
||||||
/* the real mode code continues... */
|
|
||||||
LOCAL (codestart):
|
|
||||||
cli /* we're not safe here! */
|
|
||||||
|
|
||||||
/* set up %ds, %ss, and %es */
|
|
||||||
xorw %ax, %ax
|
|
||||||
movw %ax, %ds
|
|
||||||
movw %ax, %ss
|
|
||||||
movw %ax, %es
|
|
||||||
|
|
||||||
/* set up the real mode/BIOS stack */
|
|
||||||
movl $GRUB_MEMORY_MACHINE_REAL_STACK, %ebp
|
|
||||||
movl %ebp, %esp
|
|
||||||
|
|
||||||
sti /* we're safe again */
|
|
||||||
|
|
||||||
/* save the boot drive */
|
|
||||||
ADDR32 movb %dl, EXT_C(grub_boot_drive)
|
|
||||||
|
|
||||||
/* reset disk system (%ah = 0) */
|
|
||||||
int $0x13
|
|
||||||
|
|
||||||
/* transition to protected mode */
|
|
||||||
DATA32 call real_to_prot
|
|
||||||
|
|
||||||
/* The ".code32" directive takes GAS out of 16-bit mode. */
|
|
||||||
.code32
|
|
||||||
|
|
||||||
incl %eax
|
|
||||||
call grub_gate_a20
|
|
||||||
|
|
||||||
movl EXT_C(grub_compressed_size), %edx
|
|
||||||
addl $(GRUB_KERNEL_MACHINE_RAW_SIZE - GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART), %edx
|
|
||||||
movl reed_solomon_redundancy, %ecx
|
|
||||||
leal _start + GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART, %eax
|
|
||||||
testl %edx, %edx
|
|
||||||
jz post_reed_solomon
|
|
||||||
call EXT_C (grub_reed_solomon_recover)
|
|
||||||
jmp post_reed_solomon
|
|
||||||
|
|
||||||
#include <rs_decoder.S>
|
|
||||||
|
|
||||||
.text
|
|
||||||
|
|
||||||
. = _start + GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART
|
|
||||||
post_reed_solomon:
|
post_reed_solomon:
|
||||||
|
|
||||||
#ifdef ENABLE_LZMA
|
#ifdef ENABLE_LZMA
|
||||||
|
@ -289,15 +294,6 @@ post_reed_solomon:
|
||||||
*/
|
*/
|
||||||
call EXT_C(grub_main)
|
call EXT_C(grub_main)
|
||||||
|
|
||||||
/*
|
|
||||||
* This is the area for all of the special variables.
|
|
||||||
*/
|
|
||||||
|
|
||||||
VARIABLE(grub_boot_drive)
|
|
||||||
.byte 0
|
|
||||||
|
|
||||||
.p2align 2 /* force 4-byte alignment */
|
|
||||||
|
|
||||||
#include "../realmode.S"
|
#include "../realmode.S"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -41,9 +41,9 @@
|
||||||
#define GRUB_KERNEL_I386_PC_MULTIBOOT_SIGNATURE 0x20
|
#define GRUB_KERNEL_I386_PC_MULTIBOOT_SIGNATURE 0x20
|
||||||
|
|
||||||
/* The size of the first region which won't be compressed. */
|
/* The size of the first region which won't be compressed. */
|
||||||
#define GRUB_KERNEL_I386_PC_RAW_SIZE 0xc80
|
#define GRUB_KERNEL_I386_PC_RAW_SIZE 0xc90
|
||||||
|
|
||||||
#define GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART 0x75c
|
#define GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART 0x6f8
|
||||||
|
|
||||||
/* The offset of GRUB_PREFIX. */
|
/* The offset of GRUB_PREFIX. */
|
||||||
#define GRUB_KERNEL_I386_PC_PREFIX GRUB_KERNEL_I386_PC_RAW_SIZE
|
#define GRUB_KERNEL_I386_PC_PREFIX GRUB_KERNEL_I386_PC_RAW_SIZE
|
||||||
|
|
Loading…
Reference in a new issue