Hi!
15-Фев-2004 19:49 [EMAIL PROTECTED] (Eric Auer) wrote to
[EMAIL PROTECTED]:
EA> I think it is at most a very small bug if the boot sector "falls off the end
EA> of the root directory" if it has no entry which starts with 00 at the end.
This is low probable, but possible. For example, copy many files into
root (more, than entries) and then try to boot from such disk/diskette
(without system files).
EA> As long as the KERNEL does not have such a bug... (checks for end-of-chain
EA> in FAT32 or root dir size in FAT1x case before trying to use the "next"
EA> entry when there is none...).
In this thread I discuss only boot code.
EA> Why should clusters 0 / 1 be treated as end-of-chain?
Because there may be errors on the disk. With cutting these clusters
from "reading" we make behavior more predictable even in the case of error
on the disk.
EA> I would say they are
EA> technically simply "invalid", so you have to end the chain there, but the
EA> same can be said for "cluster number bigger than max. cluster number on THIS
EA> drive". Testing for all cases is probably too complex for the boot sector,
EA> but the KERNEL should have such tests.
Cuttings for 0,1,FFFx doesn't cost any extra byte in my code.
>> - directory sectors was searched from the end.
EA> Why is this a bug?
I not say, that this is bug, but there again may be some specific cases
of errors in disk structure.
>> - next_cluster: top 4 bits now are not masked.
EA> They should - the top 4 bits in FAT32 are "reserved" (I think tools like
EA> defrag could use them to store flags in the RAM copy of the FAT - I never
EA> saw nonzero values for those bits on DISK).
But boot32.asm doesn't mask out these bits.
>> - FAT sector# and offset is now calculated in next_cluster by division.
EA> Is this safe?
Of course.
EA> In WinXP/ME, FAT32 FATs can be > 64k sectors big. In Win9x
EA> each FAT can be only 16 MB, though. For FAT1x it should be safe, indeed.
______________O\_/_________________________________\_/O______________
shl eax,2 ; cluster# -> offset in FAT
movzx ebx,word [bsBytesPerSec]
xor edx,edx
div ebx ; EAX=sector#, EDX=offset
_____________________________________________________________________
O/~\ /~\O
With 16-bit code there also used safe division (with remainder in DX:AX).
>> PS: Who selects segment 1FE0h for boot code relocation? Why not 3000h? With
EA> Ancient tradition. Old FAT1x boot sectors were written with an 128k RAM
EA> limit in mind, although, as you notice:
>> 1FE0:7C00=158k. BTW, take a look at comments in (current) boot32.asm -
>> they are misleading, because says "1FE0:0" for boot sector.
EA> ... I hope that at least the boot32lb / boot32ea boot sectors have correct
EA> comments?
Yes, boot32lb was much better commented and formatted.
EA> I think 126k maximum kernel size is no problem at all, and
EA> MetaKern / metaboot relies on the 1fe0:7c00 location AFAIR.
I think, there not hard to adapt another segment. :)
EA> About the bonus problem "how do I suppress boot messages": Well... just
EA> close your eyes.
But you can't force anyone who will see the TV screen to close eyes.
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click
_______________________________________________
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel