Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
I think "Int 0x33" is only used for mouse drivers written for MS-DOS; and for your code (using BIOS without MS-DOS) it doesn't exist.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
What I think to be the best way is to have a sort of chain of things to try, so you would try native drivers so for example: if you detect QEMU bochs or virtualbox use the BGA driver. if you are running on real hardware and on BIOS try V86 VBE and if there are no options left fall back to writing VGA register dumps.
VirtualBox can be detected with a device on the PCI bus (Vendor ID 0x80EE and Device ID 0xCAFE), I don't know how to detect Bochs Or QEMU however. I do remember something about the qemu cpu name being recognizable but i'm not sure.
There's not a lot of benefit to detecting the VM host, but you should probably focus on detecting and handling the specific PCI devices that those VMs expose on the PCI bus.
So instead of writing custom VirtualBox code, you should probably be writing custom code for detecting and handling the VirtualBox Video Card, the VirtualBox Mouse/Tablet, the VirtualBox Network Card, etc.
Detecting the VirtualBox, Bochs, VMWare, etc. hosts makes about as much sense as detecting whether your OS is running on a Dell, or HP, or Alienware Laptop...
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
SpyderTL wrote:There's not a lot of benefit to detecting the VM host, but you should probably focus on detecting and handling the specific PCI devices that those VMs expose on the PCI bus.
So instead of writing custom VirtualBox code, you should probably be writing custom code for detecting and handling the VirtualBox Video Card, the VirtualBox Mouse/Tablet, the VirtualBox Network Card, etc.
Detecting the VirtualBox, Bochs, VMWare, etc. hosts makes about as much sense as detecting whether your OS is running on a Dell, or HP, or Alienware Laptop...
Definitely this. There's no good reason to detect the VMs. Detect the hardware instead! QEMU can emulate several different kinds of graphical hardware. Its current default in recent releases (from the past several years) is the "Bochs VBE" virtual card, which shows up as an easily-identified PCI device (and has a very simple interface for modesetting). Bochs also defaults to this (obviously, if you didn't catch it from the name; though it won't show up as a PCI device unless you specifically set it up as such), as does VirtualBox. But QEMU supports other cards - including its old default of a Cirrus VGA card, and newer options like virtio-gpu, but also the VMware SVGA interface (which VirtualBox can also emulate with some obtuse and rather hidden options). Detecting VMs in itself doesn't even get you anything if those VMs can implement different hardware depending on their configuration.
SpyderTL wrote:There's not a lot of benefit to detecting the VM host, but you should probably focus on detecting and handling the specific PCI devices that those VMs expose on the PCI bus.
So instead of writing custom VirtualBox code, you should probably be writing custom code for detecting and handling the VirtualBox Video Card, the VirtualBox Mouse/Tablet, the VirtualBox Network Card, etc.
Detecting the VirtualBox, Bochs, VMWare, etc. hosts makes about as much sense as detecting whether your OS is running on a Dell, or HP, or Alienware Laptop...
Definitely this. There's no good reason to detect the VMs. Detect the hardware instead! QEMU can emulate several different kinds of graphical hardware. Its current default in recent releases (from the past several years) is the "Bochs VBE" virtual card, which shows up as an easily-identified PCI device (and has a very simple interface for modesetting). Bochs also defaults to this (obviously, if you didn't catch it from the name; though it won't show up as a PCI device unless you specifically set it up as such), as does VirtualBox. But QEMU supports other cards - including its old default of a Cirrus VGA card, and newer options like virtio-gpu, but also the VMware SVGA interface (which VirtualBox can also emulate with some obtuse and rather hidden options). Detecting VMs in itself doesn't even get you anything if those VMs can implement different hardware depending on their configuration.
It's not so much that there's no good reason to detect VMs; it's just that those good reasons are unrelated and rarely have anything to do with video.
The main reason to detect VMs is so that you can work around the VM's quirks (in the same way that you might detect a real CPU so that you can work around its CPU errata) and so that you don't accidentally do the reverse (assume that errata for a real CPU effects a virtual CPU that happens to give you the same info from CPUID). Of course this applies to all hardware - any device emulated by a VM might have slight differences compared to a real device with the same identification or the same device in a different VM.
For some examples (from memory); for Bochs, there's no "F00F" or FPU bugs when emulating a Pentium chip (and I'd expect it's immune to flaws like Rowhammer, Spectre and Meltdown), the floppy drives don't need delays to get the motor up to speed and don't need the "retry 3+ times before you take a read error seriously" stuff, when emulating a PCI Cirrus Logic video card the video ROM behaves like an ISA card's ROM and can't be controlled via. a BAR in the device's PCI configuration space, there's no performance monitoring counters (too expensive to emulate), there's no power management (even when emulating modern CPUs), etc.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
ok. now i can detect cpu, but the stepping and reserved parts(from viewtopic.php?t=11998)are a little bugy. however, with this done, i should detect pci bus?
ok. from PCI page i didn't understand how to get the 'VendorID'.as far as i understood, you have to send a bit(in this case 0-15 are valid) to 0(register?):00(offset), now shouldn't have to be a register for the segment and the offset?