20 #include "x86emu/x86emui.h" 25 void x86emuOp_esc_coprocess_d8(u8 X86EMU_UNUSED(op1))
28 DECODE_PRINTF(
"ESC D8\n");
29 DECODE_CLEAR_SEGOVR();
30 END_OF_INSTR_NO_TRACE();
35 static char *x86emu_fpu_op_d9_tab[] = {
36 "FLD\tDWORD PTR ",
"ESC_D9\t",
"FST\tDWORD PTR ",
"FSTP\tDWORD PTR ",
37 "FLDENV\t",
"FLDCW\t",
"FSTENV\t",
"FSTCW\t",
39 "FLD\tDWORD PTR ",
"ESC_D9\t",
"FST\tDWORD PTR ",
"FSTP\tDWORD PTR ",
40 "FLDENV\t",
"FLDCW\t",
"FSTENV\t",
"FSTCW\t",
42 "FLD\tDWORD PTR ",
"ESC_D9\t",
"FST\tDWORD PTR ",
"FSTP\tDWORD PTR ",
43 "FLDENV\t",
"FLDCW\t",
"FSTENV\t",
"FSTCW\t",
46 static char *x86emu_fpu_op_d9_tab1[] = {
47 "FLD\t",
"FLD\t",
"FLD\t",
"FLD\t",
48 "FLD\t",
"FLD\t",
"FLD\t",
"FLD\t",
50 "FXCH\t",
"FXCH\t",
"FXCH\t",
"FXCH\t",
51 "FXCH\t",
"FXCH\t",
"FXCH\t",
"FXCH\t",
53 "FNOP",
"ESC_D9",
"ESC_D9",
"ESC_D9",
54 "ESC_D9",
"ESC_D9",
"ESC_D9",
"ESC_D9",
56 "FSTP\t",
"FSTP\t",
"FSTP\t",
"FSTP\t",
57 "FSTP\t",
"FSTP\t",
"FSTP\t",
"FSTP\t",
59 "FCHS",
"FABS",
"ESC_D9",
"ESC_D9",
60 "FTST",
"FXAM",
"ESC_D9",
"ESC_D9",
62 "FLD1",
"FLDL2T",
"FLDL2E",
"FLDPI",
63 "FLDLG2",
"FLDLN2",
"FLDZ",
"ESC_D9",
65 "F2XM1",
"FYL2X",
"FPTAN",
"FPATAN",
66 "FXTRACT",
"ESC_D9",
"FDECSTP",
"FINCSTP",
68 "FPREM",
"FYL2XP1",
"FSQRT",
"ESC_D9",
69 "FRNDINT",
"FSCALE",
"ESC_D9",
"ESC_D9",
75 void x86emuOp_esc_coprocess_d9(u8 X86EMU_UNUSED(op1))
82 FETCH_DECODE_MODRM(mod, rh, rl);
86 DECODE_PRINTINSTR32(x86emu_fpu_op_d9_tab, mod, rh, rl);
90 DECODE_PRINTF(x86emu_fpu_op_d9_tab1[(rh << 3) + rl]);
96 destoffset = decode_rm00_address(rl);
100 destoffset = decode_rm01_address(rl);
104 destoffset = decode_rm10_address(rl);
111 DECODE_PRINTF2(
"ST(%d)\n", stkelem);
119 #ifdef X86EMU_FPU_PRESENT 127 x86emu_fpu_R_fld(X86EMU_FPU_STKTOP, stkelem);
130 x86emu_fpu_R_fxch(X86EMU_FPU_STKTOP, stkelem);
139 x86emu_fpu_illegal();
143 x86emu_fpu_R_fstp(X86EMU_FPU_STKTOP, stkelem);
149 x86emu_fpu_R_fchs(X86EMU_FPU_STKTOP);
152 x86emu_fpu_R_fabs(X86EMU_FPU_STKTOP);
155 x86emu_fpu_R_ftst(X86EMU_FPU_STKTOP);
158 x86emu_fpu_R_fxam(X86EMU_FPU_STKTOP);
162 x86emu_fpu_illegal();
171 x86emu_fpu_R_fld1(X86EMU_FPU_STKTOP);
174 x86emu_fpu_R_fldl2t(X86EMU_FPU_STKTOP);
177 x86emu_fpu_R_fldl2e(X86EMU_FPU_STKTOP);
180 x86emu_fpu_R_fldpi(X86EMU_FPU_STKTOP);
183 x86emu_fpu_R_fldlg2(X86EMU_FPU_STKTOP);
186 x86emu_fpu_R_fldln2(X86EMU_FPU_STKTOP);
189 x86emu_fpu_R_fldz(X86EMU_FPU_STKTOP);
193 x86emu_fpu_illegal();
202 x86emu_fpu_R_f2xm1(X86EMU_FPU_STKTOP);
205 x86emu_fpu_R_fyl2x(X86EMU_FPU_STKTOP);
208 x86emu_fpu_R_fptan(X86EMU_FPU_STKTOP);
211 x86emu_fpu_R_fpatan(X86EMU_FPU_STKTOP);
214 x86emu_fpu_R_fxtract(X86EMU_FPU_STKTOP);
217 x86emu_fpu_illegal();
220 x86emu_fpu_R_decstp();
223 x86emu_fpu_R_incstp();
232 x86emu_fpu_R_fprem(X86EMU_FPU_STKTOP);
235 x86emu_fpu_R_fyl2xp1(X86EMU_FPU_STKTOP);
238 x86emu_fpu_R_fsqrt(X86EMU_FPU_STKTOP);
241 x86emu_fpu_illegal();
244 x86emu_fpu_R_frndint(X86EMU_FPU_STKTOP);
247 x86emu_fpu_R_fscale(X86EMU_FPU_STKTOP);
252 x86emu_fpu_illegal();
261 x86emu_fpu_M_fld(X86EMU_FPU_FLOAT, destoffset);
264 x86emu_fpu_illegal();
267 x86emu_fpu_M_fst(X86EMU_FPU_FLOAT, destoffset);
270 x86emu_fpu_M_fstp(X86EMU_FPU_FLOAT, destoffset);
273 x86emu_fpu_M_fldenv(X86EMU_FPU_WORD, destoffset);
276 x86emu_fpu_M_fldcw(X86EMU_FPU_WORD, destoffset);
279 x86emu_fpu_M_fstenv(X86EMU_FPU_WORD, destoffset);
282 x86emu_fpu_M_fstcw(X86EMU_FPU_WORD, destoffset);
291 DECODE_CLEAR_SEGOVR();
292 END_OF_INSTR_NO_TRACE();
297 char *x86emu_fpu_op_da_tab[] = {
298 "FIADD\tDWORD PTR ",
"FIMUL\tDWORD PTR ",
299 "FICOM\tDWORD PTR ",
"FICOMP\tDWORD PTR ",
300 "FISUB\tDWORD PTR ",
"FISUBR\tDWORD PTR ",
301 "FIDIV\tDWORD PTR ",
"FIDIVR\tDWORD PTR ",
303 "FIADD\tDWORD PTR ",
"FIMUL\tDWORD PTR ",
304 "FICOM\tDWORD PTR ",
"FICOMP\tDWORD PTR ",
305 "FISUB\tDWORD PTR ",
"FISUBR\tDWORD PTR ",
306 "FIDIV\tDWORD PTR ",
"FIDIVR\tDWORD PTR ",
308 "FIADD\tDWORD PTR ",
"FIMUL\tDWORD PTR ",
309 "FICOM\tDWORD PTR ",
"FICOMP\tDWORD PTR ",
310 "FISUB\tDWORD PTR ",
"FISUBR\tDWORD PTR ",
311 "FIDIV\tDWORD PTR ",
"FIDIVR\tDWORD PTR ",
313 "ESC_DA ",
"ESC_DA ",
314 "ESC_DA ",
"ESC_DA ",
315 "ESC_DA ",
"ESC_DA ",
316 "ESC_DA ",
"ESC_DA ",
322 void x86emuOp_esc_coprocess_da(u8 X86EMU_UNUSED(op1))
329 FETCH_DECODE_MODRM(mod, rh, rl);
330 DECODE_PRINTINSTR32(x86emu_fpu_op_da_tab, mod, rh, rl);
334 destoffset = decode_rm00_address(rl);
338 destoffset = decode_rm01_address(rl);
342 destoffset = decode_rm10_address(rl);
347 DECODE_PRINTF2(
"\tST(%d),ST\n", stkelem);
350 #ifdef X86EMU_FPU_PRESENT 354 x86emu_fpu_illegal();
360 x86emu_fpu_M_iadd(X86EMU_FPU_SHORT, destoffset);
363 x86emu_fpu_M_imul(X86EMU_FPU_SHORT, destoffset);
366 x86emu_fpu_M_icom(X86EMU_FPU_SHORT, destoffset);
369 x86emu_fpu_M_icomp(X86EMU_FPU_SHORT, destoffset);
372 x86emu_fpu_M_isub(X86EMU_FPU_SHORT, destoffset);
375 x86emu_fpu_M_isubr(X86EMU_FPU_SHORT, destoffset);
378 x86emu_fpu_M_idiv(X86EMU_FPU_SHORT, destoffset);
381 x86emu_fpu_M_idivr(X86EMU_FPU_SHORT, destoffset);
389 DECODE_CLEAR_SEGOVR();
390 END_OF_INSTR_NO_TRACE();
395 char *x86emu_fpu_op_db_tab[] = {
396 "FILD\tDWORD PTR ",
"ESC_DB\t19",
"FIST\tDWORD PTR ",
397 "FISTP\tDWORD PTR ",
"ESC_DB\t1C",
"FLD\tTBYTE PTR ",
398 "ESC_DB\t1E",
"FSTP\tTBYTE PTR ",
400 "FILD\tDWORD PTR ",
"ESC_DB\t19",
"FIST\tDWORD PTR ",
401 "FISTP\tDWORD PTR ",
"ESC_DB\t1C",
"FLD\tTBYTE PTR ",
402 "ESC_DB\t1E",
"FSTP\tTBYTE PTR ",
404 "FILD\tDWORD PTR ",
"ESC_DB\t19",
"FIST\tDWORD PTR ",
405 "FISTP\tDWORD PTR ",
"ESC_DB\t1C",
"FLD\tTBYTE PTR ",
406 "ESC_DB\t1E",
"FSTP\tTBYTE PTR ",
412 void x86emuOp_esc_coprocess_db(u8 X86EMU_UNUSED(op1))
418 FETCH_DECODE_MODRM(mod, rh, rl);
422 DECODE_PRINTINSTR32(x86emu_fpu_op_db_tab, mod, rh, rl);
429 DECODE_PRINTF(
"FENI\n");
432 DECODE_PRINTF(
"FDISI\n");
435 DECODE_PRINTF(
"FCLEX\n");
438 DECODE_PRINTF(
"FINIT\n");
444 DECODE_PRINTF2(
"ESC_DB %0x\n", (mod << 6) + (rh << 3) + (rl));
450 destoffset = decode_rm00_address(rl);
453 destoffset = decode_rm01_address(rl);
456 destoffset = decode_rm10_address(rl);
461 #ifdef X86EMU_FPU_PRESENT 475 x86emu_fpu_R_fdisi();
478 x86emu_fpu_R_fclex();
481 x86emu_fpu_R_finit();
484 x86emu_fpu_illegal();
489 x86emu_fpu_illegal();
497 x86emu_fpu_M_fild(X86EMU_FPU_SHORT, destoffset);
500 x86emu_fpu_illegal();
503 x86emu_fpu_M_fist(X86EMU_FPU_SHORT, destoffset);
506 x86emu_fpu_M_fistp(X86EMU_FPU_SHORT, destoffset);
509 x86emu_fpu_illegal();
512 x86emu_fpu_M_fld(X86EMU_FPU_LDBL, destoffset);
515 x86emu_fpu_illegal();
518 x86emu_fpu_M_fstp(X86EMU_FPU_LDBL, destoffset);
525 DECODE_CLEAR_SEGOVR();
526 END_OF_INSTR_NO_TRACE();
530 char *x86emu_fpu_op_dc_tab[] = {
531 "FADD\tQWORD PTR ",
"FMUL\tQWORD PTR ",
532 "FCOM\tQWORD PTR ",
"FCOMP\tQWORD PTR ",
533 "FSUB\tQWORD PTR ",
"FSUBR\tQWORD PTR ",
534 "FDIV\tQWORD PTR ",
"FDIVR\tQWORD PTR ",
536 "FADD\tQWORD PTR ",
"FMUL\tQWORD PTR ",
537 "FCOM\tQWORD PTR ",
"FCOMP\tQWORD PTR ",
538 "FSUB\tQWORD PTR ",
"FSUBR\tQWORD PTR ",
539 "FDIV\tQWORD PTR ",
"FDIVR\tQWORD PTR ",
541 "FADD\tQWORD PTR ",
"FMUL\tQWORD PTR ",
542 "FCOM\tQWORD PTR ",
"FCOMP\tQWORD PTR ",
543 "FSUB\tQWORD PTR ",
"FSUBR\tQWORD PTR ",
544 "FDIV\tQWORD PTR ",
"FDIVR\tQWORD PTR ",
554 void x86emuOp_esc_coprocess_dc(u8 X86EMU_UNUSED(op1))
561 FETCH_DECODE_MODRM(mod, rh, rl);
562 DECODE_PRINTINSTR32(x86emu_fpu_op_dc_tab, mod, rh, rl);
566 destoffset = decode_rm00_address(rl);
570 destoffset = decode_rm01_address(rl);
574 destoffset = decode_rm10_address(rl);
579 DECODE_PRINTF2(
"\tST(%d),ST\n", stkelem);
582 #ifdef X86EMU_FPU_PRESENT 590 x86emu_fpu_R_fadd(stkelem, X86EMU_FPU_STKTOP);
593 x86emu_fpu_R_fmul(stkelem, X86EMU_FPU_STKTOP);
596 x86emu_fpu_R_fcom(stkelem, X86EMU_FPU_STKTOP);
599 x86emu_fpu_R_fcomp(stkelem, X86EMU_FPU_STKTOP);
602 x86emu_fpu_R_fsubr(stkelem, X86EMU_FPU_STKTOP);
605 x86emu_fpu_R_fsub(stkelem, X86EMU_FPU_STKTOP);
608 x86emu_fpu_R_fdivr(stkelem, X86EMU_FPU_STKTOP);
611 x86emu_fpu_R_fdiv(stkelem, X86EMU_FPU_STKTOP);
619 x86emu_fpu_M_fadd(X86EMU_FPU_DOUBLE, destoffset);
622 x86emu_fpu_M_fmul(X86EMU_FPU_DOUBLE, destoffset);
625 x86emu_fpu_M_fcom(X86EMU_FPU_DOUBLE, destoffset);
628 x86emu_fpu_M_fcomp(X86EMU_FPU_DOUBLE, destoffset);
631 x86emu_fpu_M_fsub(X86EMU_FPU_DOUBLE, destoffset);
634 x86emu_fpu_M_fsubr(X86EMU_FPU_DOUBLE, destoffset);
637 x86emu_fpu_M_fdiv(X86EMU_FPU_DOUBLE, destoffset);
640 x86emu_fpu_M_fdivr(X86EMU_FPU_DOUBLE, destoffset);
648 DECODE_CLEAR_SEGOVR();
649 END_OF_INSTR_NO_TRACE();
654 static char *x86emu_fpu_op_dd_tab[] = {
655 "FLD\tQWORD PTR ",
"ESC_DD\t29,",
"FST\tQWORD PTR ",
"FSTP\tQWORD PTR ",
656 "FRSTOR\t",
"ESC_DD\t2D,",
"FSAVE\t",
"FSTSW\t",
658 "FLD\tQWORD PTR ",
"ESC_DD\t29,",
"FST\tQWORD PTR ",
"FSTP\tQWORD PTR ",
659 "FRSTOR\t",
"ESC_DD\t2D,",
"FSAVE\t",
"FSTSW\t",
661 "FLD\tQWORD PTR ",
"ESC_DD\t29,",
"FST\tQWORD PTR ",
"FSTP\tQWORD PTR ",
662 "FRSTOR\t",
"ESC_DD\t2D,",
"FSAVE\t",
"FSTSW\t",
664 "FFREE\t",
"FXCH\t",
"FST\t",
"FSTP\t",
665 "ESC_DD\t2C,",
"ESC_DD\t2D,",
"ESC_DD\t2E,",
"ESC_DD\t2F,",
671 void x86emuOp_esc_coprocess_dd(u8 X86EMU_UNUSED(op1))
678 FETCH_DECODE_MODRM(mod, rh, rl);
679 DECODE_PRINTINSTR32(x86emu_fpu_op_dd_tab, mod, rh, rl);
683 destoffset = decode_rm00_address(rl);
687 destoffset = decode_rm01_address(rl);
691 destoffset = decode_rm10_address(rl);
696 DECODE_PRINTF2(
"\tST(%d),ST\n", stkelem);
699 #ifdef X86EMU_FPU_PRESENT 706 x86emu_fpu_R_ffree(stkelem);
709 x86emu_fpu_R_fxch(stkelem);
712 x86emu_fpu_R_fst(stkelem);
715 x86emu_fpu_R_fstp(stkelem);
718 x86emu_fpu_illegal();
726 x86emu_fpu_M_fld(X86EMU_FPU_DOUBLE, destoffset);
729 x86emu_fpu_illegal();
732 x86emu_fpu_M_fst(X86EMU_FPU_DOUBLE, destoffset);
735 x86emu_fpu_M_fstp(X86EMU_FPU_DOUBLE, destoffset);
738 x86emu_fpu_M_frstor(X86EMU_FPU_WORD, destoffset);
741 x86emu_fpu_illegal();
744 x86emu_fpu_M_fsave(X86EMU_FPU_WORD, destoffset);
747 x86emu_fpu_M_fstsw(X86EMU_FPU_WORD, destoffset);
755 DECODE_CLEAR_SEGOVR();
756 END_OF_INSTR_NO_TRACE();
761 static char *x86emu_fpu_op_de_tab[] = {
762 "FIADD\tWORD PTR ",
"FIMUL\tWORD PTR ",
"FICOM\tWORD PTR ",
763 "FICOMP\tWORD PTR ",
"FISUB\tWORD PTR ",
"FISUBR\tWORD PTR ",
764 "FIDIV\tWORD PTR ",
"FIDIVR\tWORD PTR ",
766 "FIADD\tWORD PTR ",
"FIMUL\tWORD PTR ",
"FICOM\tWORD PTR ",
767 "FICOMP\tWORD PTR ",
"FISUB\tWORD PTR ",
"FISUBR\tWORD PTR ",
768 "FIDIV\tWORD PTR ",
"FIDIVR\tWORD PTR ",
770 "FIADD\tWORD PTR ",
"FIMUL\tWORD PTR ",
"FICOM\tWORD PTR ",
771 "FICOMP\tWORD PTR ",
"FISUB\tWORD PTR ",
"FISUBR\tWORD PTR ",
772 "FIDIV\tWORD PTR ",
"FIDIVR\tWORD PTR ",
774 "FADDP\t",
"FMULP\t",
"FCOMP\t",
775 "FCOMPP\t",
"FSUBRP\t",
"FSUBP\t",
776 "FDIVRP\t",
"FDIVP\t",
782 void x86emuOp_esc_coprocess_de(u8 X86EMU_UNUSED(op1))
789 FETCH_DECODE_MODRM(mod, rh, rl);
790 DECODE_PRINTINSTR32(x86emu_fpu_op_de_tab, mod, rh, rl);
794 destoffset = decode_rm00_address(rl);
798 destoffset = decode_rm01_address(rl);
802 destoffset = decode_rm10_address(rl);
807 DECODE_PRINTF2(
"\tST(%d),ST\n", stkelem);
810 #ifdef X86EMU_FPU_PRESENT 817 x86emu_fpu_R_faddp(stkelem, X86EMU_FPU_STKTOP);
820 x86emu_fpu_R_fmulp(stkelem, X86EMU_FPU_STKTOP);
823 x86emu_fpu_R_fcomp(stkelem, X86EMU_FPU_STKTOP);
827 x86emu_fpu_R_fcompp(stkelem, X86EMU_FPU_STKTOP);
829 x86emu_fpu_illegal();
832 x86emu_fpu_R_fsubrp(stkelem, X86EMU_FPU_STKTOP);
835 x86emu_fpu_R_fsubp(stkelem, X86EMU_FPU_STKTOP);
838 x86emu_fpu_R_fdivrp(stkelem, X86EMU_FPU_STKTOP);
841 x86emu_fpu_R_fdivp(stkelem, X86EMU_FPU_STKTOP);
849 x86emu_fpu_M_fiadd(X86EMU_FPU_WORD, destoffset);
852 x86emu_fpu_M_fimul(X86EMU_FPU_WORD, destoffset);
855 x86emu_fpu_M_ficom(X86EMU_FPU_WORD, destoffset);
858 x86emu_fpu_M_ficomp(X86EMU_FPU_WORD, destoffset);
861 x86emu_fpu_M_fisub(X86EMU_FPU_WORD, destoffset);
864 x86emu_fpu_M_fisubr(X86EMU_FPU_WORD, destoffset);
867 x86emu_fpu_M_fidiv(X86EMU_FPU_WORD, destoffset);
870 x86emu_fpu_M_fidivr(X86EMU_FPU_WORD, destoffset);
878 DECODE_CLEAR_SEGOVR();
879 END_OF_INSTR_NO_TRACE();
884 static char *x86emu_fpu_op_df_tab[] = {
886 "FILD\tWORD PTR ",
"ESC_DF\t39\n",
"FIST\tWORD PTR ",
"FISTP\tWORD PTR ",
887 "FBLD\tTBYTE PTR ",
"FILD\tQWORD PTR ",
"FBSTP\tTBYTE PTR ",
891 "FILD\tWORD PTR ",
"ESC_DF\t39 ",
"FIST\tWORD PTR ",
"FISTP\tWORD PTR ",
892 "FBLD\tTBYTE PTR ",
"FILD\tQWORD PTR ",
"FBSTP\tTBYTE PTR ",
896 "FILD\tWORD PTR ",
"ESC_DF\t39 ",
"FIST\tWORD PTR ",
"FISTP\tWORD PTR ",
897 "FBLD\tTBYTE PTR ",
"FILD\tQWORD PTR ",
"FBSTP\tTBYTE PTR ",
901 "FFREE\t",
"FXCH\t",
"FST\t",
"FSTP\t",
"ESC_DF\t3C,",
"ESC_DF\t3D,",
902 "ESC_DF\t3E,",
"ESC_DF\t3F,"};
907 void x86emuOp_esc_coprocess_df(u8 X86EMU_UNUSED(op1))
914 FETCH_DECODE_MODRM(mod, rh, rl);
915 DECODE_PRINTINSTR32(x86emu_fpu_op_df_tab, mod, rh, rl);
919 destoffset = decode_rm00_address(rl);
923 destoffset = decode_rm01_address(rl);
927 destoffset = decode_rm10_address(rl);
932 DECODE_PRINTF2(
"\tST(%d)\n", stkelem);
935 #ifdef X86EMU_FPU_PRESENT 942 x86emu_fpu_R_ffree(stkelem);
945 x86emu_fpu_R_fxch(stkelem);
948 x86emu_fpu_R_fst(stkelem);
951 x86emu_fpu_R_fstp(stkelem);
954 x86emu_fpu_illegal();
962 x86emu_fpu_M_fild(X86EMU_FPU_WORD, destoffset);
965 x86emu_fpu_illegal();
968 x86emu_fpu_M_fist(X86EMU_FPU_WORD, destoffset);
971 x86emu_fpu_M_fistp(X86EMU_FPU_WORD, destoffset);
974 x86emu_fpu_M_fbld(X86EMU_FPU_BSD, destoffset);
977 x86emu_fpu_M_fild(X86EMU_FPU_LONG, destoffset);
980 x86emu_fpu_M_fbstp(X86EMU_FPU_BSD, destoffset);
983 x86emu_fpu_M_fistp(X86EMU_FPU_LONG, destoffset);
991 DECODE_CLEAR_SEGOVR();
992 END_OF_INSTR_NO_TRACE();