> The versions 0.9.4 - 0.9.8 of 8088_bios [1] seem to be affected by a
> bug I described in an GitHub issue [2]. It causes DS:0041 to be
> overwritten by the BIOS. Problem is, that DS points to whatever it
> is set when entering the BIOS and not to the BIOS data area. The bug
> is that the BIOS fails to set DS if it encounteres an unsupported
> function request. It sets DS correctly for supported functions.

This is a pretty basic thing that a BIOS should never do -- "assume" something 
about what a segment register is.  It makes me wonder how many similar issues 
might still be in that BIOS?

> In the case of Free FDISK, this behaviour trashes INT 10 vector.
> This is because FDISK uses the intr() function of the Watcom libc,
> and setting the segment values (DS, ES) of the REGPACK structure to
> zero before invoking intr(). This is recommended by the Watcom
> documentation to prevent loading of garbage segment selectors if
> running in protected mode [4].

That doesn't quite make sense, since 0 is just as much of a "garbage" segment 
as any other random selector, and a value of 0 is almost guaranteed to affect 
data in the IVT and/or BIOS and/or DOS kernel.  I think the recommendation is 
there more to cause the user to stop and think about what DS & ES need to be 
when calling RM code (and not necessarily just an ISR).  In this particular 
case, no matter what value you put in DS it would have been a problem, though 
the fact that it was 0 probably made it easier to find (more reproducible) 
since it was almost guaranteed to be catastrophic.


_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to