Oython wrote: ↑Thu Oct 02, 2025 7:01 am
BenLunt wrote: ↑Wed Oct 01, 2025 11:33 am
You are not providing a speed value for the device.
Actually I have tried to set it to 2 for low speed device but it didn't work.I think that it is not the main problem.
It may not be the main problem, but it will not proceed without a valid speed value.
Oython wrote: ↑Thu Oct 02, 2025 7:01 am
It seems that this is not the debugger's problem, but the xHC on BOCHS's. Because I found that the register read on my OS is also ZERO on BOCHS but non-zero on either Vmware or real hardware. It is really confusing. :?
I won't deny that there might be an error in Bochs, but since numerous tests with modern and not-so modern, commercial and non-commercial systems all are successful, let's see what you might be doing differently to get the results you are getting.
1) Did you check to see if the controller is using 32-bit or 64-bit addressing? If 64-bit addressing, did you make sure and clear the high-order parts of the register(s), if applicable.
2) Are you giving the controller physical addresses or virtual addresses?
3) Remember that the count of slots, interrupters, etc., is not static. It can be different for different controllers.
4) Did you use the controller's Capabilities to retrieve the order the register ports are using? It is not standard (though it is normal) for the first to be USB3 and the last to be USB2. It can be in any order. If you are reading from a non-existing or non-connected port register, you can read zero.
5) Did you check the CONTEXT Size field? It can be 64 bytes or 32 bytes.
6) Did you allocate the scratch pad registers? If not, where is the controller writing its scratch to?
7) Did you power the port before trying to read from it. A port can be without power on boot up. An unpowered port will read zero. Read the HCCPARAMS1 register to see if power is always on or can be off.
8) Are you assuming the location of each register set or do you retrieve these offsets from the controller? DOORBELL_OFF, RUNTIME_OFF, etc.
9) Are you aligning the control structures on the specified page boundary? (PAGE_SIZE register) Should default to 4k but can be different.
10) Are you reading all registers as 32- or 64-bit access? Does your complier's optimizer contradict that? Your compiler can optimize the read from:
Code: Select all
mov eax,[0x12345678] ; 32-bit read on 32-bit offset
and eax,0xFF
to
Code: Select all
mov al,[0x12345678] ; 8-bit read on 32-bit offset
which will be in error.
Do you have a bootable image to download so that I can run a few tests?
Again, I am not denying it is an error in Bochs, but with all that has been done, I am heavily leaning toward your specific instance is at fault. It may be something very simple, but highly overlooked. Just because it works on VMWare and real hardware, doesn't make it correct. (
Case in point)
Ben
-
https://www.fysnet.net/the_universal_serial_bus.htm