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 STIDC and UTIDC registers #247

Open
wants to merge 4 commits into
base: qemu-cheri
Choose a base branch
from
Open

Added STIDC and UTIDC registers #247

wants to merge 4 commits into from

Conversation

francislaus
Copy link

This PR adds the SCRs for supervisor and user thread ID capability registers, which are used in compartmentalisation.

@francislaus francislaus self-assigned this Apr 18, 2024
@francislaus francislaus marked this pull request as ready for review April 26, 2024 09:36
@francislaus francislaus requested a review from qwattash April 26, 2024 09:36
Copy link
Contributor

@qwattash qwattash left a comment

Choose a reason for hiding this comment

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

Looks good to me, I'm not sure why the Morello test is failing though.
Checkpatch complains about // comments but all files uses them, I don't see much of a point to have multiple comment styles here just for that.

@arichardson
Copy link
Member

The current spec has UTID as a view of STID (and no MTID at all), do we want to match that instead?

@jrtc27
Copy link
Member

jrtc27 commented May 8, 2024

The current spec has UTID as a view of STID (and no MTID at all), do we want to match that instead?

That's being changed, it was a bad idea to not have a separate ID register for S-mode's own use

@@ -165,6 +181,10 @@ void HELPER(cspecialrw)(CPUArchState *env, uint32_t cd, uint32_t cs,
_host_return_address);
}
bool can_access_sysregs = cheri_have_access_sysregs(env);
bool is_write = (cs != 0);
Copy link
Member

Choose a reason for hiding this comment

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

Introducing a variable for this when there are multiple existing, untouched uses of cs != 0 isn't particularly clean

Copy link
Author

Choose a reason for hiding this comment

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

@jrtc27 The same would then apply to bool can_access_sysregs. I attempted to use the style of the code around, but I am more than happy to directly use cs != 0. I did not spot a variable that would give me the same semantics, but I might have missed it.

ASR_W_Flag = 2,
U_Always = (PRV_U + 1) << 2,
U_ASR_W = U_Always | ASR_W_Flag,
U_ASR = U_ASR_W | ASR_Flag,
Copy link
Member

Choose a reason for hiding this comment

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

U_ASR is ASR + ASR_W, which is a bit odd (i.e. you're inconsistent between the flag and the aliases what the unsuffixed version means)

Copy link
Member

Choose a reason for hiding this comment

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

Also, U_Always | ASR_Flag and U_Always | ASR_Flag | ASR_W_Flag behave the same, which is a bit confusing too IMO

Copy link
Author

Choose a reason for hiding this comment

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

@jrtc27 Would ASR_RW = ASR_R | ASR_W be something you are happy with? Then all SCRs other than xTIDC need to have ASR_RW.

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