Initial stab at Mach-style partition names, LBA mode, and documentation.

This commit is contained in:
gord committed 1999-03-09 15:09:30 +00:00
1 parent 8d793b9a7e
commit d34ac5a182
11 files changed
+472 -32

No files matched your search

+9 -2
View File
@@ -372,7 +372,12 @@ ENTRY(biosdisk)
movw 0x1c(%ebp), %ax /* segment */
shll $4, %eax
movl %eax, dap_buffer
movl $disk_address_packet, %esi
/* compute the address of disk_address_packet */
movl $disk_address_packet, %eax
movw %ax, %si
shrl $4, %eax
movw %ax, %cx /* save the segment to cx */
xorb %bl, %bl
movb 0x8(%ebp), %bh /* read=0, write=1 */
@@ -383,6 +388,7 @@ ENTRY(biosdisk)
call EXT_C(prot_to_real) /* enter real mode */
.code16
movw %cx, %ds
movw %bx, %ax
int $0x13 /* do the operation */
@@ -446,7 +452,7 @@ disk_compute_args:
.align 4
disk_address_packet:
.byte 0x20 /* length of packet */
.byte 0x10 /* length of packet */
.byte 0 /* reserved */
dap_blocks:
.word 0 /* number of blocks */
@@ -625,6 +631,7 @@ hard_drive:
/* Wahoo! Got LBA! */
movb $0x1, %bh
data32
jmp 2f
1: xorb %bh, %bh /* Too bad, no LBA */
+5 -5
View File
@@ -533,17 +533,17 @@ substring (char *s1, char *s2)
{
while (*s1 == *s2)
{
/* The strings match, so return 0. */
if (!*(s1++))
/* The strings match exactly. */
if (! *(s1++))
return 0;
s2++;
s2 ++;
}
/* S1 is shorter than S2. */
/* S1 is a substring of S2. */
if (*s1 == 0)
return -1;
/* S1 is a substring of S2. */
/* S1 isn't a substring. */
return 1;
}
+84 -6
View File
@@ -1,6 +1,7 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1996 Erich Boleyn <erich@uruk.org>
* Copyright (C) 1996 Erich Boleyn <erich@uruk.org>
* Copyright (C) 1999 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -593,16 +594,16 @@ set_device (char *device)
part_choice = PART_CHOSEN;
retval++;
}
if (*device == ',')
else if (*device == ',')
{
/* Either an absolute PC or BSD partition. */
disk_choice = 0;
part_choice++;
part_choice ++;
device++;
if (*device >= '0' && *device <= '9')
{
part_choice++;
part_choice ++;
current_partition = 0;
if (!(current_drive & 0x80)
@@ -625,7 +626,7 @@ set_device (char *device)
}
else if (*device >= 'a' && *device <= 'h')
{
part_choice++;
part_choice ++;
current_partition = ((*(device++) - 'a') << 8) | 0xFF00FF;
}
@@ -634,13 +635,85 @@ set_device (char *device)
if (part_choice == PART_DISK)
{
current_partition = saved_partition;
part_choice++;
part_choice ++;
}
retval++;
}
}
}
else
{
char ch;
/* A Mach-style absolute partition name. */
ch = *device;
if (*device != 'f' && *device != 'h' ||
(device += 2, (*(device - 1) != 'd')))
errnum = ERR_DEV_FORMAT;
else
safe_parse_maxint (&device, (int *) &current_drive);
disk_choice = 0;
if (ch != 'f')
current_drive += 0x80;
if (errnum)
return 0;
if (*device == '/')
{
part_choice = PART_CHOSEN;
retval ++;
}
else if (*device == 's')
{
/* An absolute PC partition. */
disk_choice = 0;
part_choice ++;
device ++;
if (*device >= '0' && *device <= '9')
{
part_choice ++;
current_partition = 0;
if (!(current_drive & 0x80) ||
!safe_parse_maxint (&device, (int *) &current_partition) ||
(--current_partition) > 254)
{
errnum = ERR_DEV_FORMAT;
return 0;
}
current_partition = (current_partition << 16) + 0xFFFF;
if (*device >= 'a' && *device <= 'h')
{
/* A BSD partition within the slice. */
current_partition = (((*(device ++) - 'a') << 8)
| (current_partition & 0xFF00FF));
}
}
}
else if (*device >= 'a' && *device <= 'h')
{
/* An absolute BSD partition. */
part_choice ++;
current_partition = ((*(device ++) - 'a') << 8) | 0xFF00FF;
}
if (*device == '/')
{
if (part_choice == PART_DISK)
{
current_partition = saved_partition;
part_choice ++;
}
retval ++;
}
}
if (retval)
retval = device + 1;
@@ -711,6 +784,11 @@ set_bootdev (int hdbias)
static char *
setup_part (char *filename)
{
/* FIXME: decide on syntax for blocklist vs. old-style vs. /dev/hd0s1 */
/* Strip any leading /dev. */
if (substring ("/dev/", filename) < 1)
filename += 5;
if (*filename == '(')
{
if ((filename = set_device (filename)) == 0)