Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

WDe and GPT, booting DOS (Users)

posted by ecm Homepage E-mail, Düsseldorf, Germany, 04.11.2022, 10:14

> > * Full file must be loaded, implying that the boot sector loader needs
> to
> > relocate itself away from linear 07C00h
>
> Interesting! So I assume - for FAT12/16 - it has to follow the FAT chain
> for a full read of kernel.sys. And does this code - including the
> relocation stuff - still fit in one sector ( as the boot loader of the
> MS-DOS 6.2 kernel, for example ) ?

Yes, it is necessary to follow the FAT chain to read the full file. (Though it would be required for the MS-DOS v6/v7 load protocols as well if the first 1536/2048 bytes of IO.SYS happen to be fragmented.)

You can read the source for the current boot sector loader in https://github.com/FDOS/kernel/blob/bb1bbbb1cb74525bb943725fc83027f634e4eae7/boot/boot.asm

It does fit in one sector, it does LBA or CHS reads, it is 8086-clean. However, it comes in two builds, either for FAT12 or FAT16, not both. It relocates itself to 1FE0h:7C00h (linear 27A00h), without checking that there is that much memory available. This position (plus the position of some more buffers above linear 1FE00h) also limits the maximum kernel size to "134k", according to the memory map comment at the top. Because the loader reads full clusters it also limits the maximum cluster size.

The loaders read in the whole FAT (should be maximum 6 KiB for FAT12, maximum 128 KiB for FAT16) then create a cluster list for the entire kernel. This means that the FAT buffer can be discarded as soon as the cluster list is complete. Then the list is used to read the kernel file data.

Their boot32.asm is a FAT32 boot sector loader: https://github.com/FDOS/kernel/blob/bb1bbbb1cb74525bb943725fc83027f634e4eae7/boot/boot32.asm It also appears to be 8086-clean. It is CHS only. It does fit in a single sector, too. Unlike the FAT12/FAT16 loader it does not build a cluster list. It instead buffers a single FAT sector and uses shared routines to walk the FAT for loading the root directory and the kernel.

The boot32lb.asm is here: https://github.com/FDOS/kernel/blob/bb1bbbb1cb74525bb943725fc83027f634e4eae7/boot/boot32lb.asm It is similar to the boot32.asm except it is LBA-only and uses 386-level instructions. It also fits in a single sector.

I can add some comments about my boot.asm and boot32.asm (in ldosboot repo) later.

---
l

 

Complete thread:

Back to the forum
Board view  Mix view
22049 Postings in 2034 Threads, 396 registered users, 123 users online (0 registered, 123 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum