-
Notifications
You must be signed in to change notification settings - Fork 573
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
i#3544 RV64: Rebase the dcontext pointer. #7235
base: master
Are you sure you want to change the base?
Conversation
The dcontext_t struct is larger than the biggest valid displacement of the load and store instructions. By rebasing the pointer by 0x800, we van access the entire struct, because the dispacement can be in the renge of -0x800 to 0x7ff.
Also worked around build failure on windows
I know that these patches are quite "hacky". However, I could not find a better way to work around some issues. |
FYI I am out of office today; will take a look tomorrow. |
The failure is the sourceware.org network issue. Several flaky issues were fixed in the last several days: probably worth merging the latest from master. |
@@ -698,12 +698,13 @@ append_restore_simd_reg(dcontext_t *dcontext, instrlist_t *ilist, bool absolute) | |||
* | |||
* ma ta sew=8 lmul=8 */ | |||
vtypei = (0b1 << 7) | (0b1 << 6) | (0b000 << 3) | 0b011; | |||
memopnd = opnd_create_dcontext_field_via_reg_sz( | |||
dcontext, DR_REG_A1, 0, reg_get_size_lmul(DR_REG_VR0, RV64_LMUL_8)); | |||
memopnd = opnd_create_base_disp(DR_REG_A1, REG_NULL, 0, 0, |
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.
Is this temporary and you want to go back to the opnd_create_dc* routine? Added a TODO i#3544: ...
? Ditto below.
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.
To me, it looks like opnd_create_dcontext_field_via_reg_sz()
should not be used for this specific operand. We do not want to access a dcontext field by base+offset. The memory address where the the respective memory operation is expected to happen is already in register a1. This worked before, but now it tries to access a1-0x800 instead of a1. So I believe, it should not be temporary.
EDIT: s/respected/respective/
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.
Since this the only remaining unresolved conversation, we would like some clarification on that. I have stated my opinion that opnd_create_base_disp()
is more appropriate in these cases. What are we going to do with it?
Renamed some macros, added helper macros to replace raw arithmetic operations, Added missing DCONTEXT_ACTUAL_TO_TLS_OFFSET.
For RISC-V the dcontext_t struct is larger than the biggest valid displacement of the load and store instructions.
By rebasing the pointer kept in spill_state_t's TLS slot by 0x800, we can access the entire struct, because the displacement can be in the range of -0x800 to 0x7ff. Architectures other than RV64, are unaffected by these changes.