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

controlling the cheri mode to enter when entering debug mode #370

Merged
merged 8 commits into from
Sep 23, 2024

Conversation

tariqkurd-repo
Copy link
Collaborator

@tariqkurd-repo tariqkurd-repo commented Sep 17, 2024

fixes #322

@tariqkurd-repo
Copy link
Collaborator Author

tariqkurd-repo commented Sep 19, 2024

we're now thinking about allocating an unused bit in DCSR which will specify which mode to enter on debug mode entry, or keep using the bit in dinfc, the point is to enter using the mode specified in the CSR

Copy link
Collaborator

@arichardson arichardson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor questions otherwise this looks good to me.

I think it is important that we can attach both an updated one (e.g. OpenOCD) as well as an unmodified debugger to the core since it is common to use more than one debugger for a given core depending on who is debugging/what is being debugged.

@tariqkurd-repo tariqkurd-repo changed the title make the mode to enter unspecified, when entering debug mode controlling the cheri mode to enter when entering debug mode Sep 20, 2024
Co-authored-by: Alexander Richardson <[email protected]>
Signed-off-by: Tariq Kurd <[email protected]>
@andresag01
Copy link
Collaborator

@tariqkurd-repo: Could we remove this text in the spec? This change is based on feedback from porting debuggers to CHERI RISC-V:

This section is preliminary as no-one has yet built debug support for CHERI-RISC-V so
change is likely.

@tariqkurd-repo
Copy link
Collaborator Author

@tariqkurd-repo: Could we remove this text in the spec? This change is based on feedback from porting debuggers to CHERI RISC-V:

This section is preliminary as no-one has yet built debug support for CHERI-RISC-V so
change is likely.

done

src/riscv-hybrid-integration.adoc Outdated Show resolved Hide resolved
src/insns/modesw_common.adoc Show resolved Hide resolved
@andresag01
Copy link
Collaborator

I broadly agree with this change. However, it would be best if we did not have MODESW writing dinfc when executing in debug mode. First, its awkward to change the behavior of this instruction based on the privileged mode. And second, we already have another well-defined mechanism to change the m-bit in dinfc using csrr, scmode and csrw which we can fully execute from the program buffer given that CHERI RISC-V requires the program buffer to have at least 4 entries.

@arichardson : What do you think?

@arichardson
Copy link
Collaborator

I broadly agree with this change. However, it would be best if we did not have MODESW writing dinfc when executing in debug mode. First, its awkward to change the behavior of this instruction based on the privileged mode. And second, we already have another well-defined mechanism to change the m-bit in dinfc using csrr, scmode and csrw which we can fully execute from the program buffer given that CHERI RISC-V requires the program buffer to have at least 4 entries.

@arichardson : What do you think?

I did not realize that it was possible to have pcc in debug mode, I though it always used a program buffer without a real pc. Your explanation makes sense and I think not having it affect dinfc.mode is fine.

Alternatively, for implementations that have a PCC in debug mode and support modesw, you could copy PCC.mode into dindc.mode at the end of debug mode execution, but I'm not convinced that's needed. All we really need is a one time selection on debugger startup and for that the CSR write seems fine.

@arichardson
Copy link
Collaborator

I broadly agree with this change. However, it would be best if we did not have MODESW writing dinfc when executing in debug mode. First, its awkward to change the behavior of this instruction based on the privileged mode. And second, we already have another well-defined mechanism to change the m-bit in dinfc using csrr, scmode and csrw which we can fully execute from the program buffer given that CHERI RISC-V requires the program buffer to have at least 4 entries.
@arichardson : What do you think?

I did not realize that it was possible to have pcc in debug mode, I though it always used a program buffer without a real pc. Your explanation makes sense and I think not having it affect dinfc.mode is fine.

Alternatively, for implementations that have a PCC in debug mode and support modesw, you could copy PCC.mode into dindc.mode at the end of debug mode execution, but I'm not convinced that's needed. All we really need is a one time selection on debugger startup and for that the CSR write seems fine.

Alternatively, we could say for implementations that have a real pcc in debug mode, the m bit if dinfc is a view of the PCC mode bit?

@tariqkurd-repo
Copy link
Collaborator Author

tariqkurd-repo commented Sep 20, 2024 via email

@tariqkurd-repo tariqkurd-repo merged commit 5bfe227 into riscv:main Sep 23, 2024
3 checks passed
tariqkurd-repo added a commit to tariqkurd-repo/riscv-cheri that referenced this pull request Oct 9, 2024
fixes riscv#322

---------

Signed-off-by: Tariq Kurd <[email protected]>
Co-authored-by: Alexander Richardson <[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.

Integer pointer mode in debug mode
5 participants