Skip to content

Commit

Permalink
i#1899: suppress decoding warning on MPX prefixes
Browse files Browse the repository at this point in the history
Until we have i#1312 and actual MPX decoding, for now we suppress the repne
prefix warning seen on Windows 10.

Fixes #1899

Review-URL: https://codereview.appspot.com/290480043
  • Loading branch information
derekbruening committed Mar 8, 2016
1 parent 78466ca commit 82b8f9a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
12 changes: 9 additions & 3 deletions core/arch/x86/decode.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* **********************************************************
* Copyright (c) 2011-2015 Google, Inc. All rights reserved.
* Copyright (c) 2011-2016 Google, Inc. All rights reserved.
* Copyright (c) 2000-2010 VMware, Inc. All rights reserved.
* **********************************************************/

Expand Down Expand Up @@ -1104,8 +1104,14 @@ read_instruction(byte *pc, byte *orig_pc,
if (report_invalid &&
((di->rep_prefix &&
/* case 6861: AMD64 opt: "rep ret" used if br tgt or after cbr */
(pc != di->start_pc+2 || *(di->start_pc+1) != RAW_OPCODE_ret))
|| di->repne_prefix)) {
(pc != di->start_pc+2 || *(di->start_pc+1) != RAW_OPCODE_ret)) ||
(di->repne_prefix &&
/* i#1899: MPX puts repne prior to branches. We ignore here until we have
* full MPX decoding support (i#1312).
*/
info->type != OP_call && info->type != OP_call_ind && info->type != OP_ret &&
info->type != OP_jmp && info->type != OP_jmp_short &&
!opc_is_cbr_arch(info->type)))) {
char bytes[17*3];
int i;
dcontext_t *dcontext = get_thread_private_dcontext();
Expand Down
5 changes: 4 additions & 1 deletion core/arch/x86/decode_private.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* **********************************************************
* Copyright (c) 2011-2014 Google, Inc. All rights reserved.
* Copyright (c) 2011-2016 Google, Inc. All rights reserved.
* Copyright (c) 2000-2010 VMware, Inc. All rights reserved.
* **********************************************************/

Expand Down Expand Up @@ -439,6 +439,9 @@ int indir_var_reg_offs_factor(int optype);
opnd_size_t expand_subreg_size(opnd_size_t sz);
dr_pred_type_t decode_predicate_from_instr_info(uint opcode, const instr_info_t *info);

/* in instr.c, not exported to non-x86 files */
bool opc_is_cbr_arch(int opc);

/* exported tables */
extern const instr_info_t first_byte[];
extern const instr_info_t second_byte[];
Expand Down
10 changes: 8 additions & 2 deletions core/arch/x86/instr.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,14 +387,20 @@ instr_is_return(instr_t *instr)
/*** WARNING! The following rely on ordering of opcodes! ***/

bool
instr_is_cbr_arch(instr_t *instr) /* conditional branch */
opc_is_cbr_arch(int opc)
{
int opc = instr->opcode; /* caller ensures opcode is valid */
return ((opc >= OP_jo && opc <= OP_jnle) ||
(opc >= OP_jo_short && opc <= OP_jnle_short) ||
(opc >= OP_loopne && opc <= OP_jecxz));
}

bool
instr_is_cbr_arch(instr_t *instr) /* conditional branch */
{
int opc = instr->opcode; /* caller ensures opcode is valid */
return opc_is_cbr_arch(opc);
}

bool
instr_is_mbr_arch(instr_t *instr) /* multi-way branch */
{
Expand Down

0 comments on commit 82b8f9a

Please sign in to comment.