fix potential bugs in some LBA code
This commit is contained in:
parent
0f4f88a9d9
commit
7e9a0794d0
7 changed files with 46 additions and 9 deletions
20
ChangeLog
20
ChangeLog
|
@ -1,3 +1,23 @@
|
||||||
|
1999-08-12 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
||||||
|
|
||||||
|
* stage1/stage1_lba.S: Use STAGE1_DRP_ADDR for the address of
|
||||||
|
drive parameters instead of DRIVE_PARAMETER.
|
||||||
|
(drive_parameter): Deleted.
|
||||||
|
* stage1/stage1.h (STAGE1_DRP_ADDR): New macro.
|
||||||
|
(STAGE1_DRP_SIZE): Likewise.
|
||||||
|
|
||||||
|
1999-08-11 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
||||||
|
|
||||||
|
* stage2/bios.c (get_diskinfo): In LBA mode, set TOTAL_SECTORS
|
||||||
|
to the low 32bits of DRP.TOTAL_SECTORS instead of the multiple
|
||||||
|
of CHS.
|
||||||
|
* stage2/cmdline.c (enter_cmdline) [GRUB_UTIL]: In the command
|
||||||
|
"geometry", print the device file name instead of CHS/LBA
|
||||||
|
information.
|
||||||
|
* stage2/shared.h (device_map): Declared.
|
||||||
|
* grub/asmstub.c (device_map): Defined as a global variable
|
||||||
|
instead of a local variable.
|
||||||
|
|
||||||
1999-08-10 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
1999-08-10 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
|
||||||
|
|
||||||
Support the NetBSD and OpenBSD partition slices.
|
Support the NetBSD and OpenBSD partition slices.
|
||||||
|
|
|
@ -71,7 +71,9 @@ char *grub_scratch_mem = 0;
|
||||||
|
|
||||||
#define NUM_DISKS 256
|
#define NUM_DISKS 256
|
||||||
static struct geometry *disks = 0;
|
static struct geometry *disks = 0;
|
||||||
static char **device_map = 0;
|
|
||||||
|
/* The map between BIOS drives and UNIX device file names. */
|
||||||
|
char **device_map = 0;
|
||||||
|
|
||||||
/* The main entry point into this mess. */
|
/* The main entry point into this mess. */
|
||||||
int
|
int
|
||||||
|
|
|
@ -64,6 +64,12 @@
|
||||||
cannot straddle a 64K boundary. */
|
cannot straddle a 64K boundary. */
|
||||||
#define STAGE1_BUFFERSEG 0x7000
|
#define STAGE1_BUFFERSEG 0x7000
|
||||||
|
|
||||||
|
/* The address of drive parameters. */
|
||||||
|
#define STAGE1_DRP_ADDR 0x7f00
|
||||||
|
|
||||||
|
/* The size of drive parameters. */
|
||||||
|
#define STAGE1_DRP_SIZE 0x42
|
||||||
|
|
||||||
/* The flag for BIOS drive number to designate a hard disk vs. a
|
/* The flag for BIOS drive number to designate a hard disk vs. a
|
||||||
floppy. */
|
floppy. */
|
||||||
#define STAGE1_BIOS_HD_FLAG 0x80
|
#define STAGE1_BIOS_HD_FLAG 0x80
|
||||||
|
|
|
@ -62,7 +62,6 @@
|
||||||
. = _start + 4
|
. = _start + 4
|
||||||
|
|
||||||
/* scratch space */
|
/* scratch space */
|
||||||
drive_parameter:
|
|
||||||
disk_address_packet:
|
disk_address_packet:
|
||||||
/* Actually, must set these values at the runtime. */
|
/* Actually, must set these values at the runtime. */
|
||||||
.byte 0x10
|
.byte 0x10
|
||||||
|
@ -118,8 +117,8 @@ after_BPB:
|
||||||
|
|
||||||
/* get the geometry (limited to 2TB!) */
|
/* get the geometry (limited to 2TB!) */
|
||||||
movb $0x48, %ah
|
movb $0x48, %ah
|
||||||
movw $ABS(drive_parameter), %si
|
movw $STAGE1_DRP_ADDR, %si
|
||||||
movw $0x1a, (%si)
|
movw $STAGE1_DRP_SIZE, (%si)
|
||||||
int $0x13
|
int $0x13
|
||||||
|
|
||||||
jc lba_probe_error
|
jc lba_probe_error
|
||||||
|
@ -127,6 +126,9 @@ after_BPB:
|
||||||
/* save the total number of sectors */
|
/* save the total number of sectors */
|
||||||
movl 0x10(%si), %ecx
|
movl 0x10(%si), %ecx
|
||||||
|
|
||||||
|
/* set %si to disk address packet */
|
||||||
|
movw $ABS(disk_address_packet), %si
|
||||||
|
|
||||||
/* this sets up for the first run through "bootloop" */
|
/* this sets up for the first run through "bootloop" */
|
||||||
movw $ABS(firstlist - STAGE1_LISTSIZE), %di
|
movw $ABS(firstlist - STAGE1_LISTSIZE), %di
|
||||||
|
|
||||||
|
|
|
@ -160,9 +160,10 @@ get_diskinfo (int drive, struct geometry *geometry)
|
||||||
{
|
{
|
||||||
geometry->flags = BIOSDISK_FLAG_LBA_EXTENSION;
|
geometry->flags = BIOSDISK_FLAG_LBA_EXTENSION;
|
||||||
|
|
||||||
/* Check if CHS information is valid. */
|
/* FIXME: when the 2TB limit becomes critical, we must
|
||||||
if (drp.flags & 0x02)
|
change the type of TOTAL_SECTORS to unsigned long
|
||||||
total_sectors = drp.cylinders * drp.heads * drp.sectors;
|
long. */
|
||||||
|
total_sectors = drp.total_sectors & ~0L;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -676,10 +676,14 @@ returnit:
|
||||||
{
|
{
|
||||||
char *msg;
|
char *msg;
|
||||||
|
|
||||||
|
#ifdef GRUB_UTIL
|
||||||
|
msg = device_map[current_drive];
|
||||||
|
#else
|
||||||
if (geom.flags & BIOSDISK_FLAG_LBA_EXTENSION)
|
if (geom.flags & BIOSDISK_FLAG_LBA_EXTENSION)
|
||||||
msg = "LBA";
|
msg = "LBA";
|
||||||
else
|
else
|
||||||
msg = "CHS";
|
msg = "CHS";
|
||||||
|
#endif
|
||||||
|
|
||||||
grub_printf ("drive 0x%x: C/H/S = %d/%d/%d, "
|
grub_printf ("drive 0x%x: C/H/S = %d/%d/%d, "
|
||||||
"The number of sectors = %d, %s\n",
|
"The number of sectors = %d, %s\n",
|
||||||
|
|
|
@ -312,6 +312,8 @@ extern int use_curses;
|
||||||
extern int verbose;
|
extern int verbose;
|
||||||
/* The flag for read-only. */
|
/* The flag for read-only. */
|
||||||
extern int read_only;
|
extern int read_only;
|
||||||
|
/* The map between BIOS drives and UNIX device file names. */
|
||||||
|
extern char **device_map;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef STAGE1_5
|
#ifndef STAGE1_5
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue