summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom_pc98.c
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2004-11-30 08:00:14 +0000
committerimp <imp@FreeBSD.org>2004-11-30 08:00:14 +0000
commitb06b583ff52edeccdbcfe6fa32076a0f920e305c (patch)
tree10f1e4140d87d2aff365e2e3f84c7b9aacc1e114 /sys/geom/geom_pc98.c
parent504bb0d4c899c5de8eb35b1d57ebd6411f1fed30 (diff)
downloadFreeBSD-src-b06b583ff52edeccdbcfe6fa32076a0f920e305c.zip
FreeBSD-src-b06b583ff52edeccdbcfe6fa32076a0f920e305c.tar.gz
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.
Diffstat (limited to 'sys/geom/geom_pc98.c')
-rw-r--r--sys/geom/geom_pc98.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/geom/geom_pc98.c b/sys/geom/geom_pc98.c
index 9551b3f..0b24690 100644
--- a/sys/geom/geom_pc98.c
+++ b/sys/geom/geom_pc98.c
@@ -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;
OpenPOWER on IntegriCloud