-
Notifications
You must be signed in to change notification settings - Fork 570
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#2297: AARCH64: Implement cbr instrumentation #7005
base: master
Are you sure you want to change the base?
Changes from all commits
a08aec1
01872ba
79e3375
b5155c3
78f6037
22e365d
f02728e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -463,12 +463,12 @@ | |
* they just need to know whether they need to preserve the app's flags, so maybe | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please enable the count-ctis tests which use this, which will add regression tests. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since count-ctis test requires mbr instrumentation as well, I have added initial implementation for mbr instrumentation. But it sometimes return a very small number, possibly some index into the indirect branch cache? How to convert it back to actual address? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, didn't realize it needed more: was just grepping for tests that use cbr. Makes sense to separate out the mbr. Is it easy to separate in the test? Or just separately locally in the test and confirm cbr works and state that in the PR description and say that the test will be enabled soon when mbr is added and then enable the test in a separate PR for mbr, so long as that comes in relatively soon (i.e., not months later with no cbr test in the meantime). mbr is supposed to obtain a real address so that sounds like something is wrong there. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please update the PR description to describe how you tested this, since there are no tests added/enabled by this PR (see prior comment which will add some). |
||
* we can just document that this may not write them. | ||
*/ | ||
#define XINST_CREATE_slr_s(dc, d, rm_or_imm) \ | ||
(opnd_is_reg(rm_or_imm) \ | ||
? instr_create_1dst_2src(dc, OP_lsrv, d, d, rm_or_imm) \ | ||
: instr_create_1dst_3src(dc, OP_ubfm, d, d, rm_or_imm, \ | ||
reg_is_32bit(opnd_get_reg(d)) ? OPND_CREATE_INT(31) \ | ||
: OPND_CREATE_INT(63))) | ||
#define XINST_CREATE_slr_s(dc, d, rm_or_imm) \ | ||
(opnd_is_reg(rm_or_imm) \ | ||
? instr_create_1dst_2src(dc, OP_lsrv, d, d, rm_or_imm) \ | ||
: INSTR_CREATE_ubfm(dc, d, d, rm_or_imm, \ | ||
reg_is_32bit(opnd_get_reg(d)) ? OPND_CREATE_INT(31) \ | ||
: OPND_CREATE_INT(63))) | ||
|
||
/** | ||
* This platform-independent macro creates an instr_t for a nop instruction. | ||
|
@@ -658,14 +658,49 @@ | |
instr_create_0dst_3src((dc), OP_tbnz, (pc), (reg), (imm)) | ||
#define INSTR_CREATE_cmp(dc, rn, rm_or_imm) \ | ||
INSTR_CREATE_subs(dc, OPND_CREATE_ZR(rn), rn, rm_or_imm) | ||
#define INSTR_CREATE_eor(dc, d, s) \ | ||
INSTR_CREATE_eor_shift(dc, d, d, s, OPND_CREATE_INT8(DR_SHIFT_LSL), \ | ||
OPND_CREATE_INT8(0)) | ||
|
||
/** | ||
* Creates an EOR instruction with one output and two inputs. For simplicity, the first | ||
* input reuses the output register. | ||
* | ||
* \param dc The void * dcontext used to allocate memory for the instr_t. | ||
* \param d The output register and the first input register. | ||
* \param s_or_imm The second input register or immediate. | ||
*/ | ||
#define INSTR_CREATE_eor(dc, d, s_or_imm) \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for contributing. Ideally, every new addition of an
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, added |
||
opnd_is_immed(s_or_imm) \ | ||
? instr_create_1dst_2src(dc, OP_eor, d, d, s_or_imm) \ | ||
: INSTR_CREATE_eor_shift(dc, d, d, s_or_imm, OPND_CREATE_INT8(DR_SHIFT_LSL), \ | ||
OPND_CREATE_INT8(0)) | ||
#define INSTR_CREATE_eor_shift(dc, rd, rn, rm, sht, sha) \ | ||
instr_create_1dst_4src(dc, OP_eor, rd, rn, \ | ||
opnd_create_reg_ex(opnd_get_reg(rm), 0, DR_OPND_SHIFTED), \ | ||
opnd_add_flags(sht, DR_OPND_IS_SHIFT), sha) | ||
|
||
/** | ||
* Creates a CSINC instruction with one output and three inputs. | ||
* | ||
* \param dc The void * dcontext used to allocate memory for the instr_t. | ||
* \param rd The output register. | ||
* \param rn The first input register. | ||
* \param rm The second input register. | ||
* \param cond The third input condition code. | ||
*/ | ||
#define INSTR_CREATE_csinc(dc, rd, rn, rm, cond) \ | ||
instr_create_1dst_3src(dc, OP_csinc, rd, rn, rm, cond) | ||
|
||
/** | ||
* Creates a UBFM instruction with one output and three inputs. | ||
* | ||
* \param dc The void * dcontext used to allocate memory for the instr_t. | ||
* \param rd The output register. | ||
* \param rn The first input register. | ||
* \param immr The second input immediate. | ||
* \param imms The third input immediate. | ||
*/ | ||
#define INSTR_CREATE_ubfm(dc, rd, rn, immr, imms) \ | ||
instr_create_1dst_3src(dc, OP_ubfm, rd, rn, immr, imms) | ||
|
||
#define INSTR_CREATE_ldp(dc, rt1, rt2, mem) \ | ||
instr_create_2dst_1src(dc, OP_ldp, rt1, rt2, mem) | ||
#define INSTR_CREATE_ldr(dc, Rd, mem) instr_create_1dst_1src((dc), OP_ldr, (Rd), (mem)) | ||
|
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.
Please enable the samples that use this which are currently disabled:
Those are run as tests, though w/o targeted correctness checks: just making sure they don't crash.