Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

platform: move I/O port driver into platform abstraction #463

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

msft-jlange
Copy link
Contributor

The SVSMIOPort and NativeIOPort objects are platform-specific, and thus they should be implemented in the platform abstraction instead of in common code. Furthermore, the console serial port object is common and need not be duplicated in every platform abstraction.

@msft-jlange
Copy link
Contributor Author

@peterfang This should enable you to implement the correct GHCI-based abstraction for I/O port accesses. After making a couple of different rounds of changes, it became apparent that the best way to make this work was not to have the console logic use native I/O operations, but to correctly implement a platform-specific version of the IOPort object which can be used not only by the console, but also by the #VE and #VC handler. Assuming the #VE handler calls the common instruction emulator, this should be wired up correctly because the common emulator calls through the platform abstraction to perform the I/O accesses.

Feel free to test on top of this. However, this cannot merge until #462 merges because #462 changes the gdbstub adapter to use the platform abstraction as well, which is a prerequisite for the refactoring in this PR.

@peterfang
Copy link
Contributor

@peterfang This should enable you to implement the correct GHCI-based abstraction for I/O port accesses. After making a couple of different rounds of changes, it became apparent that the best way to make this work was not to have the console logic use native I/O operations, but to correctly implement a platform-specific version of the IOPort object which can be used not only by the console, but also by the #VE and #VC handler. Assuming the #VE handler calls the common instruction emulator, this should be wired up correctly because the common emulator calls through the platform abstraction to perform the I/O accesses.

Feel free to test on top of this. However, this cannot merge until #462 merges because #462 changes the gdbstub adapter to use the platform abstraction as well, which is a prerequisite for the refactoring in this PR.

Got it. I'll keep track of this PR and make updates to #419 accordingly. This will also be incorporated into #VE handling in the future.

@peterfang
Copy link
Contributor

@msft-jlange Quick update: I combined all 3 of your PRs (#461, #462, #463) and updated my stage2 changes accordingly. I was able to boot stage2 successfully.

@msft-jlange msft-jlange marked this pull request as ready for review September 26, 2024 15:19
The `SVSMIOPort` and `NativeIOPort` objects are platform-specific, and
thus they should be implemented in the platform abstraction instead of
in common code.  Furthermore, the console serial port object is common
and need not be duplicated in every platform abstraction.

Signed-off-by: Jon Lange <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants