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

Support for new CHERI128 trace format from hardware. #3

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

jonwoodruff
Copy link

This has not been compiled yet! It should have the main components and details ported from berictl, but I don't yet have a setup to be able to compile.

Main missing feature is extracting the type for sealed capabilities and accounting for the type information in the lower parts of the top and bottom fields when the capability is sealed.

Copy link
Member

@davidchisnall davidchisnall left a comment

Choose a reason for hiding this comment

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

This needs some test cases. Please add a short trace (see short.trace) and a test along the lines of regset_update.cc to check that we're getting the values that you expect.

streamtrace.cc Outdated

uint64_t edgbits = (botbits-0x100ULL)&0xFFFFFULL;
uint64_t ptrbits = (ptr>>exp)&0xFFFFFULL;
uint8_t ptrHi = (ptrbits < edgbits);
Copy link
Member

Choose a reason for hiding this comment

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

Indentation.

streamtrace.cc Outdated
uint8_t botHi = (botbits < edgbits);
uint8_t topHi = (topbits < edgbits);

uint64_t bigOne = 1ULL<<(exp+20ULL);
Copy link
Member

Choose a reason for hiding this comment

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

Indentation.

* on the trace format. val1/pc is the 1st half of the capability containing the
* pointer and val2 is the 2nd half of the compressed capability containing the
* bounds and permissions.
*/
Copy link
Member

Choose a reason for hiding this comment

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

The first half of this comment is confusing, as it's talking about where these values come from long before they get to this function.

Copy link
Author

Choose a reason for hiding this comment

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

Yes. This is brought forward from the older variations of this function. If we want to change the comment, we should change it everywhere.

streamtrace.cc Outdated
cap->type = 0; // TODO extract type from typed capabilities
cap->permissions = extract_bits<63,49>(val2);
uint64_t exp = extract_bits<46,41>(val2);
uint64_t mask = ((uint64_t) ~0)<<20ULL;
Copy link
Member

Choose a reason for hiding this comment

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

I think I can figure out what this is doing, but please add a comment explaining it.

streamtrace.cc Outdated
uint64_t botbits = extract_bits<39,20>(val2);//(half2>>20) & 0xFFFFFULL;
uint64_t bot = (ptr&mask)|(botbits<<exp);
uint64_t topbits = (half2) & 0xFFFFFULL;
uint64_t top = (ptr&mask)|(topbits<<exp);
Copy link
Member

Choose a reason for hiding this comment

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

There's some quite random spacing here...

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