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

Minor fixes #54

Merged
merged 1 commit into from
Feb 2, 2024
Merged

Minor fixes #54

merged 1 commit into from
Feb 2, 2024

Conversation

sorear
Copy link
Contributor

@sorear sorear commented Jan 26, 2024

These are the items from my list that should mostly speak for themselves.

src/riscv-integration.adoc Outdated Show resolved Hide resolved
@@ -1058,7 +1059,7 @@ NOTE: `auth_cap` is <<ddc>> for Legacy mode and `cs1` for Capability Mode
6+| *Store/atomic/cache-block-operation additional exception checks*
| all stores, all atomics, all cbos | {cheri_excep_mcause} | {cheri_excep_type_data} | {cheri_excep_cause_tag} |`auth_cap` tag | not(`auth_cap.tag`)
| all stores, all atomics, all cbos | {cheri_excep_mcause} | {cheri_excep_type_data} | {cheri_excep_cause_seal} |`auth_cap` seal | isCapSealed(`auth_cap`)
| all atomics, all cbos | {cheri_excep_mcause} | {cheri_excep_type_data} | {cheri_excep_cause_perm} |`auth_cap` permission | AMO only: not(`auth_cap`.<<r_perm>>)
| all atomics | {cheri_excep_mcause} | {cheri_excep_type_data} | {cheri_excep_cause_perm} |`auth_cap` permission | not(`auth_cap`.<<r_perm>>)
Copy link
Collaborator

Choose a reason for hiding this comment

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

"Non-prefetch CBOs"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

CBO.ZERO is equivalent to a series of writes, so it shouldn't check R. FLUSH/INVAL are less critical but are more writey than ready.

Copy link
Collaborator

@andresag01 andresag01 Jan 26, 2024

Choose a reason for hiding this comment

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

There were previous discussions about what permissions to check for each CBO. The checks are summarised here for all CBO and prefetch instructions. These checks are currently specified in the instruction listings towards the end of the spec, so ideally we can stick with these unless there is a clear problem:

  • cbo.zero is a whole cache line store, so it behaves and is checked exactly like any other RISC-V store
    • Bounds, tag, store permission, etc are checked
    • There are two variants of the instruction depending on the PCC mode flag
  • prefetch.i, prefetch.r and prefetch.w
    • Tag and sealing check as usual
    • prefetch.i check execute permission
    • prefetch.w check store permission
    • prefetch.r check load permission
    • Check that the authorising capability's bounds cover at least 1 byte in the cache line prefetched
    • Do not start the prefetch if any of the checks above fails.
  • cbo.clean and cbo.flush
    • Tag and sealing check as usual
    • Check that there are store or load permissions
    • Check that the authorising capability's bounds cover at least 1 byte in the cache line flushed/cleaned
  • cbo.inval
    • Tag and sealing check as usual
    • Check that there are store, load and ASR permissions
    • Check that the authorising capability's bounds cover the entire cache line invalidated
    • The same checks must be retained if cbo.inval is configured to behave as cbo.flush

| indirect jumps | {cheri_excep_mcause} | {cheri_excep_type_jump} | {cheri_excep_cause_tag} |`cs1` tag | not(`cs1.tag`)
| indirect jumps | {cheri_excep_mcause} | {cheri_excep_type_jump} | {cheri_excep_cause_seal} |`cs1` seal | isCapSealed(`cs1`) and imm12 != 0
| indirect jumps | {cheri_excep_mcause} | {cheri_excep_type_jump} | {cheri_excep_cause_perm} |`cs1` permission| not(`cs1`.<<x_perm>>)
| indirect jumps | {cheri_excep_mcause} | {cheri_excep_type_jump} | {cheri_excep_cause_length} |`cs1` length | any byte of 16-bit instruction at target out of `cs1` bounds
Copy link
Collaborator

Choose a reason for hiding this comment

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

The 16-bit must also be "minimal length"

@sorear sorear force-pushed the minor-fixes-1 branch 2 times, most recently from 4f5c2d9 to 47880e5 Compare January 26, 2024 21:23
Copy link
Collaborator

@andresag01 andresag01 left a comment

Choose a reason for hiding this comment

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

Thank you for the changes. Just a couple of small comments.

src/insns/cgetlen_32bit.adoc Outdated Show resolved Hide resolved
sign-extended 12-bit immediate if the immediate is not zero, then setting the
least significant bit of the result to zero, then unsealing. The capability
with the address of the instruction following the jump (<<pcc>> + 4) is written
to a *c* register.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you change this to say that the return capability is sealed?

@andresag01
Copy link
Collaborator

This change also fixes #84

The exception table for CMOs comes from CTSRD-CHERI/cheri-specification#65.
@andresag01 andresag01 merged commit dbe2051 into riscv:main Feb 2, 2024
3 checks passed
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.

4 participants