Reject tasting of this provider if the sector size isn't a multiple of

512.  If I had an audio cdrom in my cd player when I booted my system,
I'd get a panic from geom because you can't read 8192 bytes from an
audio cdrom.

Remove XXX comment about IPL1 and replace it with some information
from my soon to be published web page on the pc98 disk layout.  The
IPL1 test was the result of an observation of a disk with FreeBSD's
boot0 program.  It was testing part of an area what appears to be
reserved for a boot loader name, which comes after a jump over this
area.  I don't yet know if it is required to be any specific jump
instruction, or if the destination has to be location 11. [1]

[1] FreeBSD Press No. 13, page 115, poorly translated by myself.  The
picture there shows offset 8 as the destination of the jump, but
FreeBSD's boot0 program has three padding NULs after the IPL1 name and
uses a 16-bit 'jmp' instruction.
This commit is contained in:
Warner Losh 2004-11-30 08:00:14 +00:00
parent ad71daf0cb
commit 696ac86f2c

View File

@ -84,8 +84,11 @@ g_pc98_modify(struct g_geom *gp, struct g_pc98_softc *ms, u_char *sec)
#if 0
/*
* XXX: Some sources indicate this is a magic sequence, but appearantly
* XXX: it is not universal. Documentation would be wonderful to have.
* FreeBSD's boot0 IPL uses the name IPL1. This test initially was
* based on that observation. However, other boot loaders have use
* different names. A likely good test would be to test if the first
* 4 bytes are a jump to location 11 (or greater?) as well as the next
* 7 bytes being printable or with trailing NUL's.
*/
if (sec[4] != 'I' || sec[5] != 'P' || sec[6] != 'L' || sec[7] != '1')
return (EBUSY);
@ -256,7 +259,7 @@ g_pc98_taste(struct g_class *mp, struct g_provider *pp, int flags)
fwheads);
}
sectorsize = cp->provider->sectorsize;
if (sectorsize < 512)
if (sectorsize % 512 != 0)
break;
if (!strncmp(gp->name, "ad", 2)) {
u_int total_secs = cp->provider->mediasize/sectorsize;