Skip to content

Commit

Permalink
i#1569 AArch64: Port and enable api/samples/opcodes.c.
Browse files Browse the repository at this point in the history
  • Loading branch information
egrimley-arm committed Jan 27, 2017
1 parent 7cdd07b commit 3bfb964
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 1 addition & 3 deletions api/samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,7 @@ add_sample_client(signal "signal.c" "drmgr")
add_sample_client(syscall "syscall.c" "drmgr")
add_sample_client(inline "inline.c" "")
add_sample_client(inscount "inscount.c" "drmgr")
if (NOT AARCH64) # FIXME i#1569: port to AArch64
add_sample_client(opcodes "opcodes.c" "drx")
endif ()
add_sample_client(opcodes "opcodes.c" "drx")
add_sample_client(stl_test "stl_test.cpp" "")
# add utils.h for installation # NON-PUBLIC
set(srcs ${srcs} "utils.h") # NON-PUBLIC
Expand Down
9 changes: 8 additions & 1 deletion api/samples/opcodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ enum {
#elif defined(ARM)
ISA_ARM_A32,
ISA_ARM_THUMB,
#elif defined(AARCH64)
ISA_ARM_A64,
#endif
NUM_ISA_MODE,
};
Expand Down Expand Up @@ -130,6 +132,8 @@ get_isa_mode_name(uint isa_mode)
return (isa_mode == ISA_X86_32) ? "32-bit X86" : "64-bit AMD64";
#elif defined(ARM)
return (isa_mode == ISA_ARM_A32) ? "32-bit ARM" : "32-bit Thumb";
#elif defined(AARCH64)
return "64-bit AArch64";
#else
return "unknown";
#endif
Expand Down Expand Up @@ -188,6 +192,9 @@ get_count_isa_idx(void *drcontext)
break;
case DR_ISA_ARM_THUMB:
return ISA_ARM_THUMB;
#elif defined (AARCH64)
case DR_ISA_ARM_A64:
return ISA_ARM_A64;
#endif
default:
DR_ASSERT(false); /* NYI */
Expand Down Expand Up @@ -217,7 +224,7 @@ event_basic_block(void *drcontext, void *tag, instrlist_t *bb,
* optimize the spills and restores.
*/
drx_insert_counter_update(drcontext, bb, first,
SPILL_SLOT_1, IF_ARM_(SPILL_SLOT_2)
SPILL_SLOT_1, IF_AARCHXX_(SPILL_SLOT_2)
&count[isa_idx][instr_get_opcode(instr)], 1,
/* DRX_COUNTER_LOCK is not yet supported on ARM */
IF_X86_ELSE(DRX_COUNTER_LOCK, 0));
Expand Down

0 comments on commit 3bfb964

Please sign in to comment.