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

Added support of Smepmp #601

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

KotorinMinami
Copy link
Contributor

added command line support for Smepmp. command line switch: --enable-smepmp. Sail function: haveSmepmp

Added support of Smepmp

This pr was written by @HamzaKh01, merged with the command-line switch code provided by Bill, and adjusted by myself

Copy link

github-actions bot commented Oct 19, 2024

Test Results

396 tests  ±0   396 ✅ ±0   0s ⏱️ ±0s
  4 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit ad5a9ed. ± Comparison against base commit 188acd0.

♻️ This comment has been updated with latest results.

…smepmp. Sail function: haveSmepmp

Added support of Smepmp

Co-authored-by: William McSpaddden <[email protected]>
Co-authored-by: Hamza Khan <[email protected]>
@Timmmm
Copy link
Collaborator

Timmmm commented Oct 31, 2024

Specification is here

Copy link
Collaborator

@Timmmm Timmmm left a comment

Choose a reason for hiding this comment

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

Still working on reading all the boolean logic...

}

register mseccfg : Mseccfg_ent
register mseccfgh : bits(32)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Normally we don't treat this as a separate register, we just make bitfield Mseccfg : bits(64) and then read/write the appropriate bits of it.

We have an implementation of mseccfg like that internally; I'll make a PR for it.

/* Enable Smepmp */
val sys_enable_smepmp = pure "sys_enable_smepmp" : unit -> bool
/* TODO: for extension smmpm and zkr to enable */
function sys_has_mseccfg() -> bool = sys_enable_smepmp()
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can implement mseccfg even if you don't have any of the extensions that use it (and that isn't a weird edge case). So ideally this would be

// Callback to C
val sys_have_mseccfg : "sys_have_mseccfg" unit -> bool

function have_mseccfg() -> bool = sys_have_mseccfg() | sys_enable_smepmp() | sys_enable_zkr() ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You mean we need to add an extra command line parameter to act as an extra switch to control the presence of mseccfg to make sure that even if we don't implement extensions that use this register, we can still implement this register, right ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah exactly. I don't think we need to actually bother hooking it up to a CLI arguments at the moment - we can wait until Alasdair's new config system exists and then it will be a whole lot less tedious. But we can just have a function that returns true as a placeholder so we don't forget.

@@ -48,14 +48,43 @@ function pmpCheckRWX(ent, acc) = {
}
}

// this needs to be called with the effective current privilege.
/* this needs to be called with the effective current privilege */
Copy link
Collaborator

Choose a reason for hiding this comment

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

// style comments are nicer IMO. I don't see why we would change them back?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the part that was changed by @HamzaKh01, I didn't check this as I was too focused on the code implementation part, we can change it back if needed, but there are many one line comments like /* ... */ in Sail, we might need to declare it better in the codestyle after some discussion?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah there is an experimental auto-formatter in the Sail compiler but I don't know what state it got to and I'd guess it doesn't change this sort of thing.

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.

2 participants