Hi everyone,
It has been a little while. Now that the snow has stopped falling, the ground is dry, and I don't have to worry about keeping the wood stove fed, I have been working on other projects out in the warm sun. :-) Anyway, I thought I would post an update to my USB work.
I have decided to Fork
Bochs to include my USB emulation additions. With discussion and deep thought, it seems to be a better idea than to pepper the original source with my additions. Please understand though, that I am not trying to replace Bochs, I am simply creating a Fork to house my additions. At a later time, I hope the original Bochs team may wish to add my additions.
My source (fork) and documentation can be found at
https://www.fysnet.net/bochs/index.php (
https://github.com/fysnet/Bochs-USB-Edition).
The plan is to display all ports and relevant information at given times, for example when the start of frame happens.
Currently, only the XHCI has been (somewhat) implemented, the UHCI has been started, and the OHCI and possibly EHCI are on future plans.
Place the following line in your bochsrc.txt file:
Code:
usb_debug: type=xhci, reset, enable, start_frame, doorbell, event, non_exist
Only one type can be used at a time/per emulated session (currently xhci only).
The 'reset' tag triggers the debugger when a port resets. (currently not implemented)
The 'enable' tag triggers the debugger when a port is enabled. (currently not implemented)
The 'start_frame' tag triggers the debugger at start of frame. (currently not fully implemented)
The 'doorbell' tag triggers the debugger when a doorbell is run.
The 'event' tag triggers the debugger when an event TRB is inserted in an event ring.
The 'non_exist' tag triggers the debugger when the guest writes to the first byte of the first non-existant port register set. (for debugging)
Currently, only the following should be used:
Code:
usb_debug: type=xhci, doorbell, event
With the 'doorbell' tag, the debugger will trigger when the command doorbell is rung, displaying the command ring.
With the 'event' tag, the debugger will trigger when an event TRB is inserted in an interrupters event ring.
You can then view any TRB in the said ring, actually changing items within a TRB that hasn't been executed yet, or at least viewing the TRB.
It is highly experimental and needs a lot of work, but since I won't be putting much into it until late fall/early winter when the temperatures drastically fall again, I thought someone here might benefit from it. Also, if someone wants to add function and/or continuing my work, please do so by submitting pull requests.
Since I target Windows,
all additions are only for Windows platforms. My Fork includes Windows executables for those who don't want to build the source themselves.
Again, please don't think I am taking over the Bochs project...this is far from. I am simply adding a USB debugger to the project (via my fork) and hopefully later down the road when it is tested and functions as expected, it can be merged into the original project.
Thanks again for all of you that have helped in one way or another. Of all my hobbies, this is the most enjoyable, and this forum and its contributors have made it happen.
Thanks so much,
Ben
-
https://www.fysnet.net/bochs/index.phpP.S. There is a USB button now in the tool bar. It is used to stop the emulation and trigger the USB debugger. It is not fully implemented yet and probably should not be used, though it won't hurt to do so. If after clicking on the button, if the emulation isn't ready to display information (the controller isn't in the run state yet), squiggly lines will show on the button indicating that it is waiting for the controller to become available. Again, lots of work needs to be done. Please be patient.