-
Notifications
You must be signed in to change notification settings - Fork 169
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
base: master
Are you sure you want to change the base?
Conversation
…smepmp. Sail function: haveSmepmp Added support of Smepmp Co-authored-by: William McSpaddden <[email protected]> Co-authored-by: Hamza Khan <[email protected]>
There was a problem hiding this 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) |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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() ...
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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 */ |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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