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 ****************************************************************************/
45 #include <linux/compiler.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 DECODE_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);
249 store_data_byte(destoffset, cond ? 0x01 : 0x00);
250 } else { /* register to register */
251 destreg = DECODE_RM_BYTE_REGISTER(rl);
253 *destreg = cond ? 0x01 : 0x00;
255 DECODE_CLEAR_SEGOVR();
259 /****************************************************************************
261 Handles opcode 0x0f,0xa0
262 ****************************************************************************/
263 void x86emuOp2_push_FS(u8 X86EMU_UNUSED(op2))
266 DECODE_PRINTF("PUSH\tFS\n");
268 push_word(M.x86.R_FS);
269 DECODE_CLEAR_SEGOVR();
273 /****************************************************************************
275 Handles opcode 0x0f,0xa1
276 ****************************************************************************/
277 void x86emuOp2_pop_FS(u8 X86EMU_UNUSED(op2))
280 DECODE_PRINTF("POP\tFS\n");
282 M.x86.R_FS = pop_word();
283 DECODE_CLEAR_SEGOVR();
287 /****************************************************************************
289 Handles opcode 0x0f,0xa3
290 ****************************************************************************/
291 void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
298 DECODE_PRINTF("BT\t");
299 FETCH_DECODE_MODRM(mod, rh, rl);
301 srcoffset = decode_rmXX_address(mod, rl);
302 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
307 shiftreg = DECODE_RM_LONG_REGISTER(rh);
309 bit = *shiftreg & 0x1F;
310 disp = (s16)*shiftreg >> 5;
311 srcval = fetch_data_long(srcoffset+disp);
312 CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
318 shiftreg = DECODE_RM_WORD_REGISTER(rh);
320 bit = *shiftreg & 0xF;
321 disp = (s16)*shiftreg >> 4;
322 srcval = fetch_data_word(srcoffset+disp);
323 CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
325 } else { /* register to register */
326 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
327 u32 *srcreg,*shiftreg;
329 srcreg = DECODE_RM_LONG_REGISTER(rl);
331 shiftreg = DECODE_RM_LONG_REGISTER(rh);
333 bit = *shiftreg & 0x1F;
334 CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit),F_CF);
336 u16 *srcreg,*shiftreg;
338 srcreg = DECODE_RM_WORD_REGISTER(rl);
340 shiftreg = DECODE_RM_WORD_REGISTER(rh);
342 bit = *shiftreg & 0xF;
343 CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit),F_CF);
346 DECODE_CLEAR_SEGOVR();
350 /****************************************************************************
352 Handles opcode 0x0f,0xa4
353 ****************************************************************************/
354 void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
361 DECODE_PRINTF("SHLD\t");
362 FETCH_DECODE_MODRM(mod, rh, rl);
364 destoffset = decode_rmXX_address(mod, rl);
365 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
370 shiftreg = DECODE_RM_LONG_REGISTER(rh);
372 shift = fetch_byte_imm();
373 DECODE_PRINTF2("%d\n", shift);
375 destval = fetch_data_long(destoffset);
376 destval = shld_long(destval,*shiftreg,shift);
377 store_data_long(destoffset, destval);
383 shiftreg = DECODE_RM_WORD_REGISTER(rh);
385 shift = fetch_byte_imm();
386 DECODE_PRINTF2("%d\n", shift);
388 destval = fetch_data_word(destoffset);
389 destval = shld_word(destval,*shiftreg,shift);
390 store_data_word(destoffset, destval);
392 } else { /* register to register */
393 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
394 u32 *destreg,*shiftreg;
396 destreg = DECODE_RM_LONG_REGISTER(rl);
398 shiftreg = DECODE_RM_LONG_REGISTER(rh);
400 shift = fetch_byte_imm();
401 DECODE_PRINTF2("%d\n", shift);
403 *destreg = shld_long(*destreg,*shiftreg,shift);
405 u16 *destreg,*shiftreg;
407 destreg = DECODE_RM_WORD_REGISTER(rl);
409 shiftreg = DECODE_RM_WORD_REGISTER(rh);
411 shift = fetch_byte_imm();
412 DECODE_PRINTF2("%d\n", shift);
414 *destreg = shld_word(*destreg,*shiftreg,shift);
417 DECODE_CLEAR_SEGOVR();
421 /****************************************************************************
423 Handles opcode 0x0f,0xa5
424 ****************************************************************************/
425 void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
431 DECODE_PRINTF("SHLD\t");
432 FETCH_DECODE_MODRM(mod, rh, rl);
434 destoffset = decode_rmXX_address(mod, rl);
435 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
440 shiftreg = DECODE_RM_LONG_REGISTER(rh);
441 DECODE_PRINTF(",CL\n");
443 destval = fetch_data_long(destoffset);
444 destval = shld_long(destval,*shiftreg,M.x86.R_CL);
445 store_data_long(destoffset, destval);
451 shiftreg = DECODE_RM_WORD_REGISTER(rh);
452 DECODE_PRINTF(",CL\n");
454 destval = fetch_data_word(destoffset);
455 destval = shld_word(destval,*shiftreg,M.x86.R_CL);
456 store_data_word(destoffset, destval);
458 } else { /* register to register */
459 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
460 u32 *destreg,*shiftreg;
462 destreg = DECODE_RM_LONG_REGISTER(rl);
464 shiftreg = DECODE_RM_LONG_REGISTER(rh);
465 DECODE_PRINTF(",CL\n");
467 *destreg = shld_long(*destreg,*shiftreg,M.x86.R_CL);
469 u16 *destreg,*shiftreg;
471 destreg = DECODE_RM_WORD_REGISTER(rl);
473 shiftreg = DECODE_RM_WORD_REGISTER(rh);
474 DECODE_PRINTF(",CL\n");
476 *destreg = shld_word(*destreg,*shiftreg,M.x86.R_CL);
479 DECODE_CLEAR_SEGOVR();
483 /****************************************************************************
485 Handles opcode 0x0f,0xa8
486 ****************************************************************************/
487 void x86emuOp2_push_GS(u8 X86EMU_UNUSED(op2))
490 DECODE_PRINTF("PUSH\tGS\n");
492 push_word(M.x86.R_GS);
493 DECODE_CLEAR_SEGOVR();
497 /****************************************************************************
499 Handles opcode 0x0f,0xa9
500 ****************************************************************************/
501 void x86emuOp2_pop_GS(u8 X86EMU_UNUSED(op2))
504 DECODE_PRINTF("POP\tGS\n");
506 M.x86.R_GS = pop_word();
507 DECODE_CLEAR_SEGOVR();
511 /****************************************************************************
513 Handles opcode 0x0f,0xaa
514 ****************************************************************************/
515 void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
522 DECODE_PRINTF("BTS\t");
523 FETCH_DECODE_MODRM(mod, rh, rl);
525 srcoffset = decode_rmXX_address(mod, rl);
526 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
531 shiftreg = DECODE_RM_LONG_REGISTER(rh);
533 bit = *shiftreg & 0x1F;
534 disp = (s16)*shiftreg >> 5;
535 srcval = fetch_data_long(srcoffset+disp);
537 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
538 store_data_long(srcoffset+disp, srcval | mask);
544 shiftreg = DECODE_RM_WORD_REGISTER(rh);
546 bit = *shiftreg & 0xF;
547 disp = (s16)*shiftreg >> 4;
548 srcval = fetch_data_word(srcoffset+disp);
549 mask = (u16)(0x1 << bit);
550 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
551 store_data_word(srcoffset+disp, srcval | mask);
553 } else { /* register to register */
554 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
555 u32 *srcreg,*shiftreg;
558 srcreg = DECODE_RM_LONG_REGISTER(rl);
560 shiftreg = DECODE_RM_LONG_REGISTER(rh);
562 bit = *shiftreg & 0x1F;
564 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
567 u16 *srcreg,*shiftreg;
570 srcreg = DECODE_RM_WORD_REGISTER(rl);
572 shiftreg = DECODE_RM_WORD_REGISTER(rh);
574 bit = *shiftreg & 0xF;
575 mask = (u16)(0x1 << bit);
576 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
580 DECODE_CLEAR_SEGOVR();
584 /****************************************************************************
586 Handles opcode 0x0f,0xac
587 ****************************************************************************/
588 void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
595 DECODE_PRINTF("SHLD\t");
596 FETCH_DECODE_MODRM(mod, rh, rl);
598 destoffset = decode_rmXX_address(mod, rl);
599 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
604 shiftreg = DECODE_RM_LONG_REGISTER(rh);
606 shift = fetch_byte_imm();
607 DECODE_PRINTF2("%d\n", shift);
609 destval = fetch_data_long(destoffset);
610 destval = shrd_long(destval,*shiftreg,shift);
611 store_data_long(destoffset, destval);
617 shiftreg = DECODE_RM_WORD_REGISTER(rh);
619 shift = fetch_byte_imm();
620 DECODE_PRINTF2("%d\n", shift);
622 destval = fetch_data_word(destoffset);
623 destval = shrd_word(destval,*shiftreg,shift);
624 store_data_word(destoffset, destval);
626 } else { /* register to register */
627 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
628 u32 *destreg,*shiftreg;
630 destreg = DECODE_RM_LONG_REGISTER(rl);
632 shiftreg = DECODE_RM_LONG_REGISTER(rh);
634 shift = fetch_byte_imm();
635 DECODE_PRINTF2("%d\n", shift);
637 *destreg = shrd_long(*destreg,*shiftreg,shift);
639 u16 *destreg,*shiftreg;
641 destreg = DECODE_RM_WORD_REGISTER(rl);
643 shiftreg = DECODE_RM_WORD_REGISTER(rh);
645 shift = fetch_byte_imm();
646 DECODE_PRINTF2("%d\n", shift);
648 *destreg = shrd_word(*destreg,*shiftreg,shift);
651 DECODE_CLEAR_SEGOVR();
655 /****************************************************************************
657 Handles opcode 0x0f,0xad
658 ****************************************************************************/
659 void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
665 DECODE_PRINTF("SHLD\t");
666 FETCH_DECODE_MODRM(mod, rh, rl);
668 destoffset = decode_rmXX_address(mod, rl);
670 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
674 shiftreg = DECODE_RM_LONG_REGISTER(rh);
675 DECODE_PRINTF(",CL\n");
677 destval = fetch_data_long(destoffset);
678 destval = shrd_long(destval,*shiftreg,M.x86.R_CL);
679 store_data_long(destoffset, destval);
684 shiftreg = DECODE_RM_WORD_REGISTER(rh);
685 DECODE_PRINTF(",CL\n");
687 destval = fetch_data_word(destoffset);
688 destval = shrd_word(destval,*shiftreg,M.x86.R_CL);
689 store_data_word(destoffset, destval);
691 } else { /* register to register */
692 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
693 u32 *destreg,*shiftreg;
695 destreg = DECODE_RM_LONG_REGISTER(rl);
697 shiftreg = DECODE_RM_LONG_REGISTER(rh);
698 DECODE_PRINTF(",CL\n");
700 *destreg = shrd_long(*destreg,*shiftreg,M.x86.R_CL);
702 u16 *destreg,*shiftreg;
704 destreg = DECODE_RM_WORD_REGISTER(rl);
706 shiftreg = DECODE_RM_WORD_REGISTER(rh);
707 DECODE_PRINTF(",CL\n");
709 *destreg = shrd_word(*destreg,*shiftreg,M.x86.R_CL);
712 DECODE_CLEAR_SEGOVR();
716 /****************************************************************************
718 Handles opcode 0x0f,0xaf
719 ****************************************************************************/
720 void x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
726 DECODE_PRINTF("IMUL\t");
727 FETCH_DECODE_MODRM(mod, rh, rl);
729 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
734 destreg = DECODE_RM_LONG_REGISTER(rh);
736 srcoffset = decode_rmXX_address(mod, rl);
737 srcval = fetch_data_long(srcoffset);
739 imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)srcval);
747 *destreg = (u32)res_lo;
753 destreg = DECODE_RM_WORD_REGISTER(rh);
755 srcoffset = decode_rmXX_address(mod, rl);
756 srcval = fetch_data_word(srcoffset);
758 res = (s16)*destreg * (s16)srcval;
768 } else { /* register to register */
769 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
770 u32 *destreg,*srcreg;
773 destreg = DECODE_RM_LONG_REGISTER(rh);
775 srcreg = DECODE_RM_LONG_REGISTER(rl);
777 imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)*srcreg);
785 *destreg = (u32)res_lo;
787 u16 *destreg,*srcreg;
790 destreg = DECODE_RM_WORD_REGISTER(rh);
792 srcreg = DECODE_RM_WORD_REGISTER(rl);
793 res = (s16)*destreg * (s16)*srcreg;
804 DECODE_CLEAR_SEGOVR();
808 /****************************************************************************
810 Handles opcode 0x0f,0xb2
811 ****************************************************************************/
812 void x86emuOp2_lss_R_IMM(u8 X86EMU_UNUSED(op2))
819 DECODE_PRINTF("LSS\t");
820 FETCH_DECODE_MODRM(mod, rh, rl);
822 dstreg = DECODE_RM_WORD_REGISTER(rh);
824 srcoffset = decode_rmXX_address(mod, rl);
827 *dstreg = fetch_data_word(srcoffset);
828 M.x86.R_SS = fetch_data_word(srcoffset + 2);
829 } else { /* register to register */
833 DECODE_CLEAR_SEGOVR();
837 /****************************************************************************
839 Handles opcode 0x0f,0xb3
840 ****************************************************************************/
841 void x86emuOp2_btr_R(u8 X86EMU_UNUSED(op2))
848 DECODE_PRINTF("BTR\t");
849 FETCH_DECODE_MODRM(mod, rh, rl);
851 srcoffset = decode_rmXX_address(mod, rl);
853 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
857 shiftreg = DECODE_RM_LONG_REGISTER(rh);
859 bit = *shiftreg & 0x1F;
860 disp = (s16)*shiftreg >> 5;
861 srcval = fetch_data_long(srcoffset+disp);
863 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
864 store_data_long(srcoffset+disp, srcval & ~mask);
869 shiftreg = DECODE_RM_WORD_REGISTER(rh);
871 bit = *shiftreg & 0xF;
872 disp = (s16)*shiftreg >> 4;
873 srcval = fetch_data_word(srcoffset+disp);
874 mask = (u16)(0x1 << bit);
875 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
876 store_data_word(srcoffset+disp, (u16)(srcval & ~mask));
878 } else { /* register to register */
879 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
880 u32 *srcreg,*shiftreg;
883 srcreg = DECODE_RM_LONG_REGISTER(rl);
885 shiftreg = DECODE_RM_LONG_REGISTER(rh);
887 bit = *shiftreg & 0x1F;
889 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
892 u16 *srcreg,*shiftreg;
895 srcreg = DECODE_RM_WORD_REGISTER(rl);
897 shiftreg = DECODE_RM_WORD_REGISTER(rh);
899 bit = *shiftreg & 0xF;
900 mask = (u16)(0x1 << bit);
901 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
905 DECODE_CLEAR_SEGOVR();
909 /****************************************************************************
911 Handles opcode 0x0f,0xb4
912 ****************************************************************************/
913 void x86emuOp2_lfs_R_IMM(u8 X86EMU_UNUSED(op2))
920 DECODE_PRINTF("LFS\t");
921 FETCH_DECODE_MODRM(mod, rh, rl);
923 dstreg = DECODE_RM_WORD_REGISTER(rh);
925 srcoffset = decode_rmXX_address(mod, rl);
928 *dstreg = fetch_data_word(srcoffset);
929 M.x86.R_FS = fetch_data_word(srcoffset + 2);
930 } else { /* register to register */
934 DECODE_CLEAR_SEGOVR();
938 /****************************************************************************
940 Handles opcode 0x0f,0xb5
941 ****************************************************************************/
942 void x86emuOp2_lgs_R_IMM(u8 X86EMU_UNUSED(op2))
949 DECODE_PRINTF("LGS\t");
950 FETCH_DECODE_MODRM(mod, rh, rl);
952 dstreg = DECODE_RM_WORD_REGISTER(rh);
954 srcoffset = decode_rmXX_address(mod, rl);
957 *dstreg = fetch_data_word(srcoffset);
958 M.x86.R_GS = fetch_data_word(srcoffset + 2);
959 } else { /* register to register */
963 DECODE_CLEAR_SEGOVR();
967 /****************************************************************************
969 Handles opcode 0x0f,0xb6
970 ****************************************************************************/
971 void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
977 DECODE_PRINTF("MOVZX\t");
978 FETCH_DECODE_MODRM(mod, rh, rl);
980 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
984 destreg = DECODE_RM_LONG_REGISTER(rh);
986 srcoffset = decode_rmXX_address(mod, rl);
987 srcval = fetch_data_byte(srcoffset);
995 destreg = DECODE_RM_WORD_REGISTER(rh);
997 srcoffset = decode_rmXX_address(mod, rl);
998 srcval = fetch_data_byte(srcoffset);
1003 } else { /* register to register */
1004 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1008 destreg = DECODE_RM_LONG_REGISTER(rh);
1010 srcreg = DECODE_RM_BYTE_REGISTER(rl);
1011 DECODE_PRINTF("\n");
1018 destreg = DECODE_RM_WORD_REGISTER(rh);
1020 srcreg = DECODE_RM_BYTE_REGISTER(rl);
1021 DECODE_PRINTF("\n");
1026 DECODE_CLEAR_SEGOVR();
1030 /****************************************************************************
1032 Handles opcode 0x0f,0xb7
1033 ****************************************************************************/
1034 void x86emuOp2_movzx_word_R_RM(u8 X86EMU_UNUSED(op2))
1043 DECODE_PRINTF("MOVZX\t");
1044 FETCH_DECODE_MODRM(mod, rh, rl);
1046 destreg = DECODE_RM_LONG_REGISTER(rh);
1048 srcoffset = decode_rmXX_address(mod, rl);
1049 srcval = fetch_data_word(srcoffset);
1050 DECODE_PRINTF("\n");
1053 } else { /* register to register */
1054 destreg = DECODE_RM_LONG_REGISTER(rh);
1056 srcreg = DECODE_RM_WORD_REGISTER(rl);
1057 DECODE_PRINTF("\n");
1061 DECODE_CLEAR_SEGOVR();
1065 /****************************************************************************
1067 Handles opcode 0x0f,0xba
1068 ****************************************************************************/
1069 void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
1077 FETCH_DECODE_MODRM(mod, rh, rl);
1080 DECODE_PRINTF("BT\t");
1083 DECODE_PRINTF("BTS\t");
1086 DECODE_PRINTF("BTR\t");
1089 DECODE_PRINTF("BTC\t");
1092 DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n");
1094 printk("%04x:%04x: %02X%02X ILLEGAL EXTENDED X86 OPCODE EXTENSION!\n",
1095 M.x86.R_CS, M.x86.R_IP-3,op2, (mod<<6)|(rh<<3)|rl);
1100 srcoffset = decode_rmXX_address(mod, rl);
1101 shift = fetch_byte_imm();
1102 DECODE_PRINTF2(",%d\n", shift);
1105 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1109 srcval = fetch_data_long(srcoffset);
1110 mask = (0x1 << bit);
1111 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
1114 store_data_long(srcoffset, srcval | mask);
1117 store_data_long(srcoffset, srcval & ~mask);
1120 store_data_long(srcoffset, srcval ^ mask);
1129 srcval = fetch_data_word(srcoffset);
1130 mask = (0x1 << bit);
1131 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
1134 store_data_word(srcoffset, srcval | mask);
1137 store_data_word(srcoffset, srcval & ~mask);
1140 store_data_word(srcoffset, srcval ^ mask);
1146 } else { /* register to register */
1147 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1151 srcreg = DECODE_RM_LONG_REGISTER(rl);
1152 shift = fetch_byte_imm();
1153 DECODE_PRINTF2(",%d\n", shift);
1156 mask = (0x1 << bit);
1157 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
1175 srcreg = DECODE_RM_WORD_REGISTER(rl);
1176 shift = fetch_byte_imm();
1177 DECODE_PRINTF2(",%d\n", shift);
1180 mask = (0x1 << bit);
1181 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
1197 DECODE_CLEAR_SEGOVR();
1201 /****************************************************************************
1203 Handles opcode 0x0f,0xbb
1204 ****************************************************************************/
1205 void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
1212 DECODE_PRINTF("BTC\t");
1213 FETCH_DECODE_MODRM(mod, rh, rl);
1215 srcoffset = decode_rmXX_address(mod, rl);
1217 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1221 shiftreg = DECODE_RM_LONG_REGISTER(rh);
1223 bit = *shiftreg & 0x1F;
1224 disp = (s16)*shiftreg >> 5;
1225 srcval = fetch_data_long(srcoffset+disp);
1226 mask = (0x1 << bit);
1227 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
1228 store_data_long(srcoffset+disp, srcval ^ mask);
1233 shiftreg = DECODE_RM_WORD_REGISTER(rh);
1235 bit = *shiftreg & 0xF;
1236 disp = (s16)*shiftreg >> 4;
1237 srcval = fetch_data_word(srcoffset+disp);
1238 mask = (u16)(0x1 << bit);
1239 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
1240 store_data_word(srcoffset+disp, (u16)(srcval ^ mask));
1242 } else { /* register to register */
1243 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1244 u32 *srcreg,*shiftreg;
1247 srcreg = DECODE_RM_LONG_REGISTER(rl);
1249 shiftreg = DECODE_RM_LONG_REGISTER(rh);
1251 bit = *shiftreg & 0x1F;
1252 mask = (0x1 << bit);
1253 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
1256 u16 *srcreg,*shiftreg;
1259 srcreg = DECODE_RM_WORD_REGISTER(rl);
1261 shiftreg = DECODE_RM_WORD_REGISTER(rh);
1263 bit = *shiftreg & 0xF;
1264 mask = (u16)(0x1 << bit);
1265 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
1269 DECODE_CLEAR_SEGOVR();
1273 /****************************************************************************
1275 Handles opcode 0x0f,0xbc
1276 ****************************************************************************/
1277 void x86emuOp2_bsf(u8 X86EMU_UNUSED(op2))
1283 DECODE_PRINTF("BSF\n");
1284 FETCH_DECODE_MODRM(mod, rh, rl);
1286 srcoffset = decode_rmXX_address(mod, rl);
1288 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1289 u32 srcval, *dstreg;
1291 dstreg = DECODE_RM_LONG_REGISTER(rh);
1293 srcval = fetch_data_long(srcoffset);
1294 CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
1295 for(*dstreg = 0; *dstreg < 32; (*dstreg)++)
1296 if ((srcval >> *dstreg) & 1) break;
1298 u16 srcval, *dstreg;
1300 dstreg = DECODE_RM_WORD_REGISTER(rh);
1302 srcval = fetch_data_word(srcoffset);
1303 CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
1304 for(*dstreg = 0; *dstreg < 16; (*dstreg)++)
1305 if ((srcval >> *dstreg) & 1) break;
1307 } else { /* register to register */
1308 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1309 u32 *srcreg, *dstreg;
1311 srcreg = DECODE_RM_LONG_REGISTER(rl);
1313 dstreg = DECODE_RM_LONG_REGISTER(rh);
1315 CONDITIONAL_SET_FLAG(*srcreg == 0, F_ZF);
1316 for(*dstreg = 0; *dstreg < 32; (*dstreg)++)
1317 if ((*srcreg >> *dstreg) & 1) break;
1319 u16 *srcreg, *dstreg;
1321 srcreg = DECODE_RM_WORD_REGISTER(rl);
1323 dstreg = DECODE_RM_WORD_REGISTER(rh);
1325 CONDITIONAL_SET_FLAG(*srcreg == 0, F_ZF);
1326 for(*dstreg = 0; *dstreg < 16; (*dstreg)++)
1327 if ((*srcreg >> *dstreg) & 1) break;
1330 DECODE_CLEAR_SEGOVR();
1334 /****************************************************************************
1336 Handles opcode 0x0f,0xbd
1337 ****************************************************************************/
1338 void x86emuOp2_bsr(u8 X86EMU_UNUSED(op2))
1344 DECODE_PRINTF("BSF\n");
1345 FETCH_DECODE_MODRM(mod, rh, rl);
1347 srcoffset = decode_rmXX_address(mod, rl);
1349 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1350 u32 srcval, *dstreg;
1352 dstreg = DECODE_RM_LONG_REGISTER(rh);
1354 srcval = fetch_data_long(srcoffset);
1355 CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
1356 for(*dstreg = 31; *dstreg > 0; (*dstreg)--)
1357 if ((srcval >> *dstreg) & 1) break;
1359 u16 srcval, *dstreg;
1361 dstreg = DECODE_RM_WORD_REGISTER(rh);
1363 srcval = fetch_data_word(srcoffset);
1364 CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
1365 for(*dstreg = 15; *dstreg > 0; (*dstreg)--)
1366 if ((srcval >> *dstreg) & 1) break;
1368 } else { /* register to register */
1369 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1370 u32 *srcreg, *dstreg;
1372 srcreg = DECODE_RM_LONG_REGISTER(rl);
1374 dstreg = DECODE_RM_LONG_REGISTER(rh);
1376 CONDITIONAL_SET_FLAG(*srcreg == 0, F_ZF);
1377 for(*dstreg = 31; *dstreg > 0; (*dstreg)--)
1378 if ((*srcreg >> *dstreg) & 1) break;
1380 u16 *srcreg, *dstreg;
1382 srcreg = DECODE_RM_WORD_REGISTER(rl);
1384 dstreg = DECODE_RM_WORD_REGISTER(rh);
1386 CONDITIONAL_SET_FLAG(*srcreg == 0, F_ZF);
1387 for(*dstreg = 15; *dstreg > 0; (*dstreg)--)
1388 if ((*srcreg >> *dstreg) & 1) break;
1391 DECODE_CLEAR_SEGOVR();
1395 /****************************************************************************
1397 Handles opcode 0x0f,0xbe
1398 ****************************************************************************/
1399 void x86emuOp2_movsx_byte_R_RM(u8 X86EMU_UNUSED(op2))
1405 DECODE_PRINTF("MOVSX\t");
1406 FETCH_DECODE_MODRM(mod, rh, rl);
1408 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1412 destreg = DECODE_RM_LONG_REGISTER(rh);
1414 srcoffset = decode_rmXX_address(mod, rl);
1415 srcval = (s32)((s8)fetch_data_byte(srcoffset));
1416 DECODE_PRINTF("\n");
1423 destreg = DECODE_RM_WORD_REGISTER(rh);
1425 srcoffset = decode_rmXX_address(mod, rl);
1426 srcval = (s16)((s8)fetch_data_byte(srcoffset));
1427 DECODE_PRINTF("\n");
1431 } else { /* register to register */
1432 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1436 destreg = DECODE_RM_LONG_REGISTER(rh);
1438 srcreg = DECODE_RM_BYTE_REGISTER(rl);
1439 DECODE_PRINTF("\n");
1441 *destreg = (s32)((s8)*srcreg);
1446 destreg = DECODE_RM_WORD_REGISTER(rh);
1448 srcreg = DECODE_RM_BYTE_REGISTER(rl);
1449 DECODE_PRINTF("\n");
1451 *destreg = (s16)((s8)*srcreg);
1454 DECODE_CLEAR_SEGOVR();
1458 /****************************************************************************
1460 Handles opcode 0x0f,0xbf
1461 ****************************************************************************/
1462 void x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2))
1471 DECODE_PRINTF("MOVSX\t");
1472 FETCH_DECODE_MODRM(mod, rh, rl);
1474 destreg = DECODE_RM_LONG_REGISTER(rh);
1476 srcoffset = decode_rmXX_address(mod, rl);
1477 srcval = (s32)((s16)fetch_data_word(srcoffset));
1478 DECODE_PRINTF("\n");
1481 } else { /* register to register */
1482 destreg = DECODE_RM_LONG_REGISTER(rh);
1484 srcreg = DECODE_RM_WORD_REGISTER(rl);
1485 DECODE_PRINTF("\n");
1487 *destreg = (s32)((s16)*srcreg);
1489 DECODE_CLEAR_SEGOVR();
1493 /***************************************************************************
1494 * Double byte operation code table:
1495 **************************************************************************/
1496 void (*x86emu_optab2[256])(u8) =
1498 /* 0x00 */ x86emuOp2_illegal_op, /* Group F (ring 0 PM) */
1499 /* 0x01 */ x86emuOp2_illegal_op, /* Group G (ring 0 PM) */
1500 /* 0x02 */ x86emuOp2_illegal_op, /* lar (ring 0 PM) */
1501 /* 0x03 */ x86emuOp2_illegal_op, /* lsl (ring 0 PM) */
1502 /* 0x04 */ x86emuOp2_illegal_op,
1503 /* 0x05 */ x86emuOp2_illegal_op, /* loadall (undocumented) */
1504 /* 0x06 */ x86emuOp2_illegal_op, /* clts (ring 0 PM) */
1505 /* 0x07 */ x86emuOp2_illegal_op, /* loadall (undocumented) */
1506 /* 0x08 */ x86emuOp2_illegal_op, /* invd (ring 0 PM) */
1507 /* 0x09 */ x86emuOp2_illegal_op, /* wbinvd (ring 0 PM) */
1508 /* 0x0a */ x86emuOp2_illegal_op,
1509 /* 0x0b */ x86emuOp2_illegal_op,
1510 /* 0x0c */ x86emuOp2_illegal_op,
1511 /* 0x0d */ x86emuOp2_illegal_op,
1512 /* 0x0e */ x86emuOp2_illegal_op,
1513 /* 0x0f */ x86emuOp2_illegal_op,
1515 /* 0x10 */ x86emuOp2_illegal_op,
1516 /* 0x11 */ x86emuOp2_illegal_op,
1517 /* 0x12 */ x86emuOp2_illegal_op,
1518 /* 0x13 */ x86emuOp2_illegal_op,
1519 /* 0x14 */ x86emuOp2_illegal_op,
1520 /* 0x15 */ x86emuOp2_illegal_op,
1521 /* 0x16 */ x86emuOp2_illegal_op,
1522 /* 0x17 */ x86emuOp2_illegal_op,
1523 /* 0x18 */ x86emuOp2_illegal_op,
1524 /* 0x19 */ x86emuOp2_illegal_op,
1525 /* 0x1a */ x86emuOp2_illegal_op,
1526 /* 0x1b */ x86emuOp2_illegal_op,
1527 /* 0x1c */ x86emuOp2_illegal_op,
1528 /* 0x1d */ x86emuOp2_illegal_op,
1529 /* 0x1e */ x86emuOp2_illegal_op,
1530 /* 0x1f */ x86emuOp2_illegal_op,
1532 /* 0x20 */ x86emuOp2_illegal_op, /* mov reg32,creg (ring 0 PM) */
1533 /* 0x21 */ x86emuOp2_illegal_op, /* mov reg32,dreg (ring 0 PM) */
1534 /* 0x22 */ x86emuOp2_illegal_op, /* mov creg,reg32 (ring 0 PM) */
1535 /* 0x23 */ x86emuOp2_illegal_op, /* mov dreg,reg32 (ring 0 PM) */
1536 /* 0x24 */ x86emuOp2_illegal_op, /* mov reg32,treg (ring 0 PM) */
1537 /* 0x25 */ x86emuOp2_illegal_op,
1538 /* 0x26 */ x86emuOp2_illegal_op, /* mov treg,reg32 (ring 0 PM) */
1539 /* 0x27 */ x86emuOp2_illegal_op,
1540 /* 0x28 */ x86emuOp2_illegal_op,
1541 /* 0x29 */ x86emuOp2_illegal_op,
1542 /* 0x2a */ x86emuOp2_illegal_op,
1543 /* 0x2b */ x86emuOp2_illegal_op,
1544 /* 0x2c */ x86emuOp2_illegal_op,
1545 /* 0x2d */ x86emuOp2_illegal_op,
1546 /* 0x2e */ x86emuOp2_illegal_op,
1547 /* 0x2f */ x86emuOp2_illegal_op,
1549 /* 0x30 */ x86emuOp2_illegal_op,
1550 /* 0x31 */ x86emuOp2_illegal_op,
1551 /* 0x32 */ x86emuOp2_illegal_op,
1552 /* 0x33 */ x86emuOp2_illegal_op,
1553 /* 0x34 */ x86emuOp2_illegal_op,
1554 /* 0x35 */ x86emuOp2_illegal_op,
1555 /* 0x36 */ x86emuOp2_illegal_op,
1556 /* 0x37 */ x86emuOp2_illegal_op,
1557 /* 0x38 */ x86emuOp2_illegal_op,
1558 /* 0x39 */ x86emuOp2_illegal_op,
1559 /* 0x3a */ x86emuOp2_illegal_op,
1560 /* 0x3b */ x86emuOp2_illegal_op,
1561 /* 0x3c */ x86emuOp2_illegal_op,
1562 /* 0x3d */ x86emuOp2_illegal_op,
1563 /* 0x3e */ x86emuOp2_illegal_op,
1564 /* 0x3f */ x86emuOp2_illegal_op,
1566 /* 0x40 */ x86emuOp2_illegal_op,
1567 /* 0x41 */ x86emuOp2_illegal_op,
1568 /* 0x42 */ x86emuOp2_illegal_op,
1569 /* 0x43 */ x86emuOp2_illegal_op,
1570 /* 0x44 */ x86emuOp2_illegal_op,
1571 /* 0x45 */ x86emuOp2_illegal_op,
1572 /* 0x46 */ x86emuOp2_illegal_op,
1573 /* 0x47 */ x86emuOp2_illegal_op,
1574 /* 0x48 */ x86emuOp2_illegal_op,
1575 /* 0x49 */ x86emuOp2_illegal_op,
1576 /* 0x4a */ x86emuOp2_illegal_op,
1577 /* 0x4b */ x86emuOp2_illegal_op,
1578 /* 0x4c */ x86emuOp2_illegal_op,
1579 /* 0x4d */ x86emuOp2_illegal_op,
1580 /* 0x4e */ x86emuOp2_illegal_op,
1581 /* 0x4f */ x86emuOp2_illegal_op,
1583 /* 0x50 */ x86emuOp2_illegal_op,
1584 /* 0x51 */ x86emuOp2_illegal_op,
1585 /* 0x52 */ x86emuOp2_illegal_op,
1586 /* 0x53 */ x86emuOp2_illegal_op,
1587 /* 0x54 */ x86emuOp2_illegal_op,
1588 /* 0x55 */ x86emuOp2_illegal_op,
1589 /* 0x56 */ x86emuOp2_illegal_op,
1590 /* 0x57 */ x86emuOp2_illegal_op,
1591 /* 0x58 */ x86emuOp2_illegal_op,
1592 /* 0x59 */ x86emuOp2_illegal_op,
1593 /* 0x5a */ x86emuOp2_illegal_op,
1594 /* 0x5b */ x86emuOp2_illegal_op,
1595 /* 0x5c */ x86emuOp2_illegal_op,
1596 /* 0x5d */ x86emuOp2_illegal_op,
1597 /* 0x5e */ x86emuOp2_illegal_op,
1598 /* 0x5f */ x86emuOp2_illegal_op,
1600 /* 0x60 */ x86emuOp2_illegal_op,
1601 /* 0x61 */ x86emuOp2_illegal_op,
1602 /* 0x62 */ x86emuOp2_illegal_op,
1603 /* 0x63 */ x86emuOp2_illegal_op,
1604 /* 0x64 */ x86emuOp2_illegal_op,
1605 /* 0x65 */ x86emuOp2_illegal_op,
1606 /* 0x66 */ x86emuOp2_illegal_op,
1607 /* 0x67 */ x86emuOp2_illegal_op,
1608 /* 0x68 */ x86emuOp2_illegal_op,
1609 /* 0x69 */ x86emuOp2_illegal_op,
1610 /* 0x6a */ x86emuOp2_illegal_op,
1611 /* 0x6b */ x86emuOp2_illegal_op,
1612 /* 0x6c */ x86emuOp2_illegal_op,
1613 /* 0x6d */ x86emuOp2_illegal_op,
1614 /* 0x6e */ x86emuOp2_illegal_op,
1615 /* 0x6f */ x86emuOp2_illegal_op,
1617 /* 0x70 */ x86emuOp2_illegal_op,
1618 /* 0x71 */ x86emuOp2_illegal_op,
1619 /* 0x72 */ x86emuOp2_illegal_op,
1620 /* 0x73 */ x86emuOp2_illegal_op,
1621 /* 0x74 */ x86emuOp2_illegal_op,
1622 /* 0x75 */ x86emuOp2_illegal_op,
1623 /* 0x76 */ x86emuOp2_illegal_op,
1624 /* 0x77 */ x86emuOp2_illegal_op,
1625 /* 0x78 */ x86emuOp2_illegal_op,
1626 /* 0x79 */ x86emuOp2_illegal_op,
1627 /* 0x7a */ x86emuOp2_illegal_op,
1628 /* 0x7b */ x86emuOp2_illegal_op,
1629 /* 0x7c */ x86emuOp2_illegal_op,
1630 /* 0x7d */ x86emuOp2_illegal_op,
1631 /* 0x7e */ x86emuOp2_illegal_op,
1632 /* 0x7f */ x86emuOp2_illegal_op,
1634 /* 0x80 */ x86emuOp2_long_jump,
1635 /* 0x81 */ x86emuOp2_long_jump,
1636 /* 0x82 */ x86emuOp2_long_jump,
1637 /* 0x83 */ x86emuOp2_long_jump,
1638 /* 0x84 */ x86emuOp2_long_jump,
1639 /* 0x85 */ x86emuOp2_long_jump,
1640 /* 0x86 */ x86emuOp2_long_jump,
1641 /* 0x87 */ x86emuOp2_long_jump,
1642 /* 0x88 */ x86emuOp2_long_jump,
1643 /* 0x89 */ x86emuOp2_long_jump,
1644 /* 0x8a */ x86emuOp2_long_jump,
1645 /* 0x8b */ x86emuOp2_long_jump,
1646 /* 0x8c */ x86emuOp2_long_jump,
1647 /* 0x8d */ x86emuOp2_long_jump,
1648 /* 0x8e */ x86emuOp2_long_jump,
1649 /* 0x8f */ x86emuOp2_long_jump,
1651 /* 0x90 */ x86emuOp2_set_byte,
1652 /* 0x91 */ x86emuOp2_set_byte,
1653 /* 0x92 */ x86emuOp2_set_byte,
1654 /* 0x93 */ x86emuOp2_set_byte,
1655 /* 0x94 */ x86emuOp2_set_byte,
1656 /* 0x95 */ x86emuOp2_set_byte,
1657 /* 0x96 */ x86emuOp2_set_byte,
1658 /* 0x97 */ x86emuOp2_set_byte,
1659 /* 0x98 */ x86emuOp2_set_byte,
1660 /* 0x99 */ x86emuOp2_set_byte,
1661 /* 0x9a */ x86emuOp2_set_byte,
1662 /* 0x9b */ x86emuOp2_set_byte,
1663 /* 0x9c */ x86emuOp2_set_byte,
1664 /* 0x9d */ x86emuOp2_set_byte,
1665 /* 0x9e */ x86emuOp2_set_byte,
1666 /* 0x9f */ x86emuOp2_set_byte,
1668 /* 0xa0 */ x86emuOp2_push_FS,
1669 /* 0xa1 */ x86emuOp2_pop_FS,
1670 /* 0xa2 */ x86emuOp2_illegal_op,
1671 /* 0xa3 */ x86emuOp2_bt_R,
1672 /* 0xa4 */ x86emuOp2_shld_IMM,
1673 /* 0xa5 */ x86emuOp2_shld_CL,
1674 /* 0xa6 */ x86emuOp2_illegal_op,
1675 /* 0xa7 */ x86emuOp2_illegal_op,
1676 /* 0xa8 */ x86emuOp2_push_GS,
1677 /* 0xa9 */ x86emuOp2_pop_GS,
1678 /* 0xaa */ x86emuOp2_illegal_op,
1679 /* 0xab */ x86emuOp2_bt_R,
1680 /* 0xac */ x86emuOp2_shrd_IMM,
1681 /* 0xad */ x86emuOp2_shrd_CL,
1682 /* 0xae */ x86emuOp2_illegal_op,
1683 /* 0xaf */ x86emuOp2_imul_R_RM,
1685 /* 0xb0 */ x86emuOp2_illegal_op, /* TODO: cmpxchg */
1686 /* 0xb1 */ x86emuOp2_illegal_op, /* TODO: cmpxchg */
1687 /* 0xb2 */ x86emuOp2_lss_R_IMM,
1688 /* 0xb3 */ x86emuOp2_btr_R,
1689 /* 0xb4 */ x86emuOp2_lfs_R_IMM,
1690 /* 0xb5 */ x86emuOp2_lgs_R_IMM,
1691 /* 0xb6 */ x86emuOp2_movzx_byte_R_RM,
1692 /* 0xb7 */ x86emuOp2_movzx_word_R_RM,
1693 /* 0xb8 */ x86emuOp2_illegal_op,
1694 /* 0xb9 */ x86emuOp2_illegal_op,
1695 /* 0xba */ x86emuOp2_btX_I,
1696 /* 0xbb */ x86emuOp2_btc_R,
1697 /* 0xbc */ x86emuOp2_bsf,
1698 /* 0xbd */ x86emuOp2_bsr,
1699 /* 0xbe */ x86emuOp2_movsx_byte_R_RM,
1700 /* 0xbf */ x86emuOp2_movsx_word_R_RM,
1702 /* 0xc0 */ x86emuOp2_illegal_op, /* TODO: xadd */
1703 /* 0xc1 */ x86emuOp2_illegal_op, /* TODO: xadd */
1704 /* 0xc2 */ x86emuOp2_illegal_op,
1705 /* 0xc3 */ x86emuOp2_illegal_op,
1706 /* 0xc4 */ x86emuOp2_illegal_op,
1707 /* 0xc5 */ x86emuOp2_illegal_op,
1708 /* 0xc6 */ x86emuOp2_illegal_op,
1709 /* 0xc7 */ x86emuOp2_illegal_op,
1710 /* 0xc8 */ x86emuOp2_illegal_op, /* TODO: bswap */
1711 /* 0xc9 */ x86emuOp2_illegal_op, /* TODO: bswap */
1712 /* 0xca */ x86emuOp2_illegal_op, /* TODO: bswap */
1713 /* 0xcb */ x86emuOp2_illegal_op, /* TODO: bswap */
1714 /* 0xcc */ x86emuOp2_illegal_op, /* TODO: bswap */
1715 /* 0xcd */ x86emuOp2_illegal_op, /* TODO: bswap */
1716 /* 0xce */ x86emuOp2_illegal_op, /* TODO: bswap */
1717 /* 0xcf */ x86emuOp2_illegal_op, /* TODO: bswap */
1719 /* 0xd0 */ x86emuOp2_illegal_op,
1720 /* 0xd1 */ x86emuOp2_illegal_op,
1721 /* 0xd2 */ x86emuOp2_illegal_op,
1722 /* 0xd3 */ x86emuOp2_illegal_op,
1723 /* 0xd4 */ x86emuOp2_illegal_op,
1724 /* 0xd5 */ x86emuOp2_illegal_op,
1725 /* 0xd6 */ x86emuOp2_illegal_op,
1726 /* 0xd7 */ x86emuOp2_illegal_op,
1727 /* 0xd8 */ x86emuOp2_illegal_op,
1728 /* 0xd9 */ x86emuOp2_illegal_op,
1729 /* 0xda */ x86emuOp2_illegal_op,
1730 /* 0xdb */ x86emuOp2_illegal_op,
1731 /* 0xdc */ x86emuOp2_illegal_op,
1732 /* 0xdd */ x86emuOp2_illegal_op,
1733 /* 0xde */ x86emuOp2_illegal_op,
1734 /* 0xdf */ x86emuOp2_illegal_op,
1736 /* 0xe0 */ x86emuOp2_illegal_op,
1737 /* 0xe1 */ x86emuOp2_illegal_op,
1738 /* 0xe2 */ x86emuOp2_illegal_op,
1739 /* 0xe3 */ x86emuOp2_illegal_op,
1740 /* 0xe4 */ x86emuOp2_illegal_op,
1741 /* 0xe5 */ x86emuOp2_illegal_op,
1742 /* 0xe6 */ x86emuOp2_illegal_op,
1743 /* 0xe7 */ x86emuOp2_illegal_op,
1744 /* 0xe8 */ x86emuOp2_illegal_op,
1745 /* 0xe9 */ x86emuOp2_illegal_op,
1746 /* 0xea */ x86emuOp2_illegal_op,
1747 /* 0xeb */ x86emuOp2_illegal_op,
1748 /* 0xec */ x86emuOp2_illegal_op,
1749 /* 0xed */ x86emuOp2_illegal_op,
1750 /* 0xee */ x86emuOp2_illegal_op,
1751 /* 0xef */ x86emuOp2_illegal_op,
1753 /* 0xf0 */ x86emuOp2_illegal_op,
1754 /* 0xf1 */ x86emuOp2_illegal_op,
1755 /* 0xf2 */ x86emuOp2_illegal_op,
1756 /* 0xf3 */ x86emuOp2_illegal_op,
1757 /* 0xf4 */ x86emuOp2_illegal_op,
1758 /* 0xf5 */ x86emuOp2_illegal_op,
1759 /* 0xf6 */ x86emuOp2_illegal_op,
1760 /* 0xf7 */ x86emuOp2_illegal_op,
1761 /* 0xf8 */ x86emuOp2_illegal_op,
1762 /* 0xf9 */ x86emuOp2_illegal_op,
1763 /* 0xfa */ x86emuOp2_illegal_op,
1764 /* 0xfb */ x86emuOp2_illegal_op,
1765 /* 0xfc */ x86emuOp2_illegal_op,
1766 /* 0xfd */ x86emuOp2_illegal_op,
1767 /* 0xfe */ x86emuOp2_illegal_op,
1768 /* 0xff */ x86emuOp2_illegal_op,