wutcrt: Fix the trap instruction and move it directly into __rpx_start #302
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Apparently the trap instruction (
tw 0x1f, 30, 0
/0x7ffe0008
) is a "DBGCTL_INSTRUCTION" which excepts specific values in r3,r4 and r5. The gdb stub of the coreinit.rpl uses it to set an "initial breakpoint" which gets removed immediatly after it's hit once. Retail software loads "main" into r4 and "ctors" into r5. For now I decided to set r4 and r5 both to "main"The code that is handling the exception does somelthing like this
So depending on the "AppFlags" the breakpoint is set to either r4 or r5 (or not at all?).
I also moved it to the
crt0_rpx.s
instead of __init_wutto not have it in rpl (and anything else that uses__init_wut
)