If you want to detect whether you are running inside any emulator like Bochs, QEMU, VirtualBox, etc., you must know it very well and just inspect if it contains the hardware devices, the BIOS strings/signatures/splash screens/model names, network devices for sharing files between host and guest, and any other particular detail to identify functional system features that only one of those emulators would have. You would need to run several snippets, say, from FreeDOS running under an emulator to see what it takes to correctly detect whether it's an emulator and name it, or whether it's a real machine. If you do it under emulated Windows NT/XP/7 or Linux, you would need to somehow dump the BIOS and/or the CMOS from them. (The question is, how do you know if you booted from BIOS or UEFI and if its contents have got lost by a kernel overwrite?)
octacone wrote:I am not going to drop my hobby because I am annoyed. Already working on my PCI controller, I hope to finish it in less than two days and after that I want to be able to read my Linear Frame Buffer.
Just another question: once I get all the vendor IDs, device IDs, slots, functions, etc... How am I going to tell which one of them is Linear Frame Buffer?
I have a minimum time span of 3 days to start seeing results when it comes to difficult and new things.
First, you have to detect if the PCI controller is present or not (unless it's an old 386 or even older PC, PCI should be present, or the motherboard wouldn't even turn on if the PCI controller became damaged).
Then you have to use the BIOS to determine if PCI supports configuration mechanism 1, mechanism 2 or both in your system.
Read the following Wiki entry to see how to use the BIOS for it:
http://wiki.osdev.org/PCI
You can also use the following assembly code to try to detect PCI using configuration mechanism 1 (to have a really stable system, you should enter Protected Mode, start a separate V86 task to call the PCI BIOS services and if it crashes, you know that either the PCI BIOS is bogus and the PCI controller only supports Configuration Mechanism 1, or it is just not present in the motherboard):
00000000__Detect_PCI_Bus_Presence_Config_Mechanism_1.asm
Code: Select all
;Function to detect the presence of the PCI controller/bus
;using Configuration Mechanism 1.
;
;If it was found, it will return 0x80000000.
;;
_00000000__Detect_PCI_Bus_Presence_Config_Mechanism_1:
pushf
push ebx
push edx
.PCI_Addr_Reg_Write_Bus0_Dev0_Fn0_Reg0:
;;
mov dx,0xCFC
mov ebx,0x80000000
mov eax,ebx
out dx,eax
.PCI_Addr_Reg_Read_Bus0_Dev0_Fn0_Reg0:
;;
in eax,dx
cmp eax,ebx
je .FoundAndEnd
.NotFound:
;;
xor eax,eax
.FoundAndEnd:
;;
pop edx
pop ebx
popf
ret
;EOF