aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2004-11-30 08:00:14 +0000
committerWarner Losh <imp@FreeBSD.org>2004-11-30 08:00:14 +0000
commit696ac86f2c01105f7bb84f52c8808c053afce763 (patch)
tree10f1e4140d87d2aff365e2e3f84c7b9aacc1e114
parentad71daf0cb0d00a6b86f0d15b19dab1979458561 (diff)
downloadsrc-696ac86f2c01105f7bb84f52c8808c053afce763.tar.gz
src-696ac86f2c01105f7bb84f52c8808c053afce763.zip
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.
Notes
Notes: svn path=/head/; revision=138219
-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 9551b3f62e3b..0b246906b809 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;