[rsp] Introduce microcode build process, disassemble and build both rspboot versions#2764
[rsp] Introduce microcode build process, disassemble and build both rspboot versions#2764Thar0 wants to merge 6 commits into
Conversation
|
Wouldn't it be better to combine |
|
The two files haven't got enough common text to warrant that, even the regular functions unrelated to anti-piracy measures were rewritten. I think once you get to just a single ifdef for all the code in a file it makes more sense to just have separate files at that point. |
Dragorn421
left a comment
There was a problem hiding this comment.
Build system looks good, I want to take a closer look at rspboot.s before merging
Can you document how you came up with the single file armips and from which revision of it
Dragorn421
left a comment
There was a problem hiding this comment.
I find it mildly interesting that rspboot is assembled from origin IMEM_START_VA instead of IMEM_START like rspboot_ap
| #include "sptask.h" | ||
| #include "rspboot.h" | ||
|
|
||
| #define OSTASK_FIELD(field) (-0x40 + OS_TASK_OFF_##field)($zero) |
There was a problem hiding this comment.
for grepability I would personally prefer if this macro took the full OS_TASK_OFF_ macro name directly
| #define OSTASK_FIELD(field) (-0x40 + OS_TASK_OFF_##field)($zero) | |
| #define OSTASK_FIELD(fieldOffset) (-0x40 + fieldOffset)($zero) |
There was a problem hiding this comment.
I don't think it's worth prioritizing grep-friendliness over readability here, the latter should be the common case here
| // Return the semaphore and jump to the ucode that was loaded | ||
| jr $7 | ||
| mtc0 $zero, SP_SEMAPHORE |
There was a problem hiding this comment.
where / by what was the semaphore acquired?
There was a problem hiding this comment.
The semaphore can be released whether or not it was acquired, in which case it's a no-op. This is probably done for deadlock prevention, in case some previous task or the cpu had acquired the semaphore and failed to release it
There was a problem hiding this comment.
| // Return the semaphore and jump to the ucode that was loaded | |
| jr $7 | |
| mtc0 $zero, SP_SEMAPHORE | |
| // Release the semaphore as a just-in-case measure and jump to the ucode that was loaded | |
| jr $7 | |
| mtc0 $zero, SP_SEMAPHORE |
?
| break | ||
|
|
||
| antipiracy_test: | ||
| // Checks that $4, $5, $6 and $11 all have expected register values set by IPL3 |
There was a problem hiding this comment.
| // Checks that $4, $5, $6 and $11 all have expected register values set by IPL3 | |
| // Checks that $4, $5, $6 and $11 all have expected register values set by the cic6105 microcode |
afaik IPL3 never runs anything on the rsp (merely at some point the cpu executes from imem/dmem)
There was a problem hiding this comment.
This isn't the case, IPL3 runs RSP code
There was a problem hiding this comment.
Oh 🤔 all flavors of it?
There was a problem hiding this comment.
Not all, but the case we care about (X105) does
There was a problem hiding this comment.
Should we add a mention of X105 to this comment?
…armips.cpp against a newer commit
|
Apparently it's possible to mark a file as auto-generated so that GitHub hides the changes by default by adding this to the |
Thanks for the suggestion but I don't think we really need that |
IIRC, it only collapses it by default, you can still expand it, it's mostly to avoid lagging out the ui when you don't want to see the changes in that file. |
This PR introduces a build system for rsp microcodes, using armips as the assembler:
rsp/To exercise this build system, both variants of rspboot are included. The anti-piracy variant (
rspboot_ap) is used in N64 versions while the non-anti-piracy variant (rspboot) is used in all others.Other microcodes to come in future PRs.