Hi again... I finally found a way to make a not overly
intrusive patch which hopefully fixes Travis' problem:
http://www.coli.uni-saarland.de/~eric/travis.zip has
a diff and a binary. The patch changes several things:
- init_getdriveparm would overflow for int 13.8 returning bl=7
but this is kind of unlikely to trigger (odd floppy drive types?)
- secs>64k / heads>64k / size>2t is typically not "drive too large"
but "broken LBA info", message changed. QUESTION: is this also
triggered by disks > 500 GB? Can anybody test? Booting FreeDOS
with any such harddisk connected to the PC is enough to test.
- as DosDefinePartition already did, make_ddt (used for floppy) now
inits ddt_descflags to DF_NOACCESS (+DF_DISKCHANGE) in initdisk
- dsk.c getbpb uses DF_NOACCESS again - somebody had commented that
out long ago to make life easier for FORMAT, but it had the side
effect that unformatted/absent disks behaved too much "almost ok"!
The current FORMAT can change the disk access flag to get int25/26
access even to unformatted drives so things SHOULD be okay. I only
did a quick test with A:, can anybody test on a (virtual) harddisk?
- main.c InitializeAllBPBs seems to be a misnomer, so I tried to at
least correct (?) the documentation a bit... The core patch which
hopefully fixes Travis' problem is to force the empty DPB to say
at least "this is not FAT32", so int25/26 are allowed. Yet you do
still have to change the disk access flag. This implicitly happens
as soon as you access a file or directory on a floppy, too :-).
Question for Travis: Does the patched kernel work for you? If not,
then you can try a classic kernel without FAT32 support. Or you can
make your tool disk access flag aware (DOS 4+ access to unformatted
or formatting-state-unknown disks compatible). Or of course you can
just drop the whole int25/26 stuff and use good old BIOS int13 or a
straightforward DOS file access for your "is there a writeable disk
in the floppy drive at this moment?" check routine in your tool...
Question to everybody else: Please let me know what you think about
the patch! As it is not so big, I just paste it in the mail below.
Cheers, Eric
Index: initdisk.c
===================================================================
--- initdisk.c (Revision 1364)
+++ initdisk.c (Working copy)
@@ -318,7 +318,7 @@
type = regs.b.b.l - 1;
if (regs.flags & 1)
type = 0; /* return 320-360 for XTs */
- else if (type > 6)
+ else if (type >= 6)
type = 8; /* any odd ball drives get 8&7=0: the
320-360 table */
else if (type == 5)
type = 4; /* 5 and 4 are both 2.88 MB */
@@ -577,7 +577,7 @@
if (nUnits >= NDEV)
{
- printf("more Partitions detected then possible, max = %d\n", NDEV);
+ printf("more Partitions detected than possible, max = %d\n", NDEV);
return; /* we are done */
}
@@ -719,7 +719,7 @@
lba_bios_parameters.sectors > 0xffff ||
lba_bios_parameters.totalSectHigh != 0)
{
- printf("Drive is too large to handle, using only 1st 8 GB\n"
+ printf("LBA drive properties implausible, using only 1st 8 GB\n"
" drive %02x heads %lu sectors %lu , total=0x%lx-%08lx\n",
drive,
(ULONG) lba_bios_parameters.heads,
@@ -1269,7 +1269,7 @@
pddt->ddt_driveno = driveno;
pddt->ddt_type = init_getdriveparm(driveno, &pddt->ddt_defbpb);
pddt->ddt_ncyl = (pddt->ddt_type & 7) ? 80 : 40;
- pddt->ddt_descflags = init_readdasd(driveno) | flags;
+ pddt->ddt_descflags = init_readdasd(driveno) | flags | DF_DISKCHANGE |
DF_NOACCESS;
pddt->ddt_offset = 0;
pddt->ddt_serialno = 0x12345678l;
Index: dsk.c
===================================================================
--- dsk.c (Revision 1364)
+++ dsk.c (Working copy)
@@ -374,8 +374,8 @@
unsigned secs_per_cyl;
WORD ret;
- /* pddt->ddt_descflags |= DF_NOACCESS;
- * disabled for now - problems with FORMAT ?? */
+ pddt->ddt_descflags |= DF_NOACCESS;
+ /* was disabled - problems with FORMAT ?? */
/* set drive to not accessible and changed */
if (diskchange(pddt) != M_NOT_CHANGED)
Index: main.c
===================================================================
--- main.c (Revision 1364)
+++ main.c (Working copy)
@@ -126,14 +126,10 @@
}
/*
- InitializeAllBPBs()
-
- or MakeNortonDiskEditorHappy()
-
- it has been determined, that FDOS's BPB tables are initialized,
- only when used (like DIR H:).
- at least one known utility (norton DE) seems to access them directly.
- ok, so we access for all drives, that the stuff gets build
+ InitializeAllBPBs() or MakeNortonDiskEditorHappy() - FreeDOS
+ does DPB setup on demand (eg DIR H:, via media_check, bpb_to_dpb)
+ so we touch all drives to make sure DPB are filled in. For some reason,
+ this was described as "init BPB to make Norton Disk Edit happy"...? */
void InitializeAllBPBs(VOID)
{
@@ -145,6 +141,14 @@
if ((fileno = open(filename, O_RDONLY)) >= 0)
close(fileno);
}
+ /* chdir("A:\\") would need intr.asm/init-mod.h ext. but nicer than open() */
+#ifdef WITHFAT32 /* mark drive as not FAT32 to allow int25/26 access */
+ /* floppy is DF_NOACCESS until 1st media_check or int 21.440d.0847 */
+ LoL->DPBp->dpb_fatsize = 1; /* not 0, that would be FAT32 */
+ LoL->DPBp->dpb_next->dpb_fatsize = 1; /* not 0, that would be FAT32 */
+ /* bpb_to_dpb(ddt_defbpb...) would be perfect but is not accessible */
+ /* media_check(get_dpb(0)); / int 21.32 etc would access phys drive */
+#endif
}
STATIC void PSPInit(void)
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Freedos-kernel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel