Value of EAX changes

"Isaac D. Cohen" <[email protected]> Mon, 15 Feb 2016 18:20:08 -0500
Newsgroups gmane.comp.emulators.bochs.devel
Message-ID <[email protected]>
Hi,
 

I tested my OS on bochs and it got stuck. A little testing found that it was getting stuck in a loop where the OS enumerates the PCI bus to find storage devices. What was happening was, somewhere in the loop the value of EAX changed from ending in 0x08 (1000b) to ending in 0x20 (100000b). Three tests pointed to this interesting event taking place at three different points in the procedure (i.e. after different numbers of times going around the loop) and sometimes it would not happen at all. On real hardware it always works. So what can be causing this strange thing?
 

Here is the code of the loop:
 
 
 

mov eax,10000000000000000000000000001000b ; start at the beginning of the bus
 mov dx,0xCF8 ; PCI bus port
 mov esi,0x30000 ; prepare these values for when we detect a storage device
 mov edi,0x20000
 .loop:
 push edx
 push eax
 out dx,eax
 add dx,4
 in eax,dx
 shr eax,16
 cmp ah,1
 je .storage_device
 .continue: ; if we jump to .storage_device, we return here
 pop eax
 pop edx
 add eax,100000000b ; go to next function on device, next device on bus, or next bus altogether
 cmp eax,10000000111111111111111100001000b ; are we done?
 jne .loop ; if not, go back to .loop
 
 
 
 
 

 
Thank you very much,
 Isaac D. Cohen

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140

_______________________________________________
bochs-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bochs-developers