Skip to content

Commit

Permalink
i#1569 AArch64: Port and enable api/samples/bbbuf.c
Browse files Browse the repository at this point in the history
AArch64 needs a second scratch register for drx_buf_insert_load_buf_ptr
and drx_buf_insert_buf_store, like AArch32.

Review-URL: https://codereview.appspot.com/318280043
  • Loading branch information
fhahn committed Jan 23, 2017
1 parent 408e012 commit fa7e5c5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 1 addition & 3 deletions api/samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,7 @@ configure_DynamoRIO_global(OFF ON)

# Use ;-separated lists for source files and extensions.

if (NOT AARCH64) # FIXME i#1569: port to AArch64
add_sample_client(bbbuf "bbbuf.c" "drmgr;drreg;drx")
endif ()
add_sample_client(bbbuf "bbbuf.c" "drmgr;drreg;drx")
add_sample_client(bbsize "bbsize.c" "drmgr")
add_sample_client(empty "empty.c" "")
add_sample_client(memtrace_simple "memtrace_simple.c;utils.c" "drmgr;drreg;drutil;drx")
Expand Down
8 changes: 4 additions & 4 deletions api/samples/bbbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ event_app_instruction(void *drcontext, void *tag, instrlist_t *bb, instr_t *inst
{
app_pc pc = dr_fragment_app_pc(tag);
reg_id_t reg;
/* We need a 2nd scratch reg for several operations on ARM only */
/* We need a 2nd scratch reg for several operations on AArch32 and AArch64 only. */
reg_id_t reg2 = DR_REG_NULL;

/* We do all our work at the start of the block prior to the first instr */
Expand All @@ -77,9 +77,9 @@ event_app_instruction(void *drcontext, void *tag, instrlist_t *bb, instr_t *inst
return DR_EMIT_DEFAULT;
}

#ifdef ARM
#ifdef AARCHXX
/* We need a second register here, because the drx_buf routines need a scratch reg
* for ARM.
* for AArch32 and AArch64.
*/
if (drreg_reserve_register(drcontext, bb, inst, NULL, &reg2) != DRREG_SUCCESS) {
DR_ASSERT(false); /* cannot recover */
Expand All @@ -103,7 +103,7 @@ event_app_instruction(void *drcontext, void *tag, instrlist_t *bb, instr_t *inst
if (drreg_unreserve_register(drcontext, bb, inst, reg) != DRREG_SUCCESS)
DR_ASSERT(false);

#ifdef ARM
#ifdef AARCHXX
if (drreg_unreserve_register(drcontext, bb, inst, reg2) != DRREG_SUCCESS)
DR_ASSERT(false);
#endif
Expand Down

0 comments on commit fa7e5c5

Please sign in to comment.