2008-02-03 Yoshinori K. Okuji <okuji@enbug.org>
Add support for having a grub directory in a different drive. This is still only the data handling part. * kern/i386/pc/startup.S (multiboot_trampoline): Set %dh to 0xFF. (codestart): Save %dh in GRUB_ROOT_DRIVE. (grub_root_drive): New variable. * kern/i386/pc/init.c (make_install_device): Use GRUB_ROOT_DRIVE instead of GRUB_BOOT_DRIVE to construct a device name. Set GRUB_ROOT_DRIVE to GRUB_BOOT_DRIVE if it is 0xFF, otherwise use it as it was. * include/grub/i386/pc/kernel.h (grub_root_drive): New prototype. * include/grub/i386/pc/boot.h (GRUB_BOOT_MACHINE_ROOT_DRIVE): New macro. (GRUB_BOOT_MACHINE_DRIVE_CHECK): Set to 0x4f. * boot/i386/pc/pxeboot.S (_start): Set %dh to 0xFF. For now, this is bogus, because PXE booting does not specify any drive correctly. * boot/i386/pc/lnxboot.S (reg_edx): Set the second byte to 0xFF. I am not sure if this is really correct. * boot/i386/pc/cdboot.S: Set %dh to 0xFF, because the root drive is always identical to the boot drive when booting from a CD. * boot/i386/pc/boot.S (MOV_MEM_TO_AL): Removed. Not needed any longer. (root_drive): New variable. (real_start): Unconditionally set %dh to ROOT_DRIVE. (setup_sectors): Push %dx right after popping it, because %dh will be modified later. (copy_buffer): Restore %dx.
This commit is contained in:
parent
e0ca067708
commit
9be6b98b6f
9 changed files with 78 additions and 15 deletions
|
@ -32,9 +32,6 @@
|
|||
/* Print message string */
|
||||
#define MSG(x) movw $ABS(x), %si; call message
|
||||
|
||||
/* XXX: binutils-2.9.1.0.x doesn't produce a short opcode for this. */
|
||||
#define MOV_MEM_TO_AL(x) .byte 0xa0; .word x
|
||||
|
||||
.file "boot.S"
|
||||
|
||||
.text
|
||||
|
@ -99,6 +96,8 @@ kernel_sector:
|
|||
boot_drive:
|
||||
.byte 0xff /* the disk to load kernel from */
|
||||
/* 0xff means use the boot drive */
|
||||
root_drive:
|
||||
.byte 0xff
|
||||
|
||||
after_BPB:
|
||||
|
||||
|
@ -141,7 +140,9 @@ real_start:
|
|||
/*
|
||||
* Check if we have a forced disk reference here
|
||||
*/
|
||||
MOV_MEM_TO_AL(ABS(boot_drive)) /* movb ABS(boot_drive), %al */
|
||||
/* assign root_drive at the same time */
|
||||
movw ABS(boot_drive), %ax
|
||||
movb %ah, %dh
|
||||
cmpb $0xff, %al
|
||||
je 1f
|
||||
movb %al, %dl
|
||||
|
@ -303,6 +304,7 @@ setup_sectors:
|
|||
|
||||
/* restore %dl */
|
||||
popw %dx
|
||||
pushw %dx
|
||||
|
||||
/* head start */
|
||||
movb %al, %dh
|
||||
|
@ -353,6 +355,7 @@ copy_buffer:
|
|||
|
||||
popw %ds
|
||||
popa
|
||||
popw %dx
|
||||
|
||||
/* boot kernel */
|
||||
jmp *(kernel_address)
|
||||
|
|
|
@ -78,6 +78,9 @@ bi_reserved:
|
|||
|
||||
call read_cdrom
|
||||
|
||||
/* Root drive will default to boot drive */
|
||||
movb $0xFF, %dh
|
||||
|
||||
ljmp $(DATA_ADDR >> 4), $0
|
||||
|
||||
/*
|
||||
|
|
|
@ -115,7 +115,7 @@ gdt_dst2:
|
|||
.long 0, 0, 0, 0 /* More space for the BIOS. */
|
||||
|
||||
reg_edx:
|
||||
.byte 0x80,0,0xFF,0xFF
|
||||
.byte 0x80, 0xFF, 0xFF, 0xFF
|
||||
|
||||
data_leng:
|
||||
.long 0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2000,2005,2007 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2000,2005,2007,2008 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -25,6 +25,9 @@
|
|||
/* Let's go */
|
||||
.globl _start; _start:
|
||||
|
||||
/* Root drive will default to boot drive */
|
||||
movb $0xFF, %dh
|
||||
|
||||
/* Jump to the real world */
|
||||
ljmp $0, $0x8200
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue