1 /****************************************************************************
3 * Realmode X86 Emulator Library
5 * Copyright (C) 2007 Freescale Semiconductor, Inc.
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 ****************************************************************************/
44 #include <linux/compiler.h>
45 #include <linux/printk.h>
46 #include "x86emu/x86emui.h"
48 /*----------------------------- Implementation ----------------------------*/
50 /****************************************************************************
52 op1 - Instruction op code
55 Handles illegal opcodes.
56 ****************************************************************************/
57 void x86emuOp2_illegal_op(
61 ERR_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n");
63 printk("%04x:%04x: %02X ILLEGAL EXTENDED X86 OPCODE!\n",
64 M.x86.R_CS, M.x86.R_IP-2,op2);
69 #define xorl(a,b) ((a) && !(b)) || (!(a) && (b))
71 /****************************************************************************
73 Handles opcode 0x0f,0x80-0x8F
74 ****************************************************************************/
75 int x86emu_check_jump_condition(u8 op)
79 DECODE_PRINTF("JO\t");
80 return ACCESS_FLAG(F_OF);
82 DECODE_PRINTF("JNO\t");
83 return !ACCESS_FLAG(F_OF);
86 DECODE_PRINTF("JB\t");
87 return ACCESS_FLAG(F_CF);
90 DECODE_PRINTF("JNB\t");
91 return !ACCESS_FLAG(F_CF);
94 DECODE_PRINTF("JZ\t");
95 return ACCESS_FLAG(F_ZF);
98 DECODE_PRINTF("JNZ\t");
99 return !ACCESS_FLAG(F_ZF);
102 DECODE_PRINTF("JBE\t");
103 return ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF);
106 DECODE_PRINTF("JNBE\t");
107 return !(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF));
110 DECODE_PRINTF("JS\t");
111 return ACCESS_FLAG(F_SF);
114 DECODE_PRINTF("JNS\t");
115 return !ACCESS_FLAG(F_SF);
118 DECODE_PRINTF("JP\t");
119 return ACCESS_FLAG(F_PF);
122 DECODE_PRINTF("JNP\t");
123 return !ACCESS_FLAG(F_PF);
126 DECODE_PRINTF("JL\t");
127 return xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
130 DECODE_PRINTF("JNL\t");
131 return !xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
134 DECODE_PRINTF("JLE\t");
135 return (xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
139 DECODE_PRINTF("JNLE\t");
140 return !(xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
145 void x86emuOp2_long_jump(u8 op2)
150 /* conditional jump to word offset. */
152 cond = x86emu_check_jump_condition(op2 & 0xF);
153 target = (s16) fetch_word_imm();
154 target += (s16) M.x86.R_IP;
155 DECODE_PRINTF2("%04x\n", target);
158 M.x86.R_IP = (u16)target;
159 DECODE_CLEAR_SEGOVR();
163 /****************************************************************************
165 Handles opcode 0x0f,0x90-0x9F
166 ****************************************************************************/
167 void x86emuOp2_set_byte(u8 op2)
172 __maybe_unused char *name = 0;
179 cond = ACCESS_FLAG(F_OF);
183 cond = !ACCESS_FLAG(F_OF);
187 cond = ACCESS_FLAG(F_CF);
191 cond = !ACCESS_FLAG(F_CF);
195 cond = ACCESS_FLAG(F_ZF);
199 cond = !ACCESS_FLAG(F_ZF);
203 cond = ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF);
207 cond = !(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF));
211 cond = ACCESS_FLAG(F_SF);
215 cond = !ACCESS_FLAG(F_SF);
219 cond = ACCESS_FLAG(F_PF);
223 cond = !ACCESS_FLAG(F_PF);
227 cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
231 cond = !xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
235 cond = (xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
240 cond = !(xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
245 FETCH_DECODE_MODRM(mod, rh, rl);
247 destoffset = decode_rmXX_address(mod, rl);
250 store_data_byte(destoffset, cond ? 0x01 : 0x00);
251 } else { /* register to register */
252 destreg = DECODE_RM_BYTE_REGISTER(rl);
255 *destreg = cond ? 0x01 : 0x00;
257 DECODE_CLEAR_SEGOVR();
261 /****************************************************************************
263 Handles opcode 0x0f,0xa0
264 ****************************************************************************/
265 void x86emuOp2_push_FS(u8 X86EMU_UNUSED(op2))
268 DECODE_PRINTF("PUSH\tFS\n");
270 push_word(M.x86.R_FS);
271 DECODE_CLEAR_SEGOVR();
275 /****************************************************************************
277 Handles opcode 0x0f,0xa1
278 ****************************************************************************/
279 void x86emuOp2_pop_FS(u8 X86EMU_UNUSED(op2))
282 DECODE_PRINTF("POP\tFS\n");
284 M.x86.R_FS = pop_word();
285 DECODE_CLEAR_SEGOVR();
289 /****************************************************************************
291 Handles opcode 0x0f,0xa3
292 ****************************************************************************/
293 void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
300 DECODE_PRINTF("BT\t");
301 FETCH_DECODE_MODRM(mod, rh, rl);
303 srcoffset = decode_rmXX_address(mod, rl);
304 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
309 shiftreg = DECODE_RM_LONG_REGISTER(rh);
311 bit = *shiftreg & 0x1F;
312 disp = (s16)*shiftreg >> 5;
313 srcval = fetch_data_long(srcoffset+disp);
314 CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
320 shiftreg = DECODE_RM_WORD_REGISTER(rh);
322 bit = *shiftreg & 0xF;
323 disp = (s16)*shiftreg >> 4;
324 srcval = fetch_data_word(srcoffset+disp);
325 CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
327 } else { /* register to register */
328 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
329 u32 *srcreg,*shiftreg;
331 srcreg = DECODE_RM_LONG_REGISTER(rl);
333 shiftreg = DECODE_RM_LONG_REGISTER(rh);
335 bit = *shiftreg & 0x1F;
336 CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit),F_CF);
338 u16 *srcreg,*shiftreg;
340 srcreg = DECODE_RM_WORD_REGISTER(rl);
342 shiftreg = DECODE_RM_WORD_REGISTER(rh);
344 bit = *shiftreg & 0xF;
345 CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit),F_CF);
348 DECODE_CLEAR_SEGOVR();
352 /****************************************************************************
354 Handles opcode 0x0f,0xa4
355 ****************************************************************************/
356 void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
363 DECODE_PRINTF("SHLD\t");
364 FETCH_DECODE_MODRM(mod, rh, rl);
366 destoffset = decode_rmXX_address(mod, rl);
367 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
372 shiftreg = DECODE_RM_LONG_REGISTER(rh);
374 shift = fetch_byte_imm();
375 DECODE_PRINTF2("%d\n", shift);
377 destval = fetch_data_long(destoffset);
378 destval = shld_long(destval,*shiftreg,shift);
379 store_data_long(destoffset, destval);
385 shiftreg = DECODE_RM_WORD_REGISTER(rh);
387 shift = fetch_byte_imm();
388 DECODE_PRINTF2("%d\n", shift);
390 destval = fetch_data_word(destoffset);
391 destval = shld_word(destval,*shiftreg,shift);
392 store_data_word(destoffset, destval);
394 } else { /* register to register */
395 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
396 u32 *destreg,*shiftreg;
398 destreg = DECODE_RM_LONG_REGISTER(rl);
400 shiftreg = DECODE_RM_LONG_REGISTER(rh);
402 shift = fetch_byte_imm();
403 DECODE_PRINTF2("%d\n", shift);
405 *destreg = shld_long(*destreg,*shiftreg,shift);
407 u16 *destreg,*shiftreg;
409 destreg = DECODE_RM_WORD_REGISTER(rl);
411 shiftreg = DECODE_RM_WORD_REGISTER(rh);
413 shift = fetch_byte_imm();
414 DECODE_PRINTF2("%d\n", shift);
416 *destreg = shld_word(*destreg,*shiftreg,shift);
419 DECODE_CLEAR_SEGOVR();
423 /****************************************************************************
425 Handles opcode 0x0f,0xa5
426 ****************************************************************************/
427 void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
433 DECODE_PRINTF("SHLD\t");
434 FETCH_DECODE_MODRM(mod, rh, rl);
436 destoffset = decode_rmXX_address(mod, rl);
437 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
442 shiftreg = DECODE_RM_LONG_REGISTER(rh);
443 DECODE_PRINTF(",CL\n");
445 destval = fetch_data_long(destoffset);
446 destval = shld_long(destval,*shiftreg,M.x86.R_CL);
447 store_data_long(destoffset, destval);
453 shiftreg = DECODE_RM_WORD_REGISTER(rh);
454 DECODE_PRINTF(",CL\n");
456 destval = fetch_data_word(destoffset);
457 destval = shld_word(destval,*shiftreg,M.x86.R_CL);
458 store_data_word(destoffset, destval);
460 } else { /* register to register */
461 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
462 u32 *destreg,*shiftreg;
464 destreg = DECODE_RM_LONG_REGISTER(rl);
466 shiftreg = DECODE_RM_LONG_REGISTER(rh);
467 DECODE_PRINTF(",CL\n");
469 *destreg = shld_long(*destreg,*shiftreg,M.x86.R_CL);
471 u16 *destreg,*shiftreg;
473 destreg = DECODE_RM_WORD_REGISTER(rl);
475 shiftreg = DECODE_RM_WORD_REGISTER(rh);
476 DECODE_PRINTF(",CL\n");
478 *destreg = shld_word(*destreg,*shiftreg,M.x86.R_CL);
481 DECODE_CLEAR_SEGOVR();
485 /****************************************************************************
487 Handles opcode 0x0f,0xa8
488 ****************************************************************************/
489 void x86emuOp2_push_GS(u8 X86EMU_UNUSED(op2))
492 DECODE_PRINTF("PUSH\tGS\n");
494 push_word(M.x86.R_GS);
495 DECODE_CLEAR_SEGOVR();
499 /****************************************************************************
501 Handles opcode 0x0f,0xa9
502 ****************************************************************************/
503 void x86emuOp2_pop_GS(u8 X86EMU_UNUSED(op2))
506 DECODE_PRINTF("POP\tGS\n");
508 M.x86.R_GS = pop_word();
509 DECODE_CLEAR_SEGOVR();
513 /****************************************************************************
515 Handles opcode 0x0f,0xaa
516 ****************************************************************************/
517 void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
524 DECODE_PRINTF("BTS\t");
525 FETCH_DECODE_MODRM(mod, rh, rl);
527 srcoffset = decode_rmXX_address(mod, rl);
528 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
533 shiftreg = DECODE_RM_LONG_REGISTER(rh);
535 bit = *shiftreg & 0x1F;
536 disp = (s16)*shiftreg >> 5;
537 srcval = fetch_data_long(srcoffset+disp);
539 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
540 store_data_long(srcoffset+disp, srcval | mask);
546 shiftreg = DECODE_RM_WORD_REGISTER(rh);
548 bit = *shiftreg & 0xF;
549 disp = (s16)*shiftreg >> 4;
550 srcval = fetch_data_word(srcoffset+disp);
551 mask = (u16)(0x1 << bit);
552 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
553 store_data_word(srcoffset+disp, srcval | mask);
555 } else { /* register to register */
556 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
557 u32 *srcreg,*shiftreg;
560 srcreg = DECODE_RM_LONG_REGISTER(rl);
562 shiftreg = DECODE_RM_LONG_REGISTER(rh);
564 bit = *shiftreg & 0x1F;
566 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
569 u16 *srcreg,*shiftreg;
572 srcreg = DECODE_RM_WORD_REGISTER(rl);
574 shiftreg = DECODE_RM_WORD_REGISTER(rh);
576 bit = *shiftreg & 0xF;
577 mask = (u16)(0x1 << bit);
578 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
582 DECODE_CLEAR_SEGOVR();
586 /****************************************************************************
588 Handles opcode 0x0f,0xac
589 ****************************************************************************/
590 void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
597 DECODE_PRINTF("SHLD\t");
598 FETCH_DECODE_MODRM(mod, rh, rl);
600 destoffset = decode_rmXX_address(mod, rl);
601 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
606 shiftreg = DECODE_RM_LONG_REGISTER(rh);
608 shift = fetch_byte_imm();
609 DECODE_PRINTF2("%d\n", shift);
611 destval = fetch_data_long(destoffset);
612 destval = shrd_long(destval,*shiftreg,shift);
613 store_data_long(destoffset, destval);
619 shiftreg = DECODE_RM_WORD_REGISTER(rh);
621 shift = fetch_byte_imm();
622 DECODE_PRINTF2("%d\n", shift);
624 destval = fetch_data_word(destoffset);
625 destval = shrd_word(destval,*shiftreg,shift);
626 store_data_word(destoffset, destval);
628 } else { /* register to register */
629 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
630 u32 *destreg,*shiftreg;
632 destreg = DECODE_RM_LONG_REGISTER(rl);
634 shiftreg = DECODE_RM_LONG_REGISTER(rh);
636 shift = fetch_byte_imm();
637 DECODE_PRINTF2("%d\n", shift);
639 *destreg = shrd_long(*destreg,*shiftreg,shift);
641 u16 *destreg,*shiftreg;
643 destreg = DECODE_RM_WORD_REGISTER(rl);
645 shiftreg = DECODE_RM_WORD_REGISTER(rh);
647 shift = fetch_byte_imm();
648 DECODE_PRINTF2("%d\n", shift);
650 *destreg = shrd_word(*destreg,*shiftreg,shift);
653 DECODE_CLEAR_SEGOVR();
657 /****************************************************************************
659 Handles opcode 0x0f,0xad
660 ****************************************************************************/
661 void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
667 DECODE_PRINTF("SHLD\t");
668 FETCH_DECODE_MODRM(mod, rh, rl);
670 destoffset = decode_rmXX_address(mod, rl);
672 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
676 shiftreg = DECODE_RM_LONG_REGISTER(rh);
677 DECODE_PRINTF(",CL\n");
679 destval = fetch_data_long(destoffset);
680 destval = shrd_long(destval,*shiftreg,M.x86.R_CL);
681 store_data_long(destoffset, destval);
686 shiftreg = DECODE_RM_WORD_REGISTER(rh);
687 DECODE_PRINTF(",CL\n");
689 destval = fetch_data_word(destoffset);
690 destval = shrd_word(destval,*shiftreg,M.x86.R_CL);
691 store_data_word(destoffset, destval);
693 } else { /* register to register */
694 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
695 u32 *destreg,*shiftreg;
697 destreg = DECODE_RM_LONG_REGISTER(rl);
699 shiftreg = DECODE_RM_LONG_REGISTER(rh);
700 DECODE_PRINTF(",CL\n");
702 *destreg = shrd_long(*destreg,*shiftreg,M.x86.R_CL);
704 u16 *destreg,*shiftreg;
706 destreg = DECODE_RM_WORD_REGISTER(rl);
708 shiftreg = DECODE_RM_WORD_REGISTER(rh);
709 DECODE_PRINTF(",CL\n");
711 *destreg = shrd_word(*destreg,*shiftreg,M.x86.R_CL);
714 DECODE_CLEAR_SEGOVR();
718 /****************************************************************************
720 Handles opcode 0x0f,0xaf
721 ****************************************************************************/
722 void x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
728 DECODE_PRINTF("IMUL\t");
729 FETCH_DECODE_MODRM(mod, rh, rl);
731 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
736 destreg = DECODE_RM_LONG_REGISTER(rh);
738 srcoffset = decode_rmXX_address(mod, rl);
739 srcval = fetch_data_long(srcoffset);
741 imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)srcval);
749 *destreg = (u32)res_lo;
755 destreg = DECODE_RM_WORD_REGISTER(rh);
757 srcoffset = decode_rmXX_address(mod, rl);
758 srcval = fetch_data_word(srcoffset);
760 res = (s16)*destreg * (s16)srcval;
770 } else { /* register to register */
771 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
772 u32 *destreg,*srcreg;
775 destreg = DECODE_RM_LONG_REGISTER(rh);
777 srcreg = DECODE_RM_LONG_REGISTER(rl);
779 imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)*srcreg);
787 *destreg = (u32)res_lo;
789 u16 *destreg,*srcreg;
792 destreg = DECODE_RM_WORD_REGISTER(rh);
794 srcreg = DECODE_RM_WORD_REGISTER(rl);
795 res = (s16)*destreg * (s16)*srcreg;
806 DECODE_CLEAR_SEGOVR();
810 /****************************************************************************
812 Handles opcode 0x0f,0xb2
813 ****************************************************************************/
814 void x86emuOp2_lss_R_IMM(u8 X86EMU_UNUSED(op2))
821 DECODE_PRINTF("LSS\t");
822 FETCH_DECODE_MODRM(mod, rh, rl);
824 dstreg = DECODE_RM_WORD_REGISTER(rh);
826 srcoffset = decode_rmXX_address(mod, rl);
829 *dstreg = fetch_data_word(srcoffset);
830 M.x86.R_SS = fetch_data_word(srcoffset + 2);
831 } else { /* register to register */
835 DECODE_CLEAR_SEGOVR();
839 /****************************************************************************
841 Handles opcode 0x0f,0xb3
842 ****************************************************************************/
843 void x86emuOp2_btr_R(u8 X86EMU_UNUSED(op2))
850 DECODE_PRINTF("BTR\t");
851 FETCH_DECODE_MODRM(mod, rh, rl);
853 srcoffset = decode_rmXX_address(mod, rl);
855 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
859 shiftreg = DECODE_RM_LONG_REGISTER(rh);
861 bit = *shiftreg & 0x1F;
862 disp = (s16)*shiftreg >> 5;
863 srcval = fetch_data_long(srcoffset+disp);
865 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
866 store_data_long(srcoffset+disp, srcval & ~mask);
871 shiftreg = DECODE_RM_WORD_REGISTER(rh);
873 bit = *shiftreg & 0xF;
874 disp = (s16)*shiftreg >> 4;
875 srcval = fetch_data_word(srcoffset+disp);
876 mask = (u16)(0x1 << bit);
877 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
878 store_data_word(srcoffset+disp, (u16)(srcval & ~mask));
880 } else { /* register to register */
881 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
882 u32 *srcreg,*shiftreg;
885 srcreg = DECODE_RM_LONG_REGISTER(rl);
887 shiftreg = DECODE_RM_LONG_REGISTER(rh);
889 bit = *shiftreg & 0x1F;
891 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
894 u16 *srcreg,*shiftreg;
897 srcreg = DECODE_RM_WORD_REGISTER(rl);
899 shiftreg = DECODE_RM_WORD_REGISTER(rh);
901 bit = *shiftreg & 0xF;
902 mask = (u16)(0x1 << bit);
903 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
907 DECODE_CLEAR_SEGOVR();
911 /****************************************************************************
913 Handles opcode 0x0f,0xb4
914 ****************************************************************************/
915 void x86emuOp2_lfs_R_IMM(u8 X86EMU_UNUSED(op2))
922 DECODE_PRINTF("LFS\t");
923 FETCH_DECODE_MODRM(mod, rh, rl);
925 dstreg = DECODE_RM_WORD_REGISTER(rh);
927 srcoffset = decode_rmXX_address(mod, rl);
930 *dstreg = fetch_data_word(srcoffset);
931 M.x86.R_FS = fetch_data_word(srcoffset + 2);
932 } else { /* register to register */
936 DECODE_CLEAR_SEGOVR();
940 /****************************************************************************
942 Handles opcode 0x0f,0xb5
943 ****************************************************************************/
944 void x86emuOp2_lgs_R_IMM(u8 X86EMU_UNUSED(op2))
951 DECODE_PRINTF("LGS\t");
952 FETCH_DECODE_MODRM(mod, rh, rl);
954 dstreg = DECODE_RM_WORD_REGISTER(rh);
956 srcoffset = decode_rmXX_address(mod, rl);
959 *dstreg = fetch_data_word(srcoffset);
960 M.x86.R_GS = fetch_data_word(srcoffset + 2);
961 } else { /* register to register */
965 DECODE_CLEAR_SEGOVR();
969 /****************************************************************************
971 Handles opcode 0x0f,0xb6
972 ****************************************************************************/
973 void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
979 DECODE_PRINTF("MOVZX\t");
980 FETCH_DECODE_MODRM(mod, rh, rl);
982 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
986 destreg = DECODE_RM_LONG_REGISTER(rh);
988 srcoffset = decode_rmXX_address(mod, rl);
989 srcval = fetch_data_byte(srcoffset);
997 destreg = DECODE_RM_WORD_REGISTER(rh);
999 srcoffset = decode_rmXX_address(mod, rl);
1000 srcval = fetch_data_byte(srcoffset);
1001 DECODE_PRINTF("\n");
1005 } else { /* register to register */
1006 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1010 destreg = DECODE_RM_LONG_REGISTER(rh);
1012 srcreg = DECODE_RM_BYTE_REGISTER(rl);
1013 DECODE_PRINTF("\n");
1020 destreg = DECODE_RM_WORD_REGISTER(rh);
1022 srcreg = DECODE_RM_BYTE_REGISTER(rl);
1023 DECODE_PRINTF("\n");
1028 DECODE_CLEAR_SEGOVR();
1032 /****************************************************************************
1034 Handles opcode 0x0f,0xb7
1035 ****************************************************************************/
1036 void x86emuOp2_movzx_word_R_RM(u8 X86EMU_UNUSED(op2))
1045 DECODE_PRINTF("MOVZX\t");
1046 FETCH_DECODE_MODRM(mod, rh, rl);
1048 destreg = DECODE_RM_LONG_REGISTER(rh);
1050 srcoffset = decode_rmXX_address(mod, rl);
1051 srcval = fetch_data_word(srcoffset);
1052 DECODE_PRINTF("\n");
1055 } else { /* register to register */
1056 destreg = DECODE_RM_LONG_REGISTER(rh);
1058 srcreg = DECODE_RM_WORD_REGISTER(rl);
1059 DECODE_PRINTF("\n");
1063 DECODE_CLEAR_SEGOVR();
1067 /****************************************************************************
1069 Handles opcode 0x0f,0xba
1070 ****************************************************************************/
1071 void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
1079 FETCH_DECODE_MODRM(mod, rh, rl);
1082 DECODE_PRINTF("BT\t");
1085 DECODE_PRINTF("BTS\t");
1088 DECODE_PRINTF("BTR\t");
1091 DECODE_PRINTF("BTC\t");
1094 ERR_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n");
1096 printk("%04x:%04x: %02X%02X ILLEGAL EXTENDED X86 OPCODE EXTENSION!\n",
1097 M.x86.R_CS, M.x86.R_IP-3,op2, (mod<<6)|(rh<<3)|rl);
1102 srcoffset = decode_rmXX_address(mod, rl);
1103 shift = fetch_byte_imm();
1104 DECODE_PRINTF2(",%d\n", shift);
1107 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1111 srcval = fetch_data_long(srcoffset);
1112 mask = (0x1 << bit);
1113 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
1116 store_data_long(srcoffset, srcval | mask);
1119 store_data_long(srcoffset, srcval & ~mask);
1122 store_data_long(srcoffset, srcval ^ mask);
1131 srcval = fetch_data_word(srcoffset);
1132 mask = (0x1 << bit);
1133 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
1136 store_data_word(srcoffset, srcval | mask);
1139 store_data_word(srcoffset, srcval & ~mask);
1142 store_data_word(srcoffset, srcval ^ mask);
1148 } else { /* register to register */
1149 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1153 srcreg = DECODE_RM_LONG_REGISTER(rl);
1154 shift = fetch_byte_imm();
1155 DECODE_PRINTF2(",%d\n", shift);
1158 mask = (0x1 << bit);
1159 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
1177 srcreg = DECODE_RM_WORD_REGISTER(rl);
1178 shift = fetch_byte_imm();
1179 DECODE_PRINTF2(",%d\n", shift);
1182 mask = (0x1 << bit);
1183 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
1199 DECODE_CLEAR_SEGOVR();
1203 /****************************************************************************
1205 Handles opcode 0x0f,0xbb
1206 ****************************************************************************/
1207 void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
1214 DECODE_PRINTF("BTC\t");
1215 FETCH_DECODE_MODRM(mod, rh, rl);
1217 srcoffset = decode_rmXX_address(mod, rl);
1219 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1223 shiftreg = DECODE_RM_LONG_REGISTER(rh);
1225 bit = *shiftreg & 0x1F;
1226 disp = (s16)*shiftreg >> 5;
1227 srcval = fetch_data_long(srcoffset+disp);
1228 mask = (0x1 << bit);
1229 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
1230 store_data_long(srcoffset+disp, srcval ^ mask);
1235 shiftreg = DECODE_RM_WORD_REGISTER(rh);
1237 bit = *shiftreg & 0xF;
1238 disp = (s16)*shiftreg >> 4;
1239 srcval = fetch_data_word(srcoffset+disp);
1240 mask = (u16)(0x1 << bit);
1241 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
1242 store_data_word(srcoffset+disp, (u16)(srcval ^ mask));
1244 } else { /* register to register */
1245 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1246 u32 *srcreg,*shiftreg;
1249 srcreg = DECODE_RM_LONG_REGISTER(rl);
1251 shiftreg = DECODE_RM_LONG_REGISTER(rh);
1253 bit = *shiftreg & 0x1F;
1254 mask = (0x1 << bit);
1255 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
1258 u16 *srcreg,*shiftreg;
1261 srcreg = DECODE_RM_WORD_REGISTER(rl);
1263 shiftreg = DECODE_RM_WORD_REGISTER(rh);
1265 bit = *shiftreg & 0xF;
1266 mask = (u16)(0x1 << bit);
1267 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
1271 DECODE_CLEAR_SEGOVR();
1275 /****************************************************************************
1277 Handles opcode 0x0f,0xbc
1278 ****************************************************************************/
1279 void x86emuOp2_bsf(u8 X86EMU_UNUSED(op2))
1285 DECODE_PRINTF("BSF\t");
1286 FETCH_DECODE_MODRM(mod, rh, rl);
1288 srcoffset = decode_rmXX_address(mod, rl);
1290 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1291 u32 srcval, *dstreg;
1293 dstreg = DECODE_RM_LONG_REGISTER(rh);
1295 srcval = fetch_data_long(srcoffset);
1296 CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
1297 for(*dstreg = 0; *dstreg < 32; (*dstreg)++)
1298 if ((srcval >> *dstreg) & 1) break;
1300 u16 srcval, *dstreg;
1302 dstreg = DECODE_RM_WORD_REGISTER(rh);
1304 srcval = fetch_data_word(srcoffset);
1305 CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
1306 for(*dstreg = 0; *dstreg < 16; (*dstreg)++)
1307 if ((srcval >> *dstreg) & 1) break;
1309 } else { /* register to register */
1310 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1311 u32 *srcreg, *dstreg;
1313 srcreg = DECODE_RM_LONG_REGISTER(rl);
1315 dstreg = DECODE_RM_LONG_REGISTER(rh);
1317 CONDITIONAL_SET_FLAG(*srcreg == 0, F_ZF);
1318 for(*dstreg = 0; *dstreg < 32; (*dstreg)++)
1319 if ((*srcreg >> *dstreg) & 1) break;
1321 u16 *srcreg, *dstreg;
1323 srcreg = DECODE_RM_WORD_REGISTER(rl);
1325 dstreg = DECODE_RM_WORD_REGISTER(rh);
1327 CONDITIONAL_SET_FLAG(*srcreg == 0, F_ZF);
1328 for(*dstreg = 0; *dstreg < 16; (*dstreg)++)
1329 if ((*srcreg >> *dstreg) & 1) break;
1332 DECODE_CLEAR_SEGOVR();
1336 /****************************************************************************
1338 Handles opcode 0x0f,0xbd
1339 ****************************************************************************/
1340 void x86emuOp2_bsr(u8 X86EMU_UNUSED(op2))
1346 DECODE_PRINTF("BSF\t");
1347 FETCH_DECODE_MODRM(mod, rh, rl);
1349 srcoffset = decode_rmXX_address(mod, rl);
1351 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1352 u32 srcval, *dstreg;
1354 dstreg = DECODE_RM_LONG_REGISTER(rh);
1356 srcval = fetch_data_long(srcoffset);
1357 CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
1358 for(*dstreg = 31; *dstreg > 0; (*dstreg)--)
1359 if ((srcval >> *dstreg) & 1) break;
1361 u16 srcval, *dstreg;
1363 dstreg = DECODE_RM_WORD_REGISTER(rh);
1365 srcval = fetch_data_word(srcoffset);
1366 CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
1367 for(*dstreg = 15; *dstreg > 0; (*dstreg)--)
1368 if ((srcval >> *dstreg) & 1) break;
1370 } else { /* register to register */
1371 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1372 u32 *srcreg, *dstreg;
1374 srcreg = DECODE_RM_LONG_REGISTER(rl);
1376 dstreg = DECODE_RM_LONG_REGISTER(rh);
1378 CONDITIONAL_SET_FLAG(*srcreg == 0, F_ZF);
1379 for(*dstreg = 31; *dstreg > 0; (*dstreg)--)
1380 if ((*srcreg >> *dstreg) & 1) break;
1382 u16 *srcreg, *dstreg;
1384 srcreg = DECODE_RM_WORD_REGISTER(rl);
1386 dstreg = DECODE_RM_WORD_REGISTER(rh);
1388 CONDITIONAL_SET_FLAG(*srcreg == 0, F_ZF);
1389 for(*dstreg = 15; *dstreg > 0; (*dstreg)--)
1390 if ((*srcreg >> *dstreg) & 1) break;
1393 DECODE_CLEAR_SEGOVR();
1397 /****************************************************************************
1399 Handles opcode 0x0f,0xbe
1400 ****************************************************************************/
1401 void x86emuOp2_movsx_byte_R_RM(u8 X86EMU_UNUSED(op2))
1407 DECODE_PRINTF("MOVSX\t");
1408 FETCH_DECODE_MODRM(mod, rh, rl);
1410 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1414 destreg = DECODE_RM_LONG_REGISTER(rh);
1416 srcoffset = decode_rmXX_address(mod, rl);
1417 srcval = (s32)((s8)fetch_data_byte(srcoffset));
1418 DECODE_PRINTF("\n");
1425 destreg = DECODE_RM_WORD_REGISTER(rh);
1427 srcoffset = decode_rmXX_address(mod, rl);
1428 srcval = (s16)((s8)fetch_data_byte(srcoffset));
1429 DECODE_PRINTF("\n");
1433 } else { /* register to register */
1434 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1438 destreg = DECODE_RM_LONG_REGISTER(rh);
1440 srcreg = DECODE_RM_BYTE_REGISTER(rl);
1441 DECODE_PRINTF("\n");
1443 *destreg = (s32)((s8)*srcreg);
1448 destreg = DECODE_RM_WORD_REGISTER(rh);
1450 srcreg = DECODE_RM_BYTE_REGISTER(rl);
1451 DECODE_PRINTF("\n");
1453 *destreg = (s16)((s8)*srcreg);
1456 DECODE_CLEAR_SEGOVR();
1460 /****************************************************************************
1462 Handles opcode 0x0f,0xbf
1463 ****************************************************************************/
1464 void x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2))
1473 DECODE_PRINTF("MOVSX\t");
1474 FETCH_DECODE_MODRM(mod, rh, rl);
1476 destreg = DECODE_RM_LONG_REGISTER(rh);
1478 srcoffset = decode_rmXX_address(mod, rl);
1479 srcval = (s32)((s16)fetch_data_word(srcoffset));
1480 DECODE_PRINTF("\n");
1483 } else { /* register to register */
1484 destreg = DECODE_RM_LONG_REGISTER(rh);
1486 srcreg = DECODE_RM_WORD_REGISTER(rl);
1487 DECODE_PRINTF("\n");
1489 *destreg = (s32)((s16)*srcreg);
1491 DECODE_CLEAR_SEGOVR();
1495 /***************************************************************************
1496 * Double byte operation code table:
1497 **************************************************************************/
1498 void (*x86emu_optab2[256])(u8) =
1500 /* 0x00 */ x86emuOp2_illegal_op, /* Group F (ring 0 PM) */
1501 /* 0x01 */ x86emuOp2_illegal_op, /* Group G (ring 0 PM) */
1502 /* 0x02 */ x86emuOp2_illegal_op, /* lar (ring 0 PM) */
1503 /* 0x03 */ x86emuOp2_illegal_op, /* lsl (ring 0 PM) */
1504 /* 0x04 */ x86emuOp2_illegal_op,
1505 /* 0x05 */ x86emuOp2_illegal_op, /* loadall (undocumented) */
1506 /* 0x06 */ x86emuOp2_illegal_op, /* clts (ring 0 PM) */
1507 /* 0x07 */ x86emuOp2_illegal_op, /* loadall (undocumented) */
1508 /* 0x08 */ x86emuOp2_illegal_op, /* invd (ring 0 PM) */
1509 /* 0x09 */ x86emuOp2_illegal_op, /* wbinvd (ring 0 PM) */
1510 /* 0x0a */ x86emuOp2_illegal_op,
1511 /* 0x0b */ x86emuOp2_illegal_op,
1512 /* 0x0c */ x86emuOp2_illegal_op,
1513 /* 0x0d */ x86emuOp2_illegal_op,
1514 /* 0x0e */ x86emuOp2_illegal_op,
1515 /* 0x0f */ x86emuOp2_illegal_op,
1517 /* 0x10 */ x86emuOp2_illegal_op,
1518 /* 0x11 */ x86emuOp2_illegal_op,
1519 /* 0x12 */ x86emuOp2_illegal_op,
1520 /* 0x13 */ x86emuOp2_illegal_op,
1521 /* 0x14 */ x86emuOp2_illegal_op,
1522 /* 0x15 */ x86emuOp2_illegal_op,
1523 /* 0x16 */ x86emuOp2_illegal_op,
1524 /* 0x17 */ x86emuOp2_illegal_op,
1525 /* 0x18 */ x86emuOp2_illegal_op,
1526 /* 0x19 */ x86emuOp2_illegal_op,
1527 /* 0x1a */ x86emuOp2_illegal_op,
1528 /* 0x1b */ x86emuOp2_illegal_op,
1529 /* 0x1c */ x86emuOp2_illegal_op,
1530 /* 0x1d */ x86emuOp2_illegal_op,
1531 /* 0x1e */ x86emuOp2_illegal_op,
1532 /* 0x1f */ x86emuOp2_illegal_op,
1534 /* 0x20 */ x86emuOp2_illegal_op, /* mov reg32,creg (ring 0 PM) */
1535 /* 0x21 */ x86emuOp2_illegal_op, /* mov reg32,dreg (ring 0 PM) */
1536 /* 0x22 */ x86emuOp2_illegal_op, /* mov creg,reg32 (ring 0 PM) */
1537 /* 0x23 */ x86emuOp2_illegal_op, /* mov dreg,reg32 (ring 0 PM) */
1538 /* 0x24 */ x86emuOp2_illegal_op, /* mov reg32,treg (ring 0 PM) */
1539 /* 0x25 */ x86emuOp2_illegal_op,
1540 /* 0x26 */ x86emuOp2_illegal_op, /* mov treg,reg32 (ring 0 PM) */
1541 /* 0x27 */ x86emuOp2_illegal_op,
1542 /* 0x28 */ x86emuOp2_illegal_op,
1543 /* 0x29 */ x86emuOp2_illegal_op,
1544 /* 0x2a */ x86emuOp2_illegal_op,
1545 /* 0x2b */ x86emuOp2_illegal_op,
1546 /* 0x2c */ x86emuOp2_illegal_op,
1547 /* 0x2d */ x86emuOp2_illegal_op,
1548 /* 0x2e */ x86emuOp2_illegal_op,
1549 /* 0x2f */ x86emuOp2_illegal_op,
1551 /* 0x30 */ x86emuOp2_illegal_op,
1552 /* 0x31 */ x86emuOp2_illegal_op,
1553 /* 0x32 */ x86emuOp2_illegal_op,
1554 /* 0x33 */ x86emuOp2_illegal_op,
1555 /* 0x34 */ x86emuOp2_illegal_op,
1556 /* 0x35 */ x86emuOp2_illegal_op,
1557 /* 0x36 */ x86emuOp2_illegal_op,
1558 /* 0x37 */ x86emuOp2_illegal_op,
1559 /* 0x38 */ x86emuOp2_illegal_op,
1560 /* 0x39 */ x86emuOp2_illegal_op,
1561 /* 0x3a */ x86emuOp2_illegal_op,
1562 /* 0x3b */ x86emuOp2_illegal_op,
1563 /* 0x3c */ x86emuOp2_illegal_op,
1564 /* 0x3d */ x86emuOp2_illegal_op,
1565 /* 0x3e */ x86emuOp2_illegal_op,
1566 /* 0x3f */ x86emuOp2_illegal_op,
1568 /* 0x40 */ x86emuOp2_illegal_op,
1569 /* 0x41 */ x86emuOp2_illegal_op,
1570 /* 0x42 */ x86emuOp2_illegal_op,
1571 /* 0x43 */ x86emuOp2_illegal_op,
1572 /* 0x44 */ x86emuOp2_illegal_op,
1573 /* 0x45 */ x86emuOp2_illegal_op,
1574 /* 0x46 */ x86emuOp2_illegal_op,
1575 /* 0x47 */ x86emuOp2_illegal_op,
1576 /* 0x48 */ x86emuOp2_illegal_op,
1577 /* 0x49 */ x86emuOp2_illegal_op,
1578 /* 0x4a */ x86emuOp2_illegal_op,
1579 /* 0x4b */ x86emuOp2_illegal_op,
1580 /* 0x4c */ x86emuOp2_illegal_op,
1581 /* 0x4d */ x86emuOp2_illegal_op,
1582 /* 0x4e */ x86emuOp2_illegal_op,
1583 /* 0x4f */ x86emuOp2_illegal_op,
1585 /* 0x50 */ x86emuOp2_illegal_op,
1586 /* 0x51 */ x86emuOp2_illegal_op,
1587 /* 0x52 */ x86emuOp2_illegal_op,
1588 /* 0x53 */ x86emuOp2_illegal_op,
1589 /* 0x54 */ x86emuOp2_illegal_op,
1590 /* 0x55 */ x86emuOp2_illegal_op,
1591 /* 0x56 */ x86emuOp2_illegal_op,
1592 /* 0x57 */ x86emuOp2_illegal_op,
1593 /* 0x58 */ x86emuOp2_illegal_op,
1594 /* 0x59 */ x86emuOp2_illegal_op,
1595 /* 0x5a */ x86emuOp2_illegal_op,
1596 /* 0x5b */ x86emuOp2_illegal_op,
1597 /* 0x5c */ x86emuOp2_illegal_op,
1598 /* 0x5d */ x86emuOp2_illegal_op,
1599 /* 0x5e */ x86emuOp2_illegal_op,
1600 /* 0x5f */ x86emuOp2_illegal_op,
1602 /* 0x60 */ x86emuOp2_illegal_op,
1603 /* 0x61 */ x86emuOp2_illegal_op,
1604 /* 0x62 */ x86emuOp2_illegal_op,
1605 /* 0x63 */ x86emuOp2_illegal_op,
1606 /* 0x64 */ x86emuOp2_illegal_op,
1607 /* 0x65 */ x86emuOp2_illegal_op,
1608 /* 0x66 */ x86emuOp2_illegal_op,
1609 /* 0x67 */ x86emuOp2_illegal_op,
1610 /* 0x68 */ x86emuOp2_illegal_op,
1611 /* 0x69 */ x86emuOp2_illegal_op,
1612 /* 0x6a */ x86emuOp2_illegal_op,
1613 /* 0x6b */ x86emuOp2_illegal_op,
1614 /* 0x6c */ x86emuOp2_illegal_op,
1615 /* 0x6d */ x86emuOp2_illegal_op,
1616 /* 0x6e */ x86emuOp2_illegal_op,
1617 /* 0x6f */ x86emuOp2_illegal_op,
1619 /* 0x70 */ x86emuOp2_illegal_op,
1620 /* 0x71 */ x86emuOp2_illegal_op,
1621 /* 0x72 */ x86emuOp2_illegal_op,
1622 /* 0x73 */ x86emuOp2_illegal_op,
1623 /* 0x74 */ x86emuOp2_illegal_op,
1624 /* 0x75 */ x86emuOp2_illegal_op,
1625 /* 0x76 */ x86emuOp2_illegal_op,
1626 /* 0x77 */ x86emuOp2_illegal_op,
1627 /* 0x78 */ x86emuOp2_illegal_op,
1628 /* 0x79 */ x86emuOp2_illegal_op,
1629 /* 0x7a */ x86emuOp2_illegal_op,
1630 /* 0x7b */ x86emuOp2_illegal_op,
1631 /* 0x7c */ x86emuOp2_illegal_op,
1632 /* 0x7d */ x86emuOp2_illegal_op,
1633 /* 0x7e */ x86emuOp2_illegal_op,
1634 /* 0x7f */ x86emuOp2_illegal_op,
1636 /* 0x80 */ x86emuOp2_long_jump,
1637 /* 0x81 */ x86emuOp2_long_jump,
1638 /* 0x82 */ x86emuOp2_long_jump,
1639 /* 0x83 */ x86emuOp2_long_jump,
1640 /* 0x84 */ x86emuOp2_long_jump,
1641 /* 0x85 */ x86emuOp2_long_jump,
1642 /* 0x86 */ x86emuOp2_long_jump,
1643 /* 0x87 */ x86emuOp2_long_jump,
1644 /* 0x88 */ x86emuOp2_long_jump,
1645 /* 0x89 */ x86emuOp2_long_jump,
1646 /* 0x8a */ x86emuOp2_long_jump,
1647 /* 0x8b */ x86emuOp2_long_jump,
1648 /* 0x8c */ x86emuOp2_long_jump,
1649 /* 0x8d */ x86emuOp2_long_jump,
1650 /* 0x8e */ x86emuOp2_long_jump,
1651 /* 0x8f */ x86emuOp2_long_jump,
1653 /* 0x90 */ x86emuOp2_set_byte,
1654 /* 0x91 */ x86emuOp2_set_byte,
1655 /* 0x92 */ x86emuOp2_set_byte,
1656 /* 0x93 */ x86emuOp2_set_byte,
1657 /* 0x94 */ x86emuOp2_set_byte,
1658 /* 0x95 */ x86emuOp2_set_byte,
1659 /* 0x96 */ x86emuOp2_set_byte,
1660 /* 0x97 */ x86emuOp2_set_byte,
1661 /* 0x98 */ x86emuOp2_set_byte,
1662 /* 0x99 */ x86emuOp2_set_byte,
1663 /* 0x9a */ x86emuOp2_set_byte,
1664 /* 0x9b */ x86emuOp2_set_byte,
1665 /* 0x9c */ x86emuOp2_set_byte,
1666 /* 0x9d */ x86emuOp2_set_byte,
1667 /* 0x9e */ x86emuOp2_set_byte,
1668 /* 0x9f */ x86emuOp2_set_byte,
1670 /* 0xa0 */ x86emuOp2_push_FS,
1671 /* 0xa1 */ x86emuOp2_pop_FS,
1672 /* 0xa2 */ x86emuOp2_illegal_op,
1673 /* 0xa3 */ x86emuOp2_bt_R,
1674 /* 0xa4 */ x86emuOp2_shld_IMM,
1675 /* 0xa5 */ x86emuOp2_shld_CL,
1676 /* 0xa6 */ x86emuOp2_illegal_op,
1677 /* 0xa7 */ x86emuOp2_illegal_op,
1678 /* 0xa8 */ x86emuOp2_push_GS,
1679 /* 0xa9 */ x86emuOp2_pop_GS,
1680 /* 0xaa */ x86emuOp2_illegal_op,
1681 /* 0xab */ x86emuOp2_bt_R,
1682 /* 0xac */ x86emuOp2_shrd_IMM,
1683 /* 0xad */ x86emuOp2_shrd_CL,
1684 /* 0xae */ x86emuOp2_illegal_op,
1685 /* 0xaf */ x86emuOp2_imul_R_RM,
1687 /* 0xb0 */ x86emuOp2_illegal_op, /* TODO: cmpxchg */
1688 /* 0xb1 */ x86emuOp2_illegal_op, /* TODO: cmpxchg */
1689 /* 0xb2 */ x86emuOp2_lss_R_IMM,
1690 /* 0xb3 */ x86emuOp2_btr_R,
1691 /* 0xb4 */ x86emuOp2_lfs_R_IMM,
1692 /* 0xb5 */ x86emuOp2_lgs_R_IMM,
1693 /* 0xb6 */ x86emuOp2_movzx_byte_R_RM,
1694 /* 0xb7 */ x86emuOp2_movzx_word_R_RM,
1695 /* 0xb8 */ x86emuOp2_illegal_op,
1696 /* 0xb9 */ x86emuOp2_illegal_op,
1697 /* 0xba */ x86emuOp2_btX_I,
1698 /* 0xbb */ x86emuOp2_btc_R,
1699 /* 0xbc */ x86emuOp2_bsf,
1700 /* 0xbd */ x86emuOp2_bsr,
1701 /* 0xbe */ x86emuOp2_movsx_byte_R_RM,
1702 /* 0xbf */ x86emuOp2_movsx_word_R_RM,
1704 /* 0xc0 */ x86emuOp2_illegal_op, /* TODO: xadd */
1705 /* 0xc1 */ x86emuOp2_illegal_op, /* TODO: xadd */
1706 /* 0xc2 */ x86emuOp2_illegal_op,
1707 /* 0xc3 */ x86emuOp2_illegal_op,
1708 /* 0xc4 */ x86emuOp2_illegal_op,
1709 /* 0xc5 */ x86emuOp2_illegal_op,
1710 /* 0xc6 */ x86emuOp2_illegal_op,
1711 /* 0xc7 */ x86emuOp2_illegal_op,
1712 /* 0xc8 */ x86emuOp2_illegal_op, /* TODO: bswap */
1713 /* 0xc9 */ x86emuOp2_illegal_op, /* TODO: bswap */
1714 /* 0xca */ x86emuOp2_illegal_op, /* TODO: bswap */
1715 /* 0xcb */ x86emuOp2_illegal_op, /* TODO: bswap */
1716 /* 0xcc */ x86emuOp2_illegal_op, /* TODO: bswap */
1717 /* 0xcd */ x86emuOp2_illegal_op, /* TODO: bswap */
1718 /* 0xce */ x86emuOp2_illegal_op, /* TODO: bswap */
1719 /* 0xcf */ x86emuOp2_illegal_op, /* TODO: bswap */
1721 /* 0xd0 */ x86emuOp2_illegal_op,
1722 /* 0xd1 */ x86emuOp2_illegal_op,
1723 /* 0xd2 */ x86emuOp2_illegal_op,
1724 /* 0xd3 */ x86emuOp2_illegal_op,
1725 /* 0xd4 */ x86emuOp2_illegal_op,
1726 /* 0xd5 */ x86emuOp2_illegal_op,
1727 /* 0xd6 */ x86emuOp2_illegal_op,
1728 /* 0xd7 */ x86emuOp2_illegal_op,
1729 /* 0xd8 */ x86emuOp2_illegal_op,
1730 /* 0xd9 */ x86emuOp2_illegal_op,
1731 /* 0xda */ x86emuOp2_illegal_op,
1732 /* 0xdb */ x86emuOp2_illegal_op,
1733 /* 0xdc */ x86emuOp2_illegal_op,
1734 /* 0xdd */ x86emuOp2_illegal_op,
1735 /* 0xde */ x86emuOp2_illegal_op,
1736 /* 0xdf */ x86emuOp2_illegal_op,
1738 /* 0xe0 */ x86emuOp2_illegal_op,
1739 /* 0xe1 */ x86emuOp2_illegal_op,
1740 /* 0xe2 */ x86emuOp2_illegal_op,
1741 /* 0xe3 */ x86emuOp2_illegal_op,
1742 /* 0xe4 */ x86emuOp2_illegal_op,
1743 /* 0xe5 */ x86emuOp2_illegal_op,
1744 /* 0xe6 */ x86emuOp2_illegal_op,
1745 /* 0xe7 */ x86emuOp2_illegal_op,
1746 /* 0xe8 */ x86emuOp2_illegal_op,
1747 /* 0xe9 */ x86emuOp2_illegal_op,
1748 /* 0xea */ x86emuOp2_illegal_op,
1749 /* 0xeb */ x86emuOp2_illegal_op,
1750 /* 0xec */ x86emuOp2_illegal_op,
1751 /* 0xed */ x86emuOp2_illegal_op,
1752 /* 0xee */ x86emuOp2_illegal_op,
1753 /* 0xef */ x86emuOp2_illegal_op,
1755 /* 0xf0 */ x86emuOp2_illegal_op,
1756 /* 0xf1 */ x86emuOp2_illegal_op,
1757 /* 0xf2 */ x86emuOp2_illegal_op,
1758 /* 0xf3 */ x86emuOp2_illegal_op,
1759 /* 0xf4 */ x86emuOp2_illegal_op,
1760 /* 0xf5 */ x86emuOp2_illegal_op,
1761 /* 0xf6 */ x86emuOp2_illegal_op,
1762 /* 0xf7 */ x86emuOp2_illegal_op,
1763 /* 0xf8 */ x86emuOp2_illegal_op,
1764 /* 0xf9 */ x86emuOp2_illegal_op,
1765 /* 0xfa */ x86emuOp2_illegal_op,
1766 /* 0xfb */ x86emuOp2_illegal_op,
1767 /* 0xfc */ x86emuOp2_illegal_op,
1768 /* 0xfd */ x86emuOp2_illegal_op,
1769 /* 0xfe */ x86emuOp2_illegal_op,
1770 /* 0xff */ x86emuOp2_illegal_op,