Created by: pmeerw
fnstenv and fnsave store the pc of the last floating point instruction in the FPU operating environment
to maintain transparency, the pc needs to be replaced with the original app pc
the case when an operand-size override is given is not handled (16-bit pc, 14 bytes FPU operating environment)
Activity
2718 2719 /* Replace the stored code cache pc with the original app pc. 2719 2720 * If the app memory is unwritable, instr would have already crashed. 2720 2721 */ 2721 if (op == OP_fnsave || op == OP_fnstenv) { 2722 opnd_set_disp(&memop, opnd_get_disp(memop) + FNSAVE_PC_OFFS); 2722 if ((op == OP_fnsave || op == OP_fnstenv) && opnd_get_size(memop) == OPSZ_28) { 2723 opnd_set_disp(&memop, opnd_get_disp(memop) + FNSAVE_PC_OFFS_28); 2723 2724 opnd_set_size(&memop, OPSZ_4); 2724 2725 PRE(ilist, next_instr, 2725 2726 INSTR_CREATE_mov_st(dcontext, memop, 2726 2727 OPND_CREATE_INT32((int)(ptr_int_t)prior_float))); 2728 } else if ((op == OP_fnsave || op == OP_fnstenv) && opnd_get_size(memop) == OPSZ_14) { 2718 2719 /* Replace the stored code cache pc with the original app pc. 2719 2720 * If the app memory is unwritable, instr would have already crashed. 2720 2721 */ 2721 if (op == OP_fnsave || op == OP_fnstenv) { 2722 opnd_set_disp(&memop, opnd_get_disp(memop) + FNSAVE_PC_OFFS); 2722 if ((op == OP_fnsave || op == OP_fnstenv) && opnd_get_size(memop) == OPSZ_28) { 2723 opnd_set_disp(&memop, opnd_get_disp(memop) + FNSAVE_PC_OFFS_28); 2723 2724 opnd_set_size(&memop, OPSZ_4); 2724 2725 PRE(ilist, next_instr, 2725 2726 INSTR_CREATE_mov_st(dcontext, memop, 2726 2727 OPND_CREATE_INT32((int)(ptr_int_t)prior_float))); 2728 } else if ((op == OP_fnsave || op == OP_fnstenv) && opnd_get_size(memop) == OPSZ_14) {
Please register or sign in to reply