-
Notifications
You must be signed in to change notification settings - Fork 9
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
CSetBoundsRoundDown #74
base: main
Are you sure you want to change the base?
Conversation
e1b377d
to
0d2c6b6
Compare
FIXES #72 Co-authored-by: Robert Norton <[email protected]>
0d2c6b6
to
8ad5dfc
Compare
This copies "the TLS stack buffer trick" into the base RTOS for broader use. The implementation can be replaced with [CSetBoundsRoundDown](CHERIoT-Platform/cheriot-sail#74) if and when that lands in the ISA.
@rmn30 can this be accomplished by making smaller changes to setCapBounds, for example by removing the T=T+1 part of the following code? If we implement this instruction using the same way it is defined in PR, the new length has to be computed before the setCapBounds logic. This would impact both critical path timing and area. |
I think it might take a little more than just eliminating the T increment (because we also want to avoid rounding base down) but I think we should be able to come up with an implementation. It may even be a bit simpler than existing CSetBounds. |
So, musing aloud... given |
Not quite sure I am following - wouldn't we want to compute the exponent of length (rs2) first and round the length down? |
I think we could use I've not thought this through entirely and would need to do formal checks once we have it in Sail. Edit: definitely needs more thought. base can be made more than After more thought: Since e_l is the smallest exponent that can represent the requested length if we have to use the smaller e_b to align the base we know we have to return a max length cap. The only other thing we have to deal with if is e_l is 24 (max e) and |
Attempt at Sail for above: 823e75b |
That (comment and 823e75b) looks sensible to me and corrects a bug in my original attempt (I'd missed the |
Ok this looks good. I am still mulling ways to merge this with the existing setCapBounds logic to save some area (a little tricky there since setCapBounds is also the critical timing path). But even if that doesn't work out it may not be too bad (maybe adding additional 2% of area or so?). |
@rmn30 also want to confirm - looks like the inCapBounds check is the still the same, i.e., compare the "requested" top vs the cs1.top and the new base (cs1.address) vs cs1.base? |
Yes, this should never return a length that is greater than the requested length so the existing check works fine. Would like to have a proof of this, though. |
Could you look at the last commit in this branch that combines this with some encoding changes? I think this simplifies setCapBounds (both versions) as well as making the encoding more efficient. |
See #72.