-
Notifications
You must be signed in to change notification settings - Fork 610
Gather/Scatter instructions can set RF #7897
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
Open
khuey
wants to merge
1
commit into
master
Choose a base branch
from
iX-gather-scatter-fWR
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Question: Is RF written with 0 all the other times, or it's only written at all in this exception case and otherwise is not touched? If the latter: how do we represent that? I recall pretending it does a read in some such cases but am not remembering exactly when we did that; also not remembering all the details of things like instr_predicate_writes_eflags().
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.
The processor sets RF to 0 after every successful instruction execution, so yes, 0 is written all other times.
I'm not entirely sure we want this the more I think about it. What's unique about this instruction is not that it sets RF (anything that triggers a page fault can do that), it's that it can "partially complete" and be interrupted. The repeating string instructions can do that too (and they also don't have fWR).
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.
For the partially complete attribute: tools that themselves take action for each subpart of these instructions will be using drx_expand_scatter_gather() (just like they'd expand rep string instructions into explicit loops), so interruption in the middle will also interrupt the instrumentation in the middle.
For the flags: drreg and tools in general don't touch RF for normal instrumentation.
If setting RF seems more of a general mechanism with pending faults maybe like you said it's not worth marking here? OTOH it may not cause any harm to put it here since as noted most flag analyzers only look at the arithmetic flags or maybe DF.
I would be ok either way.
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.
Why do these instructions need to set RF while rep string instructions don't?
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.
I.e., wouldn't a rep string fault where a pending trap/interrupt exists also want to deliver the trap/interrupt first and set RF?
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.
I checked, and repeated string instructions do set RF.
From the Intel manual, Vol 3 (https://cdrdv2.intel.com/v1/dl/getContent/671447):
So we should probably add
fWRtoOP_rep_as well in decode_table.c?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.
Yes, if I land this it should change the repeating string instructions too.