Support halted Cortex-M33 register access. - #79
Merged
Merged
Conversation
M33 halt/resume control could not inspect or modify core registers. Allow the existing register set through DCRSR, with stack selectors following the halted security state and no security-bank changes. Check M33 debug permission and snap-stall state, and observe restart status during register transfers. A restart followed by a new halt cannot prove completion of the original transfer and must prevent automatic cleanup. Two fresh RP2350 core-0 sessions read all exposed registers, wrote and restored selected registers before resuming, and verified counter progress after resume with inherited debug state restored.
Owner
Author
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Allow
ReadRegisterandWriteRegisteron an acquired, halted Cortex-M33 using the same register set as Cortex-M0. SP selects the current stack; MSP and PSP select the main and process stacks in the halted security state. Register access does not change security state or DSCSR bank selection. XPSR remains read-only, and M33 stepping remains unsupported.Previously, this read rejected an acquired M33 before memory traffic:
It now reads the halted processor's debug return address. A complete use through a borrowed core-0 MEM-AP selected with
dap.APAt(0x2000)is:The caller supplies
ctxand a livecleanupCtx, including after operation cancellation. R4 remains changed after release. An inherited halt allows register access but grants no permission to resume it.Why
M33 control was available, but register access still rejected the architecture. The existing DCRSR selectors cover its common register set without changing security state. Register-status reads now apply M33 permission and snap-stall checks and observe sticky restart status. A restart during a pending transfer prevents automatic cleanup even if the processor has already halted again; the new halt cannot establish that the original transfer completed.
Hardware evidence
On Nostalgia, two fresh sessions used J-Link EDU Mini V2
000802011345, 1 MHz SWD, and RP2350 core 0 at AP0x2000, CPUID0x411fd210. The already-running RAM counter was exercised with:Both sessions read all 19 registers and wrote and restored R4, SP, MSP, PSP, and PC. The full snapshot matched before resume; DSCSR stayed
0x00030000. The counter stopped while halted and advanced after resume and release. Initially disabled debug and running state were restored before Arm owner close; both owners closed successfully.This covers Secure state on core 0. Non-secure stack selection and transfer failure paths have behavioral coverage. Temporary stack and PC values were not executed. No security-state switch or core-1 control was performed, and state after Arm owner close was not measured. Flash was untouched; the existing RAM program remains running.
Documentation
Update the register API, Cortex-M guide, architecture and composition guides, capability table, and README for M33 register access and its current-state stack semantics. The guide includes the gated hardware procedure and observations, and clarifies that inherited cross-trigger routing can couple cores.