Octocontrabass wrote:
Do you claim ownership of all USB controllers at the same time? That's how Windows does it, and firmware tends to get upset if you don't do things the way Windows does them.
I have implemented this now, but seems to have made no difference.
I tried another test, where i print some info to see after i set the run bit and then sleeps for 5 seconds. Then i set configure flag and immediately print that i have set it and then its supposed to sleep 5 secs, but instead just for an instant shows the info that i printed after configure flag and then pc resets. So it "sleeps" just fine before i set Configure flag but then after it crashes.
Here's a small snippet of the code:
Code:
mov ecx,[ebp-4] ;[ebp-4] holds a pointer to a structure with the first entry being the Bus/Device/Function
call _EHCIGetOperationalRegisters
push eax ;location of the operational registers (ebp - 0xC)
...
mov ecx,[ebp-0xC]
mov edx,1
call _EHCISetConfigFlag
...
ret
_EHCISetConfigFlag: ;input ecx = location of the operational registers
;edx = bit value (1/0)
add ecx,0x40
and edx,0x00000001
mov [ecx],edx
ret
_EHCIGetOperationalRegisters: ;input ecx = pointer to location that contains pci addr register info
;returns in eax the location of the configuration registers
;ecx already has correct pointer
mov edx,0
call _PCIGet32MemoryMappedBarAddress
mov ecx,eax
mov bl,byte [ecx]
and ebx,0x000000FF
add eax,ebx
ret
The code works on Qemu, there is no crash. But my hardware is not so happy.
Octocontrabass wrote:
Since you described memory corruption, maybe you have a bad address somewhere - either virtual when it should be physical, or just not in the right place.
I am not using paging yet, plan to keep paging out.