1 /****************************************************************************
3 * Realmode X86 Emulator Library
5 * Copyright (C) 2007 Freescale Semiconductor, Inc.
6 * Jason Jin <Jason.jin@freescale.com>
8 * Copyright (C) 1991-2004 SciTech Software, Inc.
9 * Copyright (C) David Mosberger-Tang
10 * Copyright (C) 1999 Egbert Eich
12 * ========================================================================
14 * Permission to use, copy, modify, distribute, and sell this software and
15 * its documentation for any purpose is hereby granted without fee,
16 * provided that the above copyright notice appear in all copies and that
17 * both that copyright notice and this permission notice appear in
18 * supporting documentation, and that the name of the authors not be used
19 * in advertising or publicity pertaining to distribution of the software
20 * without specific, written prior permission. The authors makes no
21 * representations about the suitability of this software for any purpose.
22 * It is provided "as is" without express or implied warranty.
24 * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
25 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
26 * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
27 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
28 * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
29 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
30 * PERFORMANCE OF THIS SOFTWARE.
32 * ========================================================================
36 * Developer: Kendall Bennett
38 * Description: This file includes subroutines to implement the decoding
39 * and emulation of all the x86 extended two-byte processor
42 ****************************************************************************/
45 #include "x86emu/x86emui.h"
47 /*----------------------------- Implementation ----------------------------*/
49 /****************************************************************************
51 op1 - Instruction op code
54 Handles illegal opcodes.
55 ****************************************************************************/
56 void x86emuOp2_illegal_op(
60 DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n");
62 printk("%04x:%04x: %02X ILLEGAL EXTENDED X86 OPCODE!\n",
63 M.x86.R_CS, M.x86.R_IP-2,op2);
68 #define xorl(a,b) ((a) && !(b)) || (!(a) && (b))
70 /****************************************************************************
72 Handles opcode 0x0f,0x80-0x8F
73 ****************************************************************************/
74 int x86emu_check_jump_condition(u8 op)
78 DECODE_PRINTF("JO\t");
79 return ACCESS_FLAG(F_OF);
81 DECODE_PRINTF("JNO\t");
82 return !ACCESS_FLAG(F_OF);
85 DECODE_PRINTF("JB\t");
86 return ACCESS_FLAG(F_CF);
89 DECODE_PRINTF("JNB\t");
90 return !ACCESS_FLAG(F_CF);
93 DECODE_PRINTF("JZ\t");
94 return ACCESS_FLAG(F_ZF);
97 DECODE_PRINTF("JNZ\t");
98 return !ACCESS_FLAG(F_ZF);
101 DECODE_PRINTF("JBE\t");
102 return ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF);
105 DECODE_PRINTF("JNBE\t");
106 return !(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF));
109 DECODE_PRINTF("JS\t");
110 return ACCESS_FLAG(F_SF);
113 DECODE_PRINTF("JNS\t");
114 return !ACCESS_FLAG(F_SF);
117 DECODE_PRINTF("JP\t");
118 return ACCESS_FLAG(F_PF);
121 DECODE_PRINTF("JNP\t");
122 return !ACCESS_FLAG(F_PF);
125 DECODE_PRINTF("JL\t");
126 return xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
129 DECODE_PRINTF("JNL\t");
130 return !xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
133 DECODE_PRINTF("JLE\t");
134 return (xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
138 DECODE_PRINTF("JNLE\t");
139 return !(xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
144 void x86emuOp2_long_jump(u8 op2)
149 /* conditional jump to word offset. */
151 cond = x86emu_check_jump_condition(op2 & 0xF);
152 target = (s16) fetch_word_imm();
153 target += (s16) M.x86.R_IP;
154 DECODE_PRINTF2("%04x\n", target);
157 M.x86.R_IP = (u16)target;
158 DECODE_CLEAR_SEGOVR();
162 /****************************************************************************
164 Handles opcode 0x0f,0x90-0x9F
165 ****************************************************************************/
166 void x86emuOp2_set_byte(u8 op2)
178 cond = ACCESS_FLAG(F_OF);
182 cond = !ACCESS_FLAG(F_OF);
186 cond = ACCESS_FLAG(F_CF);
190 cond = !ACCESS_FLAG(F_CF);
194 cond = ACCESS_FLAG(F_ZF);
198 cond = !ACCESS_FLAG(F_ZF);
202 cond = ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF);
206 cond = !(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF));
210 cond = ACCESS_FLAG(F_SF);
214 cond = !ACCESS_FLAG(F_SF);
218 cond = ACCESS_FLAG(F_PF);
222 cond = !ACCESS_FLAG(F_PF);
226 cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
230 cond = !xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
234 cond = (xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
239 cond = !(xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
244 FETCH_DECODE_MODRM(mod, rh, rl);
246 destoffset = decode_rmXX_address(mod, rl);
248 store_data_byte(destoffset, cond ? 0x01 : 0x00);
249 } else { /* register to register */
250 destreg = DECODE_RM_BYTE_REGISTER(rl);
252 *destreg = cond ? 0x01 : 0x00;
254 DECODE_CLEAR_SEGOVR();
258 /****************************************************************************
260 Handles opcode 0x0f,0xa0
261 ****************************************************************************/
262 void x86emuOp2_push_FS(u8 X86EMU_UNUSED(op2))
265 DECODE_PRINTF("PUSH\tFS\n");
267 push_word(M.x86.R_FS);
268 DECODE_CLEAR_SEGOVR();
272 /****************************************************************************
274 Handles opcode 0x0f,0xa1
275 ****************************************************************************/
276 void x86emuOp2_pop_FS(u8 X86EMU_UNUSED(op2))
279 DECODE_PRINTF("POP\tFS\n");
281 M.x86.R_FS = pop_word();
282 DECODE_CLEAR_SEGOVR();
286 /****************************************************************************
288 Handles opcode 0x0f,0xa3
289 ****************************************************************************/
290 void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
297 DECODE_PRINTF("BT\t");
298 FETCH_DECODE_MODRM(mod, rh, rl);
300 srcoffset = decode_rmXX_address(mod, rl);
301 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
306 shiftreg = DECODE_RM_LONG_REGISTER(rh);
308 bit = *shiftreg & 0x1F;
309 disp = (s16)*shiftreg >> 5;
310 srcval = fetch_data_long(srcoffset+disp);
311 CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
317 shiftreg = DECODE_RM_WORD_REGISTER(rh);
319 bit = *shiftreg & 0xF;
320 disp = (s16)*shiftreg >> 4;
321 srcval = fetch_data_word(srcoffset+disp);
322 CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
324 } else { /* register to register */
325 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
326 u32 *srcreg,*shiftreg;
328 srcreg = DECODE_RM_LONG_REGISTER(rl);
330 shiftreg = DECODE_RM_LONG_REGISTER(rh);
332 bit = *shiftreg & 0x1F;
333 CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit),F_CF);
335 u16 *srcreg,*shiftreg;
337 srcreg = DECODE_RM_WORD_REGISTER(rl);
339 shiftreg = DECODE_RM_WORD_REGISTER(rh);
341 bit = *shiftreg & 0xF;
342 CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit),F_CF);
345 DECODE_CLEAR_SEGOVR();
349 /****************************************************************************
351 Handles opcode 0x0f,0xa4
352 ****************************************************************************/
353 void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
360 DECODE_PRINTF("SHLD\t");
361 FETCH_DECODE_MODRM(mod, rh, rl);
363 destoffset = decode_rmXX_address(mod, rl);
364 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
369 shiftreg = DECODE_RM_LONG_REGISTER(rh);
371 shift = fetch_byte_imm();
372 DECODE_PRINTF2("%d\n", shift);
374 destval = fetch_data_long(destoffset);
375 destval = shld_long(destval,*shiftreg,shift);
376 store_data_long(destoffset, destval);
382 shiftreg = DECODE_RM_WORD_REGISTER(rh);
384 shift = fetch_byte_imm();
385 DECODE_PRINTF2("%d\n", shift);
387 destval = fetch_data_word(destoffset);
388 destval = shld_word(destval,*shiftreg,shift);
389 store_data_word(destoffset, destval);
391 } else { /* register to register */
392 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
393 u32 *destreg,*shiftreg;
395 destreg = DECODE_RM_LONG_REGISTER(rl);
397 shiftreg = DECODE_RM_LONG_REGISTER(rh);
399 shift = fetch_byte_imm();
400 DECODE_PRINTF2("%d\n", shift);
402 *destreg = shld_long(*destreg,*shiftreg,shift);
404 u16 *destreg,*shiftreg;
406 destreg = DECODE_RM_WORD_REGISTER(rl);
408 shiftreg = DECODE_RM_WORD_REGISTER(rh);
410 shift = fetch_byte_imm();
411 DECODE_PRINTF2("%d\n", shift);
413 *destreg = shld_word(*destreg,*shiftreg,shift);
416 DECODE_CLEAR_SEGOVR();
420 /****************************************************************************
422 Handles opcode 0x0f,0xa5
423 ****************************************************************************/
424 void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
430 DECODE_PRINTF("SHLD\t");
431 FETCH_DECODE_MODRM(mod, rh, rl);
433 destoffset = decode_rmXX_address(mod, rl);
434 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
439 shiftreg = DECODE_RM_LONG_REGISTER(rh);
440 DECODE_PRINTF(",CL\n");
442 destval = fetch_data_long(destoffset);
443 destval = shld_long(destval,*shiftreg,M.x86.R_CL);
444 store_data_long(destoffset, destval);
450 shiftreg = DECODE_RM_WORD_REGISTER(rh);
451 DECODE_PRINTF(",CL\n");
453 destval = fetch_data_word(destoffset);
454 destval = shld_word(destval,*shiftreg,M.x86.R_CL);
455 store_data_word(destoffset, destval);
457 } else { /* register to register */
458 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
459 u32 *destreg,*shiftreg;
461 destreg = DECODE_RM_LONG_REGISTER(rl);
463 shiftreg = DECODE_RM_LONG_REGISTER(rh);
464 DECODE_PRINTF(",CL\n");
466 *destreg = shld_long(*destreg,*shiftreg,M.x86.R_CL);
468 u16 *destreg,*shiftreg;
470 destreg = DECODE_RM_WORD_REGISTER(rl);
472 shiftreg = DECODE_RM_WORD_REGISTER(rh);
473 DECODE_PRINTF(",CL\n");
475 *destreg = shld_word(*destreg,*shiftreg,M.x86.R_CL);
478 DECODE_CLEAR_SEGOVR();
482 /****************************************************************************
484 Handles opcode 0x0f,0xa8
485 ****************************************************************************/
486 void x86emuOp2_push_GS(u8 X86EMU_UNUSED(op2))
489 DECODE_PRINTF("PUSH\tGS\n");
491 push_word(M.x86.R_GS);
492 DECODE_CLEAR_SEGOVR();
496 /****************************************************************************
498 Handles opcode 0x0f,0xa9
499 ****************************************************************************/
500 void x86emuOp2_pop_GS(u8 X86EMU_UNUSED(op2))
503 DECODE_PRINTF("POP\tGS\n");
505 M.x86.R_GS = pop_word();
506 DECODE_CLEAR_SEGOVR();
510 /****************************************************************************
512 Handles opcode 0x0f,0xaa
513 ****************************************************************************/
514 void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
521 DECODE_PRINTF("BTS\t");
522 FETCH_DECODE_MODRM(mod, rh, rl);
524 srcoffset = decode_rmXX_address(mod, rl);
525 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
530 shiftreg = DECODE_RM_LONG_REGISTER(rh);
532 bit = *shiftreg & 0x1F;
533 disp = (s16)*shiftreg >> 5;
534 srcval = fetch_data_long(srcoffset+disp);
536 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
537 store_data_long(srcoffset+disp, srcval | mask);
543 shiftreg = DECODE_RM_WORD_REGISTER(rh);
545 bit = *shiftreg & 0xF;
546 disp = (s16)*shiftreg >> 4;
547 srcval = fetch_data_word(srcoffset+disp);
548 mask = (u16)(0x1 << bit);
549 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
550 store_data_word(srcoffset+disp, srcval | mask);
552 } else { /* register to register */
553 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
554 u32 *srcreg,*shiftreg;
557 srcreg = DECODE_RM_LONG_REGISTER(rl);
559 shiftreg = DECODE_RM_LONG_REGISTER(rh);
561 bit = *shiftreg & 0x1F;
563 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
566 u16 *srcreg,*shiftreg;
569 srcreg = DECODE_RM_WORD_REGISTER(rl);
571 shiftreg = DECODE_RM_WORD_REGISTER(rh);
573 bit = *shiftreg & 0xF;
574 mask = (u16)(0x1 << bit);
575 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
579 DECODE_CLEAR_SEGOVR();
583 /****************************************************************************
585 Handles opcode 0x0f,0xac
586 ****************************************************************************/
587 void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
594 DECODE_PRINTF("SHLD\t");
595 FETCH_DECODE_MODRM(mod, rh, rl);
597 destoffset = decode_rmXX_address(mod, rl);
598 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
603 shiftreg = DECODE_RM_LONG_REGISTER(rh);
605 shift = fetch_byte_imm();
606 DECODE_PRINTF2("%d\n", shift);
608 destval = fetch_data_long(destoffset);
609 destval = shrd_long(destval,*shiftreg,shift);
610 store_data_long(destoffset, destval);
616 shiftreg = DECODE_RM_WORD_REGISTER(rh);
618 shift = fetch_byte_imm();
619 DECODE_PRINTF2("%d\n", shift);
621 destval = fetch_data_word(destoffset);
622 destval = shrd_word(destval,*shiftreg,shift);
623 store_data_word(destoffset, destval);
625 } else { /* register to register */
626 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
627 u32 *destreg,*shiftreg;
629 destreg = DECODE_RM_LONG_REGISTER(rl);
631 shiftreg = DECODE_RM_LONG_REGISTER(rh);
633 shift = fetch_byte_imm();
634 DECODE_PRINTF2("%d\n", shift);
636 *destreg = shrd_long(*destreg,*shiftreg,shift);
638 u16 *destreg,*shiftreg;
640 destreg = DECODE_RM_WORD_REGISTER(rl);
642 shiftreg = DECODE_RM_WORD_REGISTER(rh);
644 shift = fetch_byte_imm();
645 DECODE_PRINTF2("%d\n", shift);
647 *destreg = shrd_word(*destreg,*shiftreg,shift);
650 DECODE_CLEAR_SEGOVR();
654 /****************************************************************************
656 Handles opcode 0x0f,0xad
657 ****************************************************************************/
658 void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
664 DECODE_PRINTF("SHLD\t");
665 FETCH_DECODE_MODRM(mod, rh, rl);
667 destoffset = decode_rmXX_address(mod, rl);
669 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
673 shiftreg = DECODE_RM_LONG_REGISTER(rh);
674 DECODE_PRINTF(",CL\n");
676 destval = fetch_data_long(destoffset);
677 destval = shrd_long(destval,*shiftreg,M.x86.R_CL);
678 store_data_long(destoffset, destval);
683 shiftreg = DECODE_RM_WORD_REGISTER(rh);
684 DECODE_PRINTF(",CL\n");
686 destval = fetch_data_word(destoffset);
687 destval = shrd_word(destval,*shiftreg,M.x86.R_CL);
688 store_data_word(destoffset, destval);
690 } else { /* register to register */
691 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
692 u32 *destreg,*shiftreg;
694 destreg = DECODE_RM_LONG_REGISTER(rl);
696 shiftreg = DECODE_RM_LONG_REGISTER(rh);
697 DECODE_PRINTF(",CL\n");
699 *destreg = shrd_long(*destreg,*shiftreg,M.x86.R_CL);
701 u16 *destreg,*shiftreg;
703 destreg = DECODE_RM_WORD_REGISTER(rl);
705 shiftreg = DECODE_RM_WORD_REGISTER(rh);
706 DECODE_PRINTF(",CL\n");
708 *destreg = shrd_word(*destreg,*shiftreg,M.x86.R_CL);
711 DECODE_CLEAR_SEGOVR();
715 /****************************************************************************
717 Handles opcode 0x0f,0xaf
718 ****************************************************************************/
719 void x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
725 DECODE_PRINTF("IMUL\t");
726 FETCH_DECODE_MODRM(mod, rh, rl);
728 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
733 destreg = DECODE_RM_LONG_REGISTER(rh);
735 srcoffset = decode_rmXX_address(mod, rl);
736 srcval = fetch_data_long(srcoffset);
738 imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)srcval);
746 *destreg = (u32)res_lo;
752 destreg = DECODE_RM_WORD_REGISTER(rh);
754 srcoffset = decode_rmXX_address(mod, rl);
755 srcval = fetch_data_word(srcoffset);
757 res = (s16)*destreg * (s16)srcval;
767 } else { /* register to register */
768 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
769 u32 *destreg,*srcreg;
772 destreg = DECODE_RM_LONG_REGISTER(rh);
774 srcreg = DECODE_RM_LONG_REGISTER(rl);
776 imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)*srcreg);
784 *destreg = (u32)res_lo;
786 u16 *destreg,*srcreg;
789 destreg = DECODE_RM_WORD_REGISTER(rh);
791 srcreg = DECODE_RM_WORD_REGISTER(rl);
792 res = (s16)*destreg * (s16)*srcreg;
803 DECODE_CLEAR_SEGOVR();
807 /****************************************************************************
809 Handles opcode 0x0f,0xb2
810 ****************************************************************************/
811 void x86emuOp2_lss_R_IMM(u8 X86EMU_UNUSED(op2))
818 DECODE_PRINTF("LSS\t");
819 FETCH_DECODE_MODRM(mod, rh, rl);
821 dstreg = DECODE_RM_WORD_REGISTER(rh);
823 srcoffset = decode_rmXX_address(mod, rl);
826 *dstreg = fetch_data_word(srcoffset);
827 M.x86.R_SS = fetch_data_word(srcoffset + 2);
828 } else { /* register to register */
832 DECODE_CLEAR_SEGOVR();
836 /****************************************************************************
838 Handles opcode 0x0f,0xb3
839 ****************************************************************************/
840 void x86emuOp2_btr_R(u8 X86EMU_UNUSED(op2))
847 DECODE_PRINTF("BTR\t");
848 FETCH_DECODE_MODRM(mod, rh, rl);
850 srcoffset = decode_rmXX_address(mod, rl);
852 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
856 shiftreg = DECODE_RM_LONG_REGISTER(rh);
858 bit = *shiftreg & 0x1F;
859 disp = (s16)*shiftreg >> 5;
860 srcval = fetch_data_long(srcoffset+disp);
862 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
863 store_data_long(srcoffset+disp, srcval & ~mask);
868 shiftreg = DECODE_RM_WORD_REGISTER(rh);
870 bit = *shiftreg & 0xF;
871 disp = (s16)*shiftreg >> 4;
872 srcval = fetch_data_word(srcoffset+disp);
873 mask = (u16)(0x1 << bit);
874 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
875 store_data_word(srcoffset+disp, (u16)(srcval & ~mask));
877 } else { /* register to register */
878 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
879 u32 *srcreg,*shiftreg;
882 srcreg = DECODE_RM_LONG_REGISTER(rl);
884 shiftreg = DECODE_RM_LONG_REGISTER(rh);
886 bit = *shiftreg & 0x1F;
888 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
891 u16 *srcreg,*shiftreg;
894 srcreg = DECODE_RM_WORD_REGISTER(rl);
896 shiftreg = DECODE_RM_WORD_REGISTER(rh);
898 bit = *shiftreg & 0xF;
899 mask = (u16)(0x1 << bit);
900 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
904 DECODE_CLEAR_SEGOVR();
908 /****************************************************************************
910 Handles opcode 0x0f,0xb4
911 ****************************************************************************/
912 void x86emuOp2_lfs_R_IMM(u8 X86EMU_UNUSED(op2))
919 DECODE_PRINTF("LFS\t");
920 FETCH_DECODE_MODRM(mod, rh, rl);
922 dstreg = DECODE_RM_WORD_REGISTER(rh);
924 srcoffset = decode_rmXX_address(mod, rl);
927 *dstreg = fetch_data_word(srcoffset);
928 M.x86.R_FS = fetch_data_word(srcoffset + 2);
929 } else { /* register to register */
933 DECODE_CLEAR_SEGOVR();
937 /****************************************************************************
939 Handles opcode 0x0f,0xb5
940 ****************************************************************************/
941 void x86emuOp2_lgs_R_IMM(u8 X86EMU_UNUSED(op2))
948 DECODE_PRINTF("LGS\t");
949 FETCH_DECODE_MODRM(mod, rh, rl);
951 dstreg = DECODE_RM_WORD_REGISTER(rh);
953 srcoffset = decode_rmXX_address(mod, rl);
956 *dstreg = fetch_data_word(srcoffset);
957 M.x86.R_GS = fetch_data_word(srcoffset + 2);
958 } else { /* register to register */
962 DECODE_CLEAR_SEGOVR();
966 /****************************************************************************
968 Handles opcode 0x0f,0xb6
969 ****************************************************************************/
970 void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
976 DECODE_PRINTF("MOVZX\t");
977 FETCH_DECODE_MODRM(mod, rh, rl);
979 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
983 destreg = DECODE_RM_LONG_REGISTER(rh);
985 srcoffset = decode_rmXX_address(mod, rl);
986 srcval = fetch_data_byte(srcoffset);
994 destreg = DECODE_RM_WORD_REGISTER(rh);
996 srcoffset = decode_rmXX_address(mod, rl);
997 srcval = fetch_data_byte(srcoffset);
1002 } else { /* register to register */
1003 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1007 destreg = DECODE_RM_LONG_REGISTER(rh);
1009 srcreg = DECODE_RM_BYTE_REGISTER(rl);
1010 DECODE_PRINTF("\n");
1017 destreg = DECODE_RM_WORD_REGISTER(rh);
1019 srcreg = DECODE_RM_BYTE_REGISTER(rl);
1020 DECODE_PRINTF("\n");
1025 DECODE_CLEAR_SEGOVR();
1029 /****************************************************************************
1031 Handles opcode 0x0f,0xb7
1032 ****************************************************************************/
1033 void x86emuOp2_movzx_word_R_RM(u8 X86EMU_UNUSED(op2))
1042 DECODE_PRINTF("MOVZX\t");
1043 FETCH_DECODE_MODRM(mod, rh, rl);
1045 destreg = DECODE_RM_LONG_REGISTER(rh);
1047 srcoffset = decode_rmXX_address(mod, rl);
1048 srcval = fetch_data_word(srcoffset);
1049 DECODE_PRINTF("\n");
1052 } else { /* register to register */
1053 destreg = DECODE_RM_LONG_REGISTER(rh);
1055 srcreg = DECODE_RM_WORD_REGISTER(rl);
1056 DECODE_PRINTF("\n");
1060 DECODE_CLEAR_SEGOVR();
1064 /****************************************************************************
1066 Handles opcode 0x0f,0xba
1067 ****************************************************************************/
1068 void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
1076 FETCH_DECODE_MODRM(mod, rh, rl);
1079 DECODE_PRINTF("BT\t");
1082 DECODE_PRINTF("BTS\t");
1085 DECODE_PRINTF("BTR\t");
1088 DECODE_PRINTF("BTC\t");
1091 DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n");
1093 printk("%04x:%04x: %02X%02X ILLEGAL EXTENDED X86 OPCODE EXTENSION!\n",
1094 M.x86.R_CS, M.x86.R_IP-3,op2, (mod<<6)|(rh<<3)|rl);
1099 srcoffset = decode_rmXX_address(mod, rl);
1100 shift = fetch_byte_imm();
1101 DECODE_PRINTF2(",%d\n", shift);
1104 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1108 srcval = fetch_data_long(srcoffset);
1109 mask = (0x1 << bit);
1110 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
1113 store_data_long(srcoffset, srcval | mask);
1116 store_data_long(srcoffset, srcval & ~mask);
1119 store_data_long(srcoffset, srcval ^ mask);
1128 srcval = fetch_data_word(srcoffset);
1129 mask = (0x1 << bit);
1130 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
1133 store_data_word(srcoffset, srcval | mask);
1136 store_data_word(srcoffset, srcval & ~mask);
1139 store_data_word(srcoffset, srcval ^ mask);
1145 } else { /* register to register */
1146 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1150 srcreg = DECODE_RM_LONG_REGISTER(rl);
1151 shift = fetch_byte_imm();
1152 DECODE_PRINTF2(",%d\n", shift);
1155 mask = (0x1 << bit);
1156 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
1174 srcreg = DECODE_RM_WORD_REGISTER(rl);
1175 shift = fetch_byte_imm();
1176 DECODE_PRINTF2(",%d\n", shift);
1179 mask = (0x1 << bit);
1180 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
1196 DECODE_CLEAR_SEGOVR();
1200 /****************************************************************************
1202 Handles opcode 0x0f,0xbb
1203 ****************************************************************************/
1204 void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
1211 DECODE_PRINTF("BTC\t");
1212 FETCH_DECODE_MODRM(mod, rh, rl);
1214 srcoffset = decode_rmXX_address(mod, rl);
1216 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1220 shiftreg = DECODE_RM_LONG_REGISTER(rh);
1222 bit = *shiftreg & 0x1F;
1223 disp = (s16)*shiftreg >> 5;
1224 srcval = fetch_data_long(srcoffset+disp);
1225 mask = (0x1 << bit);
1226 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
1227 store_data_long(srcoffset+disp, srcval ^ mask);
1232 shiftreg = DECODE_RM_WORD_REGISTER(rh);
1234 bit = *shiftreg & 0xF;
1235 disp = (s16)*shiftreg >> 4;
1236 srcval = fetch_data_word(srcoffset+disp);
1237 mask = (u16)(0x1 << bit);
1238 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
1239 store_data_word(srcoffset+disp, (u16)(srcval ^ mask));
1241 } else { /* register to register */
1242 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1243 u32 *srcreg,*shiftreg;
1246 srcreg = DECODE_RM_LONG_REGISTER(rl);
1248 shiftreg = DECODE_RM_LONG_REGISTER(rh);
1250 bit = *shiftreg & 0x1F;
1251 mask = (0x1 << bit);
1252 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
1255 u16 *srcreg,*shiftreg;
1258 srcreg = DECODE_RM_WORD_REGISTER(rl);
1260 shiftreg = DECODE_RM_WORD_REGISTER(rh);
1262 bit = *shiftreg & 0xF;
1263 mask = (u16)(0x1 << bit);
1264 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
1268 DECODE_CLEAR_SEGOVR();
1272 /****************************************************************************
1274 Handles opcode 0x0f,0xbc
1275 ****************************************************************************/
1276 void x86emuOp2_bsf(u8 X86EMU_UNUSED(op2))
1282 DECODE_PRINTF("BSF\n");
1283 FETCH_DECODE_MODRM(mod, rh, rl);
1285 srcoffset = decode_rmXX_address(mod, rl);
1287 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1288 u32 srcval, *dstreg;
1290 dstreg = DECODE_RM_LONG_REGISTER(rh);
1292 srcval = fetch_data_long(srcoffset);
1293 CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
1294 for(*dstreg = 0; *dstreg < 32; (*dstreg)++)
1295 if ((srcval >> *dstreg) & 1) break;
1297 u16 srcval, *dstreg;
1299 dstreg = DECODE_RM_WORD_REGISTER(rh);
1301 srcval = fetch_data_word(srcoffset);
1302 CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
1303 for(*dstreg = 0; *dstreg < 16; (*dstreg)++)
1304 if ((srcval >> *dstreg) & 1) break;
1306 } else { /* register to register */
1307 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1308 u32 *srcreg, *dstreg;
1310 srcreg = DECODE_RM_LONG_REGISTER(rl);
1312 dstreg = DECODE_RM_LONG_REGISTER(rh);
1314 CONDITIONAL_SET_FLAG(*srcreg == 0, F_ZF);
1315 for(*dstreg = 0; *dstreg < 32; (*dstreg)++)
1316 if ((*srcreg >> *dstreg) & 1) break;
1318 u16 *srcreg, *dstreg;
1320 srcreg = DECODE_RM_WORD_REGISTER(rl);
1322 dstreg = DECODE_RM_WORD_REGISTER(rh);
1324 CONDITIONAL_SET_FLAG(*srcreg == 0, F_ZF);
1325 for(*dstreg = 0; *dstreg < 16; (*dstreg)++)
1326 if ((*srcreg >> *dstreg) & 1) break;
1329 DECODE_CLEAR_SEGOVR();
1333 /****************************************************************************
1335 Handles opcode 0x0f,0xbd
1336 ****************************************************************************/
1337 void x86emuOp2_bsr(u8 X86EMU_UNUSED(op2))
1343 DECODE_PRINTF("BSF\n");
1344 FETCH_DECODE_MODRM(mod, rh, rl);
1346 srcoffset = decode_rmXX_address(mod, rl);
1348 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1349 u32 srcval, *dstreg;
1351 dstreg = DECODE_RM_LONG_REGISTER(rh);
1353 srcval = fetch_data_long(srcoffset);
1354 CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
1355 for(*dstreg = 31; *dstreg > 0; (*dstreg)--)
1356 if ((srcval >> *dstreg) & 1) break;
1358 u16 srcval, *dstreg;
1360 dstreg = DECODE_RM_WORD_REGISTER(rh);
1362 srcval = fetch_data_word(srcoffset);
1363 CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
1364 for(*dstreg = 15; *dstreg > 0; (*dstreg)--)
1365 if ((srcval >> *dstreg) & 1) break;
1367 } else { /* register to register */
1368 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1369 u32 *srcreg, *dstreg;
1371 srcreg = DECODE_RM_LONG_REGISTER(rl);
1373 dstreg = DECODE_RM_LONG_REGISTER(rh);
1375 CONDITIONAL_SET_FLAG(*srcreg == 0, F_ZF);
1376 for(*dstreg = 31; *dstreg > 0; (*dstreg)--)
1377 if ((*srcreg >> *dstreg) & 1) break;
1379 u16 *srcreg, *dstreg;
1381 srcreg = DECODE_RM_WORD_REGISTER(rl);
1383 dstreg = DECODE_RM_WORD_REGISTER(rh);
1385 CONDITIONAL_SET_FLAG(*srcreg == 0, F_ZF);
1386 for(*dstreg = 15; *dstreg > 0; (*dstreg)--)
1387 if ((*srcreg >> *dstreg) & 1) break;
1390 DECODE_CLEAR_SEGOVR();
1394 /****************************************************************************
1396 Handles opcode 0x0f,0xbe
1397 ****************************************************************************/
1398 void x86emuOp2_movsx_byte_R_RM(u8 X86EMU_UNUSED(op2))
1404 DECODE_PRINTF("MOVSX\t");
1405 FETCH_DECODE_MODRM(mod, rh, rl);
1407 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1411 destreg = DECODE_RM_LONG_REGISTER(rh);
1413 srcoffset = decode_rmXX_address(mod, rl);
1414 srcval = (s32)((s8)fetch_data_byte(srcoffset));
1415 DECODE_PRINTF("\n");
1422 destreg = DECODE_RM_WORD_REGISTER(rh);
1424 srcoffset = decode_rmXX_address(mod, rl);
1425 srcval = (s16)((s8)fetch_data_byte(srcoffset));
1426 DECODE_PRINTF("\n");
1430 } else { /* register to register */
1431 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1435 destreg = DECODE_RM_LONG_REGISTER(rh);
1437 srcreg = DECODE_RM_BYTE_REGISTER(rl);
1438 DECODE_PRINTF("\n");
1440 *destreg = (s32)((s8)*srcreg);
1445 destreg = DECODE_RM_WORD_REGISTER(rh);
1447 srcreg = DECODE_RM_BYTE_REGISTER(rl);
1448 DECODE_PRINTF("\n");
1450 *destreg = (s16)((s8)*srcreg);
1453 DECODE_CLEAR_SEGOVR();
1457 /****************************************************************************
1459 Handles opcode 0x0f,0xbf
1460 ****************************************************************************/
1461 void x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2))
1470 DECODE_PRINTF("MOVSX\t");
1471 FETCH_DECODE_MODRM(mod, rh, rl);
1473 destreg = DECODE_RM_LONG_REGISTER(rh);
1475 srcoffset = decode_rmXX_address(mod, rl);
1476 srcval = (s32)((s16)fetch_data_word(srcoffset));
1477 DECODE_PRINTF("\n");
1480 } else { /* register to register */
1481 destreg = DECODE_RM_LONG_REGISTER(rh);
1483 srcreg = DECODE_RM_WORD_REGISTER(rl);
1484 DECODE_PRINTF("\n");
1486 *destreg = (s32)((s16)*srcreg);
1488 DECODE_CLEAR_SEGOVR();
1492 /***************************************************************************
1493 * Double byte operation code table:
1494 **************************************************************************/
1495 void (*x86emu_optab2[256])(u8) =
1497 /* 0x00 */ x86emuOp2_illegal_op, /* Group F (ring 0 PM) */
1498 /* 0x01 */ x86emuOp2_illegal_op, /* Group G (ring 0 PM) */
1499 /* 0x02 */ x86emuOp2_illegal_op, /* lar (ring 0 PM) */
1500 /* 0x03 */ x86emuOp2_illegal_op, /* lsl (ring 0 PM) */
1501 /* 0x04 */ x86emuOp2_illegal_op,
1502 /* 0x05 */ x86emuOp2_illegal_op, /* loadall (undocumented) */
1503 /* 0x06 */ x86emuOp2_illegal_op, /* clts (ring 0 PM) */
1504 /* 0x07 */ x86emuOp2_illegal_op, /* loadall (undocumented) */
1505 /* 0x08 */ x86emuOp2_illegal_op, /* invd (ring 0 PM) */
1506 /* 0x09 */ x86emuOp2_illegal_op, /* wbinvd (ring 0 PM) */
1507 /* 0x0a */ x86emuOp2_illegal_op,
1508 /* 0x0b */ x86emuOp2_illegal_op,
1509 /* 0x0c */ x86emuOp2_illegal_op,
1510 /* 0x0d */ x86emuOp2_illegal_op,
1511 /* 0x0e */ x86emuOp2_illegal_op,
1512 /* 0x0f */ x86emuOp2_illegal_op,
1514 /* 0x10 */ x86emuOp2_illegal_op,
1515 /* 0x11 */ x86emuOp2_illegal_op,
1516 /* 0x12 */ x86emuOp2_illegal_op,
1517 /* 0x13 */ x86emuOp2_illegal_op,
1518 /* 0x14 */ x86emuOp2_illegal_op,
1519 /* 0x15 */ x86emuOp2_illegal_op,
1520 /* 0x16 */ x86emuOp2_illegal_op,
1521 /* 0x17 */ x86emuOp2_illegal_op,
1522 /* 0x18 */ x86emuOp2_illegal_op,
1523 /* 0x19 */ x86emuOp2_illegal_op,
1524 /* 0x1a */ x86emuOp2_illegal_op,
1525 /* 0x1b */ x86emuOp2_illegal_op,
1526 /* 0x1c */ x86emuOp2_illegal_op,
1527 /* 0x1d */ x86emuOp2_illegal_op,
1528 /* 0x1e */ x86emuOp2_illegal_op,
1529 /* 0x1f */ x86emuOp2_illegal_op,
1531 /* 0x20 */ x86emuOp2_illegal_op, /* mov reg32,creg (ring 0 PM) */
1532 /* 0x21 */ x86emuOp2_illegal_op, /* mov reg32,dreg (ring 0 PM) */
1533 /* 0x22 */ x86emuOp2_illegal_op, /* mov creg,reg32 (ring 0 PM) */
1534 /* 0x23 */ x86emuOp2_illegal_op, /* mov dreg,reg32 (ring 0 PM) */
1535 /* 0x24 */ x86emuOp2_illegal_op, /* mov reg32,treg (ring 0 PM) */
1536 /* 0x25 */ x86emuOp2_illegal_op,
1537 /* 0x26 */ x86emuOp2_illegal_op, /* mov treg,reg32 (ring 0 PM) */
1538 /* 0x27 */ x86emuOp2_illegal_op,
1539 /* 0x28 */ x86emuOp2_illegal_op,
1540 /* 0x29 */ x86emuOp2_illegal_op,
1541 /* 0x2a */ x86emuOp2_illegal_op,
1542 /* 0x2b */ x86emuOp2_illegal_op,
1543 /* 0x2c */ x86emuOp2_illegal_op,
1544 /* 0x2d */ x86emuOp2_illegal_op,
1545 /* 0x2e */ x86emuOp2_illegal_op,
1546 /* 0x2f */ x86emuOp2_illegal_op,
1548 /* 0x30 */ x86emuOp2_illegal_op,
1549 /* 0x31 */ x86emuOp2_illegal_op,
1550 /* 0x32 */ x86emuOp2_illegal_op,
1551 /* 0x33 */ x86emuOp2_illegal_op,
1552 /* 0x34 */ x86emuOp2_illegal_op,
1553 /* 0x35 */ x86emuOp2_illegal_op,
1554 /* 0x36 */ x86emuOp2_illegal_op,
1555 /* 0x37 */ x86emuOp2_illegal_op,
1556 /* 0x38 */ x86emuOp2_illegal_op,
1557 /* 0x39 */ x86emuOp2_illegal_op,
1558 /* 0x3a */ x86emuOp2_illegal_op,
1559 /* 0x3b */ x86emuOp2_illegal_op,
1560 /* 0x3c */ x86emuOp2_illegal_op,
1561 /* 0x3d */ x86emuOp2_illegal_op,
1562 /* 0x3e */ x86emuOp2_illegal_op,
1563 /* 0x3f */ x86emuOp2_illegal_op,
1565 /* 0x40 */ x86emuOp2_illegal_op,
1566 /* 0x41 */ x86emuOp2_illegal_op,
1567 /* 0x42 */ x86emuOp2_illegal_op,
1568 /* 0x43 */ x86emuOp2_illegal_op,
1569 /* 0x44 */ x86emuOp2_illegal_op,
1570 /* 0x45 */ x86emuOp2_illegal_op,
1571 /* 0x46 */ x86emuOp2_illegal_op,
1572 /* 0x47 */ x86emuOp2_illegal_op,
1573 /* 0x48 */ x86emuOp2_illegal_op,
1574 /* 0x49 */ x86emuOp2_illegal_op,
1575 /* 0x4a */ x86emuOp2_illegal_op,
1576 /* 0x4b */ x86emuOp2_illegal_op,
1577 /* 0x4c */ x86emuOp2_illegal_op,
1578 /* 0x4d */ x86emuOp2_illegal_op,
1579 /* 0x4e */ x86emuOp2_illegal_op,
1580 /* 0x4f */ x86emuOp2_illegal_op,
1582 /* 0x50 */ x86emuOp2_illegal_op,
1583 /* 0x51 */ x86emuOp2_illegal_op,
1584 /* 0x52 */ x86emuOp2_illegal_op,
1585 /* 0x53 */ x86emuOp2_illegal_op,
1586 /* 0x54 */ x86emuOp2_illegal_op,
1587 /* 0x55 */ x86emuOp2_illegal_op,
1588 /* 0x56 */ x86emuOp2_illegal_op,
1589 /* 0x57 */ x86emuOp2_illegal_op,
1590 /* 0x58 */ x86emuOp2_illegal_op,
1591 /* 0x59 */ x86emuOp2_illegal_op,
1592 /* 0x5a */ x86emuOp2_illegal_op,
1593 /* 0x5b */ x86emuOp2_illegal_op,
1594 /* 0x5c */ x86emuOp2_illegal_op,
1595 /* 0x5d */ x86emuOp2_illegal_op,
1596 /* 0x5e */ x86emuOp2_illegal_op,
1597 /* 0x5f */ x86emuOp2_illegal_op,
1599 /* 0x60 */ x86emuOp2_illegal_op,
1600 /* 0x61 */ x86emuOp2_illegal_op,
1601 /* 0x62 */ x86emuOp2_illegal_op,
1602 /* 0x63 */ x86emuOp2_illegal_op,
1603 /* 0x64 */ x86emuOp2_illegal_op,
1604 /* 0x65 */ x86emuOp2_illegal_op,
1605 /* 0x66 */ x86emuOp2_illegal_op,
1606 /* 0x67 */ x86emuOp2_illegal_op,
1607 /* 0x68 */ x86emuOp2_illegal_op,
1608 /* 0x69 */ x86emuOp2_illegal_op,
1609 /* 0x6a */ x86emuOp2_illegal_op,
1610 /* 0x6b */ x86emuOp2_illegal_op,
1611 /* 0x6c */ x86emuOp2_illegal_op,
1612 /* 0x6d */ x86emuOp2_illegal_op,
1613 /* 0x6e */ x86emuOp2_illegal_op,
1614 /* 0x6f */ x86emuOp2_illegal_op,
1616 /* 0x70 */ x86emuOp2_illegal_op,
1617 /* 0x71 */ x86emuOp2_illegal_op,
1618 /* 0x72 */ x86emuOp2_illegal_op,
1619 /* 0x73 */ x86emuOp2_illegal_op,
1620 /* 0x74 */ x86emuOp2_illegal_op,
1621 /* 0x75 */ x86emuOp2_illegal_op,
1622 /* 0x76 */ x86emuOp2_illegal_op,
1623 /* 0x77 */ x86emuOp2_illegal_op,
1624 /* 0x78 */ x86emuOp2_illegal_op,
1625 /* 0x79 */ x86emuOp2_illegal_op,
1626 /* 0x7a */ x86emuOp2_illegal_op,
1627 /* 0x7b */ x86emuOp2_illegal_op,
1628 /* 0x7c */ x86emuOp2_illegal_op,
1629 /* 0x7d */ x86emuOp2_illegal_op,
1630 /* 0x7e */ x86emuOp2_illegal_op,
1631 /* 0x7f */ x86emuOp2_illegal_op,
1633 /* 0x80 */ x86emuOp2_long_jump,
1634 /* 0x81 */ x86emuOp2_long_jump,
1635 /* 0x82 */ x86emuOp2_long_jump,
1636 /* 0x83 */ x86emuOp2_long_jump,
1637 /* 0x84 */ x86emuOp2_long_jump,
1638 /* 0x85 */ x86emuOp2_long_jump,
1639 /* 0x86 */ x86emuOp2_long_jump,
1640 /* 0x87 */ x86emuOp2_long_jump,
1641 /* 0x88 */ x86emuOp2_long_jump,
1642 /* 0x89 */ x86emuOp2_long_jump,
1643 /* 0x8a */ x86emuOp2_long_jump,
1644 /* 0x8b */ x86emuOp2_long_jump,
1645 /* 0x8c */ x86emuOp2_long_jump,
1646 /* 0x8d */ x86emuOp2_long_jump,
1647 /* 0x8e */ x86emuOp2_long_jump,
1648 /* 0x8f */ x86emuOp2_long_jump,
1650 /* 0x90 */ x86emuOp2_set_byte,
1651 /* 0x91 */ x86emuOp2_set_byte,
1652 /* 0x92 */ x86emuOp2_set_byte,
1653 /* 0x93 */ x86emuOp2_set_byte,
1654 /* 0x94 */ x86emuOp2_set_byte,
1655 /* 0x95 */ x86emuOp2_set_byte,
1656 /* 0x96 */ x86emuOp2_set_byte,
1657 /* 0x97 */ x86emuOp2_set_byte,
1658 /* 0x98 */ x86emuOp2_set_byte,
1659 /* 0x99 */ x86emuOp2_set_byte,
1660 /* 0x9a */ x86emuOp2_set_byte,
1661 /* 0x9b */ x86emuOp2_set_byte,
1662 /* 0x9c */ x86emuOp2_set_byte,
1663 /* 0x9d */ x86emuOp2_set_byte,
1664 /* 0x9e */ x86emuOp2_set_byte,
1665 /* 0x9f */ x86emuOp2_set_byte,
1667 /* 0xa0 */ x86emuOp2_push_FS,
1668 /* 0xa1 */ x86emuOp2_pop_FS,
1669 /* 0xa2 */ x86emuOp2_illegal_op,
1670 /* 0xa3 */ x86emuOp2_bt_R,
1671 /* 0xa4 */ x86emuOp2_shld_IMM,
1672 /* 0xa5 */ x86emuOp2_shld_CL,
1673 /* 0xa6 */ x86emuOp2_illegal_op,
1674 /* 0xa7 */ x86emuOp2_illegal_op,
1675 /* 0xa8 */ x86emuOp2_push_GS,
1676 /* 0xa9 */ x86emuOp2_pop_GS,
1677 /* 0xaa */ x86emuOp2_illegal_op,
1678 /* 0xab */ x86emuOp2_bt_R,
1679 /* 0xac */ x86emuOp2_shrd_IMM,
1680 /* 0xad */ x86emuOp2_shrd_CL,
1681 /* 0xae */ x86emuOp2_illegal_op,
1682 /* 0xaf */ x86emuOp2_imul_R_RM,
1684 /* 0xb0 */ x86emuOp2_illegal_op, /* TODO: cmpxchg */
1685 /* 0xb1 */ x86emuOp2_illegal_op, /* TODO: cmpxchg */
1686 /* 0xb2 */ x86emuOp2_lss_R_IMM,
1687 /* 0xb3 */ x86emuOp2_btr_R,
1688 /* 0xb4 */ x86emuOp2_lfs_R_IMM,
1689 /* 0xb5 */ x86emuOp2_lgs_R_IMM,
1690 /* 0xb6 */ x86emuOp2_movzx_byte_R_RM,
1691 /* 0xb7 */ x86emuOp2_movzx_word_R_RM,
1692 /* 0xb8 */ x86emuOp2_illegal_op,
1693 /* 0xb9 */ x86emuOp2_illegal_op,
1694 /* 0xba */ x86emuOp2_btX_I,
1695 /* 0xbb */ x86emuOp2_btc_R,
1696 /* 0xbc */ x86emuOp2_bsf,
1697 /* 0xbd */ x86emuOp2_bsr,
1698 /* 0xbe */ x86emuOp2_movsx_byte_R_RM,
1699 /* 0xbf */ x86emuOp2_movsx_word_R_RM,
1701 /* 0xc0 */ x86emuOp2_illegal_op, /* TODO: xadd */
1702 /* 0xc1 */ x86emuOp2_illegal_op, /* TODO: xadd */
1703 /* 0xc2 */ x86emuOp2_illegal_op,
1704 /* 0xc3 */ x86emuOp2_illegal_op,
1705 /* 0xc4 */ x86emuOp2_illegal_op,
1706 /* 0xc5 */ x86emuOp2_illegal_op,
1707 /* 0xc6 */ x86emuOp2_illegal_op,
1708 /* 0xc7 */ x86emuOp2_illegal_op,
1709 /* 0xc8 */ x86emuOp2_illegal_op, /* TODO: bswap */
1710 /* 0xc9 */ x86emuOp2_illegal_op, /* TODO: bswap */
1711 /* 0xca */ x86emuOp2_illegal_op, /* TODO: bswap */
1712 /* 0xcb */ x86emuOp2_illegal_op, /* TODO: bswap */
1713 /* 0xcc */ x86emuOp2_illegal_op, /* TODO: bswap */
1714 /* 0xcd */ x86emuOp2_illegal_op, /* TODO: bswap */
1715 /* 0xce */ x86emuOp2_illegal_op, /* TODO: bswap */
1716 /* 0xcf */ x86emuOp2_illegal_op, /* TODO: bswap */
1718 /* 0xd0 */ x86emuOp2_illegal_op,
1719 /* 0xd1 */ x86emuOp2_illegal_op,
1720 /* 0xd2 */ x86emuOp2_illegal_op,
1721 /* 0xd3 */ x86emuOp2_illegal_op,
1722 /* 0xd4 */ x86emuOp2_illegal_op,
1723 /* 0xd5 */ x86emuOp2_illegal_op,
1724 /* 0xd6 */ x86emuOp2_illegal_op,
1725 /* 0xd7 */ x86emuOp2_illegal_op,
1726 /* 0xd8 */ x86emuOp2_illegal_op,
1727 /* 0xd9 */ x86emuOp2_illegal_op,
1728 /* 0xda */ x86emuOp2_illegal_op,
1729 /* 0xdb */ x86emuOp2_illegal_op,
1730 /* 0xdc */ x86emuOp2_illegal_op,
1731 /* 0xdd */ x86emuOp2_illegal_op,
1732 /* 0xde */ x86emuOp2_illegal_op,
1733 /* 0xdf */ x86emuOp2_illegal_op,
1735 /* 0xe0 */ x86emuOp2_illegal_op,
1736 /* 0xe1 */ x86emuOp2_illegal_op,
1737 /* 0xe2 */ x86emuOp2_illegal_op,
1738 /* 0xe3 */ x86emuOp2_illegal_op,
1739 /* 0xe4 */ x86emuOp2_illegal_op,
1740 /* 0xe5 */ x86emuOp2_illegal_op,
1741 /* 0xe6 */ x86emuOp2_illegal_op,
1742 /* 0xe7 */ x86emuOp2_illegal_op,
1743 /* 0xe8 */ x86emuOp2_illegal_op,
1744 /* 0xe9 */ x86emuOp2_illegal_op,
1745 /* 0xea */ x86emuOp2_illegal_op,
1746 /* 0xeb */ x86emuOp2_illegal_op,
1747 /* 0xec */ x86emuOp2_illegal_op,
1748 /* 0xed */ x86emuOp2_illegal_op,
1749 /* 0xee */ x86emuOp2_illegal_op,
1750 /* 0xef */ x86emuOp2_illegal_op,
1752 /* 0xf0 */ x86emuOp2_illegal_op,
1753 /* 0xf1 */ x86emuOp2_illegal_op,
1754 /* 0xf2 */ x86emuOp2_illegal_op,
1755 /* 0xf3 */ x86emuOp2_illegal_op,
1756 /* 0xf4 */ x86emuOp2_illegal_op,
1757 /* 0xf5 */ x86emuOp2_illegal_op,
1758 /* 0xf6 */ x86emuOp2_illegal_op,
1759 /* 0xf7 */ x86emuOp2_illegal_op,
1760 /* 0xf8 */ x86emuOp2_illegal_op,
1761 /* 0xf9 */ x86emuOp2_illegal_op,
1762 /* 0xfa */ x86emuOp2_illegal_op,
1763 /* 0xfb */ x86emuOp2_illegal_op,
1764 /* 0xfc */ x86emuOp2_illegal_op,
1765 /* 0xfd */ x86emuOp2_illegal_op,
1766 /* 0xfe */ x86emuOp2_illegal_op,
1767 /* 0xff */ x86emuOp2_illegal_op,