diff --git a/clients/drcachesim/common/trace_entry.h b/clients/drcachesim/common/trace_entry.h index c321a713f3b..059dea3788c 100644 --- a/clients/drcachesim/common/trace_entry.h +++ b/clients/drcachesim/common/trace_entry.h @@ -117,11 +117,7 @@ extern const char * const trace_type_names[]; // - a flush request // - a prefetch request // - a thread/process -// FIXME i#1729/i#1569: for offline traces we need to pack this to avoid -// compiler padding differences. Packing should also help online performance, -// and having the two identical is required anyway to avoid complexity in -// reader_t. Once the AArch64 instrumentation handles unaligned offsets we'll -// put back the {START,END}_PACKED_STRUCTURE. +START_PACKED_STRUCTURE struct _trace_entry_t { unsigned short type; // 2 bytes: trace_type_t // 2 bytes: mem ref size, instr length, or num of instrs for instr bundle @@ -131,7 +127,7 @@ struct _trace_entry_t { // The length of each instr in the instr bundle unsigned char length[sizeof(addr_t)]; }; -}; +} END_PACKED_STRUCTURE; typedef struct _trace_entry_t trace_entry_t; static inline bool diff --git a/core/arch/aarch64/instr_create.h b/core/arch/aarch64/instr_create.h index c7074b4ed28..878dbf3cbab 100644 --- a/core/arch/aarch64/instr_create.h +++ b/core/arch/aarch64/instr_create.h @@ -94,7 +94,10 @@ * \param m The destination memory opnd. * \param r The source register opnd. */ -#define XINST_CREATE_store(dc, m, r) INSTR_CREATE_str((dc), (m), (r)) +#define XINST_CREATE_store(dc, m, r) \ + (opnd_is_base_disp(m) && \ + opnd_get_disp(m) % opnd_size_in_bytes(opnd_get_size(m)) != 0 ? \ + INSTR_CREATE_stur(dc, m, r) : INSTR_CREATE_str(dc, m, r)) /** * This platform-independent macro creates an instr_t for a 1-byte @@ -289,10 +292,14 @@ instr_create_0dst_0src((dc), OP_nop) #define INSTR_CREATE_ret(dc, Rn) \ instr_create_0dst_1src((dc), OP_ret, (Rn)) -#define INSTR_CREATE_str(dc, mem, Rt) \ - instr_create_1dst_1src((dc), OP_str, (mem), (Rt)) -#define INSTR_CREATE_strh(dc, mem, Rt) \ - instr_create_1dst_1src((dc), OP_strh, (mem), (Rt)) +#define INSTR_CREATE_str(dc, mem, rt) \ + instr_create_1dst_1src(dc, OP_str, mem, rt) +#define INSTR_CREATE_strh(dc, mem, rt) \ + instr_create_1dst_1src(dc, OP_strh, mem, rt) +#define INSTR_CREATE_stur(dc, mem, rt) \ + instr_create_1dst_1src(dc, OP_stur, mem, rt) +#define INSTR_CREATE_sturh(dc, mem, rt) \ + instr_create_1dst_1src(dc, OP_sturh, mem, rt) #define INSTR_CREATE_sub(dc, rd, rn, rm_or_imm) \ INSTR_CREATE_sub_shift(dc, rd, rn, rm_or_imm, OPND_CREATE_LSL(), OPND_CREATE_INT(0)) #define INSTR_CREATE_sub_extend(dc, rd, rn, rm, ext, exa) \