Skip to content
This repository has been archived by the owner on Aug 6, 2023. It is now read-only.

Commit

Permalink
fixed heisenbugs
Browse files Browse the repository at this point in the history
  • Loading branch information
philmb3487 committed Dec 17, 2013
1 parent 21e067a commit f1a4b14
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
5 changes: 5 additions & 0 deletions osfmk/OPEMU/opemu.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,14 @@ int retrieve_reg(/*const*/ x86_saved_state_t *state, const ud_type_t base, uint6

switch (base) {

case UD_NONE:
*where = 0;
break;

// TODO what if 32?
case UD_R_RIP:
*where = ss64 -> isf.rip;
break;

case UD_R_RAX:
*where = ss64 -> rax;
Expand Down
18 changes: 16 additions & 2 deletions osfmk/OPEMU/ssse3.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ int ssse3_grab_operands(ssse3_t *ssse3_obj)
_store_mmx (ssse3_obj->udo_src->base - UD_R_MM0, &ssse3_obj->src.uint64[0]);
} else {
// m64 load
int64_t disp = ssse3_obj->udo_src->lval.sqword;
int64_t disp = 0;
uint8_t disp_size = ssse3_obj->udo_src->offset;
uint64_t address;

Expand All @@ -33,6 +33,13 @@ int ssse3_grab_operands(ssse3_t *ssse3_obj)
if (retrieve_reg (ssse3_obj->op_obj->state,
ssse3_obj->udo_src->base, &address) != 0) goto bad;

switch (disp_size) {
case 8: disp = ssse3_obj->udo_src->lval.sbyte; break;
case 16: disp = ssse3_obj->udo_src->lval.sword; break;
case 32: disp = ssse3_obj->udo_src->lval.sdword; break;
case 64: disp = ssse3_obj->udo_src->lval.sqword; break;
}

address += disp;

if (ssse3_obj->op_obj->ring0)
Expand All @@ -45,7 +52,7 @@ int ssse3_grab_operands(ssse3_t *ssse3_obj)
_store_xmm (ssse3_obj->udo_src->base - UD_R_XMM0, &ssse3_obj->src.uint128);
} else {
// m128 load
int64_t disp = ssse3_obj->udo_src->lval.sqword;
int64_t disp = 0;
uint8_t disp_size = ssse3_obj->udo_src->offset;
uint64_t address;

Expand All @@ -54,6 +61,13 @@ int ssse3_grab_operands(ssse3_t *ssse3_obj)
if (retrieve_reg (ssse3_obj->op_obj->state,
ssse3_obj->udo_src->base, &address) != 0) goto bad;

switch (disp_size) {
case 8: disp = ssse3_obj->udo_src->lval.sbyte; break;
case 16: disp = ssse3_obj->udo_src->lval.sword; break;
case 32: disp = ssse3_obj->udo_src->lval.sdword; break;
case 64: disp = ssse3_obj->udo_src->lval.sqword; break;
}

address += disp;

if (ssse3_obj->op_obj->ring0)
Expand Down

0 comments on commit f1a4b14

Please sign in to comment.