Hi DOS experts and DOS users,

it may seem a bit odd to see this topic on freedos-user
and not on freedos-devel but it fits the current other
discussions on freedos-user... Also, possible problems
affect FreeDOS users, as the developers of FreeDOS are
not the ones who would fix VirtualBox, they would only
workaround bugs on the DOS side. I browsed through some
of the sources of VirtualBox, which you can find here:

https://www.virtualbox.org/browser/vbox/trunk/src/VBox

You may want to read some notes about DOS and BIOS here:

https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Devices/PC/BIOS-new/notes.txt

(e.g. "MS DOS POWER.EXE depends on STI after int 16.xx"
or bus master disk reads have to use VDS, e.g. in AHCI")



Those who wonder why i440FX and ICH9 have different UIDE
init speeds might be able to find something here, but I
am no expert in PCI bridges and do not know where to look:

https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Devices/PC/BIOS-new/pcicfg.inc

PCI_CFG1                equ     0CF8h
PCI_CFG2                equ     0CFCh
PCI_FIXED_HOST_BRIDGE_1 equ 12378086h ;; i440FX PCI bridge
PCI_FIXED_HOST_BRIDGE_2 equ 244e8086h ;; ICH9 PCI bridge
MAX_BUSDEVFN equ 10000h ; Max bus/dev/fn to search

Both virtual PCI things are implemented here, for experts:

https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Devices/Bus/DevPciIch9.cpp

https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Devices/Bus/DevPCI.cpp



Note that int 1a.b1 functions use 8 bit bus numbers,
5 bit device numbers and 3 bit function numbers, so
MAX_BUSDEVFN is pretty high, in particular given that
I get the impression that int 1a.b100 reports the bus
number of the last PCI bus as zero, i.e. only ONE bus,
so a MAX_BUSDEVFN of 100h may be enough at the moment?

https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Devices/PC/BIOS-new/pcibios.inc#L161

https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Devices/PC/BIOS-new/pcibio32.asm#L142

While it is notable that two implementations exist,
one for real mode 16 bit and one in 32 bit protected
mode, both basically iterate over bus-dev-func with
ALL functions checked even for unused device slots.

The pci_pro_select_reg function does not modify BX,
so apparently the loop in pci_pro_f03 will do 65536
iterations while for example PCISLEEP would take a
much lower 32 to 256 because pcibios_real and there
pci_present report only ONE used bus, not 256 and
PCISLEEP would only look at the 8 functions for the
device slots which HAVE devices, not all 32 devices
that MIGHT be used.

Again, it is not clear to me why i440 or ICH9 would
be faster or slower, e.g. with UIDE, for PCI scans,
but 32-256 iterations of an inline loop in PCISLEEP
are obviously MUCH FASTER than 65536 iterations of
a more complex loop in pcibios.inc or pcibios32.asm

I think it would help if MAX_BUSDEVFN was matched
with the CL (number of last PCI bus in system) in
the int 1a.b101 return value - it seems impossible
to me to have devices installed on any bus beyond
the "last PCI bus in system" location. But is this
a BUG in VirtualBox?



Next topic, the floppy change line problems for UIDE:

https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Devices/PC/BIOS-new/floppy.c?rev=40754#L982

VirtualBox does indeed report "without change line"
for floppy in int 13.15 and does indeed report that
no change line status is available in int 13.16, so
UIDE which only looks for "known changed" status as
opposed to int 13.16 results which are "NO status"
is expected to be in trouble...

https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Devices/PC/BIOS-new/orgs.asm#L1104

Interestingly, 40:8f is set to 00, 07, 70 or 77 based
on whether you have A: or B: or both and this is also
described as "determined, multi-rate, chgline". This
could be a BUG in VirtualBox, given the int 13.15 and
int 13.16 code described above...



HOWEVER, VirtualBox seems to have TWO versions of the
whole BIOS, so we should also check rombios.c here:

https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Devices/PC/BIOS/

Unfortunately, I failed to download that file via http.
It is a whole BIOS in a single 339 kB C file, plus some
small files for AHCI, APM, SCSI and a boot logo thingy.
Interesting to look at the APM edge between BIOS and VM.

It would be important to read the floppy and 40:xx part
of rombios.c to check what it does with change lines.

https://www.virtualbox.org/browser/vbox/trunk/src/VBox/Devices/PC/BIOS/ahci.c

The AHCI driver might be interesting to read for our low
level (disk) driver experts out there :-) Same for SCSI.

Regards, Eric


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user

Reply via email to