strato-emu / strato

Run Nintendo Switch homebrew & games on your Android device!
https://strato-emu.github.io
GNU General Public License v3.0
2.19k stars 277 forks source link

Introduce a generic register context for SVCs #246

Closed nickbeth closed 9 months ago

nickbeth commented 9 months ago

SvcContext represents a common interface for accessing registers from SVCs, decoupling them from a particular thread context.

With 32-bit processes using the same SVCs as 64-bit ones but with different thread contexts, we needed a way to decouple register access from the SVC implementations to avoid duplicating them. We came up with SvcContext, a structure containing only the minimal amount of registers needed by SVCs. SVCs were then refactored to operate on that structure, resulting in minimal code changes for supporting 32-bit SVCs.