#41 Boot sector should treat invalid FAT entry as End-Of-Chain

Kenneth Davis
Kernel (17)
Eric Auer

Moved from our bugzilla item 1021:

*dovid_ihug.com.au* 2002-01-01

1) in the boot loader code for FreeDOS, you assume that (in the FAT)
only 0xFFF is an END-OF-FILE marker, which, although perhaps in the
FreeDOS specs, that may be the only EOF marker, but it seems that
linux (and I seem to recall from my days of "twidling" with DOS), the
0xFF8 is also considered an EOF marker.
Thus if I erased the file "KERNEL.SYS", and then copied it back there
in Linux, the machine will be fetching invalid FAT entries.
I suggest a simple fix:
instead of checking for 0xFFF, check for anything greater than the
number of clusters on that drive (which is safer anyways).
2) in the "findFirst / findNext" code of the boot loader, it assumes
that there are fewer than the *exact* amount of directoriy entries
taken in the root directory, if however, you have 224 files (example
emty files) in the root directory, the find first/next "falls"
through into the "findKernelSys" area with an invalid AX (causing
problems similar to issue #1 mentioned above)
upon failure add the following line:
jmp boot_error

*Bart Oldeman* 2003-10-15

1) is partly fixed (0xff8 or higher, not number of clusters on drive)
2) is fixed (I think), however is a rare occasion.

*Eric* 2003-11-28

Changing priority to "enhancement"/"P5", as "no EOF marker
but invalid cluster number" will only be encountered by the
boot sector if your FAT is corrupted. Treating invalid
clusters as end-of-chain is only improving the ability of
FreeDOS to boot from damaged filesystems.


  • Eric Auer
    Eric Auer

    • priority: 5 --> 2
  • Kenneth Davis
    Kenneth Davis

    • labels: --> Kernel
    • assigned_to: nobody --> perditionc