Skip to content

Commit

Permalink
Fixed memory addressing assert
Browse files Browse the repository at this point in the history
  • Loading branch information
John Detter committed Jun 20, 2016
1 parent c2a2e27 commit 7f33bd0
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions common/src/arch-x86.C
Original file line number Diff line number Diff line change
Expand Up @@ -8211,11 +8211,11 @@ ia32_instruction& ia32_decode(unsigned int capa, const unsigned char* addr, ia32
return instruct;
}

// printf("PREFIXES(%d): ", instruct.size);
printf("PREFIXES(%d): ", instruct.size);

// int x;
// for(x = 0;x < instruct.size;x++)
// printf("%x ", addr[x]);
int x;
for(x = 0;x < instruct.size;x++)
printf("%x ", addr[x]);

/* Skip the prefixes so that we don't decode them again */
addr = addr_orig + instruct.size;
Expand All @@ -8235,10 +8235,10 @@ ia32_instruction& ia32_decode(unsigned int capa, const unsigned char* addr, ia32
return instruct;
}

// printf("OP(%d): ", instruct.size - x);
printf("OP(%d): ", instruct.size - x);

// for(;x < instruct.size;x++)
// printf("%x ", addr_orig[x]);
for(;x < instruct.size;x++)
printf("%x ", addr_orig[x]);

if(!gotit)
assert(!"Didn't find a valid instruction, however decode suceeded.");
Expand All @@ -8249,9 +8249,9 @@ ia32_instruction& ia32_decode(unsigned int capa, const unsigned char* addr, ia32
/* Do the operand decoding */
ia32_decode_operands(pref, *gotit, addr, instruct, instruct.mac);

// printf("OPERANDS(%d): ", instruct.size - x);
// for(;x < instruct.size;x++)
// printf("%x ", addr_orig[x]);
printf("OPERANDS(%d): ", instruct.size - x);
for(;x < instruct.size;x++)
printf("%x ", addr_orig[x]);

/* Decode the memory accesses if requested */
if(capa & IA32_DECODE_MEMACCESS)
Expand Down Expand Up @@ -8316,6 +8316,11 @@ ia32_instruction& ia32_decode(unsigned int capa, const unsigned char* addr, ia32
instruct.mac[0].write = true;
instruct.mac[1].read = true;
break;
case s1R2RW:
instruct.mac[0].read = true;
instruct.mac[1].read = true;
instruct.mac[1].write = true;
break;
case s1RW2RW:
instruct.mac[0].read = true;
instruct.mac[0].write = true;
Expand Down Expand Up @@ -8472,7 +8477,7 @@ ia32_instruction& ia32_decode(unsigned int capa, const unsigned char* addr, ia32

instruct.entry = gotit;

// printf("LEN: %d\n", instruct.size);
printf("LEN: %d\n", instruct.size);
return instruct;
}

Expand Down

0 comments on commit 7f33bd0

Please sign in to comment.