1 /****************************************************************************
3 * Realmode X86 Emulator Library
5 * Copyright (C) 2007 Freescale Semiconductor, Inc. All rights reserved.
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 * Jason port this file to u-boot. Put the function pointer into
45 ****************************************************************************/
49 #if defined(CONFIG_BIOSEMU)
51 #include "x86emu/x86emui.h"
53 /*----------------------------- Implementation ----------------------------*/
55 /****************************************************************************
57 op1 - Instruction op code
60 Handles illegal opcodes.
61 ****************************************************************************/
62 void x86emuOp2_illegal_op(
66 DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n");
68 printk("%04x:%04x: %02X ILLEGAL EXTENDED X86 OPCODE!\n",
69 M.x86.R_CS, M.x86.R_IP-2,op2);
74 #define xorl(a,b) ((a) && !(b)) || (!(a) && (b))
76 /****************************************************************************
78 Handles opcode 0x0f,0x80-0x8F
79 ****************************************************************************/
80 int x86emu_check_jump_condition(u8 op)
84 DECODE_PRINTF("JO\t");
85 return ACCESS_FLAG(F_OF);
87 DECODE_PRINTF("JNO\t");
88 return !ACCESS_FLAG(F_OF);
91 DECODE_PRINTF("JB\t");
92 return ACCESS_FLAG(F_CF);
95 DECODE_PRINTF("JNB\t");
96 return !ACCESS_FLAG(F_CF);
99 DECODE_PRINTF("JZ\t");
100 return ACCESS_FLAG(F_ZF);
103 DECODE_PRINTF("JNZ\t");
104 return !ACCESS_FLAG(F_ZF);
107 DECODE_PRINTF("JBE\t");
108 return ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF);
111 DECODE_PRINTF("JNBE\t");
112 return !(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF));
115 DECODE_PRINTF("JS\t");
116 return ACCESS_FLAG(F_SF);
119 DECODE_PRINTF("JNS\t");
120 return !ACCESS_FLAG(F_SF);
123 DECODE_PRINTF("JP\t");
124 return ACCESS_FLAG(F_PF);
127 DECODE_PRINTF("JNP\t");
128 return !ACCESS_FLAG(F_PF);
131 DECODE_PRINTF("JL\t");
132 return xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
135 DECODE_PRINTF("JNL\t");
136 return !xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
139 DECODE_PRINTF("JLE\t");
140 return (xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
144 DECODE_PRINTF("JNLE\t");
145 return !(xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
150 void x86emuOp2_long_jump(u8 op2)
155 /* conditional jump to word offset. */
157 cond = x86emu_check_jump_condition(op2 & 0xF);
158 target = (s16) fetch_word_imm();
159 target += (s16) M.x86.R_IP;
160 DECODE_PRINTF2("%04x\n", target);
163 M.x86.R_IP = (u16)target;
164 DECODE_CLEAR_SEGOVR();
168 /****************************************************************************
170 Handles opcode 0x0f,0x90-0x9F
171 ****************************************************************************/
172 void x86emuOp2_set_byte(u8 op2)
184 cond = ACCESS_FLAG(F_OF);
188 cond = !ACCESS_FLAG(F_OF);
192 cond = ACCESS_FLAG(F_CF);
196 cond = !ACCESS_FLAG(F_CF);
200 cond = ACCESS_FLAG(F_ZF);
204 cond = !ACCESS_FLAG(F_ZF);
208 cond = ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF);
212 cond = !(ACCESS_FLAG(F_CF) || ACCESS_FLAG(F_ZF));
216 cond = ACCESS_FLAG(F_SF);
220 cond = !ACCESS_FLAG(F_SF);
224 cond = ACCESS_FLAG(F_PF);
228 cond = !ACCESS_FLAG(F_PF);
232 cond = xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
236 cond = !xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF));
240 cond = (xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
245 cond = !(xorl(ACCESS_FLAG(F_SF), ACCESS_FLAG(F_OF)) ||
250 FETCH_DECODE_MODRM(mod, rh, rl);
252 destoffset = decode_rmXX_address(mod, rl);
254 store_data_byte(destoffset, cond ? 0x01 : 0x00);
255 } else { /* register to register */
256 destreg = DECODE_RM_BYTE_REGISTER(rl);
258 *destreg = cond ? 0x01 : 0x00;
260 DECODE_CLEAR_SEGOVR();
264 /****************************************************************************
266 Handles opcode 0x0f,0xa0
267 ****************************************************************************/
268 void x86emuOp2_push_FS(u8 X86EMU_UNUSED(op2))
271 DECODE_PRINTF("PUSH\tFS\n");
273 push_word(M.x86.R_FS);
274 DECODE_CLEAR_SEGOVR();
278 /****************************************************************************
280 Handles opcode 0x0f,0xa1
281 ****************************************************************************/
282 void x86emuOp2_pop_FS(u8 X86EMU_UNUSED(op2))
285 DECODE_PRINTF("POP\tFS\n");
287 M.x86.R_FS = pop_word();
288 DECODE_CLEAR_SEGOVR();
292 /****************************************************************************
294 Handles opcode 0x0f,0xa3
295 ****************************************************************************/
296 void x86emuOp2_bt_R(u8 X86EMU_UNUSED(op2))
303 DECODE_PRINTF("BT\t");
304 FETCH_DECODE_MODRM(mod, rh, rl);
306 srcoffset = decode_rmXX_address(mod, rl);
307 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
312 shiftreg = DECODE_RM_LONG_REGISTER(rh);
314 bit = *shiftreg & 0x1F;
315 disp = (s16)*shiftreg >> 5;
316 srcval = fetch_data_long(srcoffset+disp);
317 CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
323 shiftreg = DECODE_RM_WORD_REGISTER(rh);
325 bit = *shiftreg & 0xF;
326 disp = (s16)*shiftreg >> 4;
327 srcval = fetch_data_word(srcoffset+disp);
328 CONDITIONAL_SET_FLAG(srcval & (0x1 << bit),F_CF);
330 } else { /* register to register */
331 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
332 u32 *srcreg,*shiftreg;
334 srcreg = DECODE_RM_LONG_REGISTER(rl);
336 shiftreg = DECODE_RM_LONG_REGISTER(rh);
338 bit = *shiftreg & 0x1F;
339 CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit),F_CF);
341 u16 *srcreg,*shiftreg;
343 srcreg = DECODE_RM_WORD_REGISTER(rl);
345 shiftreg = DECODE_RM_WORD_REGISTER(rh);
347 bit = *shiftreg & 0xF;
348 CONDITIONAL_SET_FLAG(*srcreg & (0x1 << bit),F_CF);
351 DECODE_CLEAR_SEGOVR();
355 /****************************************************************************
357 Handles opcode 0x0f,0xa4
358 ****************************************************************************/
359 void x86emuOp2_shld_IMM(u8 X86EMU_UNUSED(op2))
366 DECODE_PRINTF("SHLD\t");
367 FETCH_DECODE_MODRM(mod, rh, rl);
369 destoffset = decode_rmXX_address(mod, rl);
370 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
375 shiftreg = DECODE_RM_LONG_REGISTER(rh);
377 shift = fetch_byte_imm();
378 DECODE_PRINTF2("%d\n", shift);
380 destval = fetch_data_long(destoffset);
381 destval = shld_long(destval,*shiftreg,shift);
382 store_data_long(destoffset, destval);
388 shiftreg = DECODE_RM_WORD_REGISTER(rh);
390 shift = fetch_byte_imm();
391 DECODE_PRINTF2("%d\n", shift);
393 destval = fetch_data_word(destoffset);
394 destval = shld_word(destval,*shiftreg,shift);
395 store_data_word(destoffset, destval);
397 } else { /* register to register */
398 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
399 u32 *destreg,*shiftreg;
401 destreg = DECODE_RM_LONG_REGISTER(rl);
403 shiftreg = DECODE_RM_LONG_REGISTER(rh);
405 shift = fetch_byte_imm();
406 DECODE_PRINTF2("%d\n", shift);
408 *destreg = shld_long(*destreg,*shiftreg,shift);
410 u16 *destreg,*shiftreg;
412 destreg = DECODE_RM_WORD_REGISTER(rl);
414 shiftreg = DECODE_RM_WORD_REGISTER(rh);
416 shift = fetch_byte_imm();
417 DECODE_PRINTF2("%d\n", shift);
419 *destreg = shld_word(*destreg,*shiftreg,shift);
422 DECODE_CLEAR_SEGOVR();
426 /****************************************************************************
428 Handles opcode 0x0f,0xa5
429 ****************************************************************************/
430 void x86emuOp2_shld_CL(u8 X86EMU_UNUSED(op2))
436 DECODE_PRINTF("SHLD\t");
437 FETCH_DECODE_MODRM(mod, rh, rl);
439 destoffset = decode_rmXX_address(mod, rl);
440 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
445 shiftreg = DECODE_RM_LONG_REGISTER(rh);
446 DECODE_PRINTF(",CL\n");
448 destval = fetch_data_long(destoffset);
449 destval = shld_long(destval,*shiftreg,M.x86.R_CL);
450 store_data_long(destoffset, destval);
456 shiftreg = DECODE_RM_WORD_REGISTER(rh);
457 DECODE_PRINTF(",CL\n");
459 destval = fetch_data_word(destoffset);
460 destval = shld_word(destval,*shiftreg,M.x86.R_CL);
461 store_data_word(destoffset, destval);
463 } else { /* register to register */
464 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
465 u32 *destreg,*shiftreg;
467 destreg = DECODE_RM_LONG_REGISTER(rl);
469 shiftreg = DECODE_RM_LONG_REGISTER(rh);
470 DECODE_PRINTF(",CL\n");
472 *destreg = shld_long(*destreg,*shiftreg,M.x86.R_CL);
474 u16 *destreg,*shiftreg;
476 destreg = DECODE_RM_WORD_REGISTER(rl);
478 shiftreg = DECODE_RM_WORD_REGISTER(rh);
479 DECODE_PRINTF(",CL\n");
481 *destreg = shld_word(*destreg,*shiftreg,M.x86.R_CL);
484 DECODE_CLEAR_SEGOVR();
488 /****************************************************************************
490 Handles opcode 0x0f,0xa8
491 ****************************************************************************/
492 void x86emuOp2_push_GS(u8 X86EMU_UNUSED(op2))
495 DECODE_PRINTF("PUSH\tGS\n");
497 push_word(M.x86.R_GS);
498 DECODE_CLEAR_SEGOVR();
502 /****************************************************************************
504 Handles opcode 0x0f,0xa9
505 ****************************************************************************/
506 void x86emuOp2_pop_GS(u8 X86EMU_UNUSED(op2))
509 DECODE_PRINTF("POP\tGS\n");
511 M.x86.R_GS = pop_word();
512 DECODE_CLEAR_SEGOVR();
516 /****************************************************************************
518 Handles opcode 0x0f,0xaa
519 ****************************************************************************/
520 void x86emuOp2_bts_R(u8 X86EMU_UNUSED(op2))
527 DECODE_PRINTF("BTS\t");
528 FETCH_DECODE_MODRM(mod, rh, rl);
530 srcoffset = decode_rmXX_address(mod, rl);
531 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
536 shiftreg = DECODE_RM_LONG_REGISTER(rh);
538 bit = *shiftreg & 0x1F;
539 disp = (s16)*shiftreg >> 5;
540 srcval = fetch_data_long(srcoffset+disp);
542 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
543 store_data_long(srcoffset+disp, srcval | mask);
549 shiftreg = DECODE_RM_WORD_REGISTER(rh);
551 bit = *shiftreg & 0xF;
552 disp = (s16)*shiftreg >> 4;
553 srcval = fetch_data_word(srcoffset+disp);
554 mask = (u16)(0x1 << bit);
555 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
556 store_data_word(srcoffset+disp, srcval | mask);
558 } else { /* register to register */
559 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
560 u32 *srcreg,*shiftreg;
563 srcreg = DECODE_RM_LONG_REGISTER(rl);
565 shiftreg = DECODE_RM_LONG_REGISTER(rh);
567 bit = *shiftreg & 0x1F;
569 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
572 u16 *srcreg,*shiftreg;
575 srcreg = DECODE_RM_WORD_REGISTER(rl);
577 shiftreg = DECODE_RM_WORD_REGISTER(rh);
579 bit = *shiftreg & 0xF;
580 mask = (u16)(0x1 << bit);
581 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
585 DECODE_CLEAR_SEGOVR();
589 /****************************************************************************
591 Handles opcode 0x0f,0xac
592 ****************************************************************************/
593 void x86emuOp2_shrd_IMM(u8 X86EMU_UNUSED(op2))
600 DECODE_PRINTF("SHLD\t");
601 FETCH_DECODE_MODRM(mod, rh, rl);
603 destoffset = decode_rmXX_address(mod, rl);
604 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
609 shiftreg = DECODE_RM_LONG_REGISTER(rh);
611 shift = fetch_byte_imm();
612 DECODE_PRINTF2("%d\n", shift);
614 destval = fetch_data_long(destoffset);
615 destval = shrd_long(destval,*shiftreg,shift);
616 store_data_long(destoffset, destval);
622 shiftreg = DECODE_RM_WORD_REGISTER(rh);
624 shift = fetch_byte_imm();
625 DECODE_PRINTF2("%d\n", shift);
627 destval = fetch_data_word(destoffset);
628 destval = shrd_word(destval,*shiftreg,shift);
629 store_data_word(destoffset, destval);
631 } else { /* register to register */
632 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
633 u32 *destreg,*shiftreg;
635 destreg = DECODE_RM_LONG_REGISTER(rl);
637 shiftreg = DECODE_RM_LONG_REGISTER(rh);
639 shift = fetch_byte_imm();
640 DECODE_PRINTF2("%d\n", shift);
642 *destreg = shrd_long(*destreg,*shiftreg,shift);
644 u16 *destreg,*shiftreg;
646 destreg = DECODE_RM_WORD_REGISTER(rl);
648 shiftreg = DECODE_RM_WORD_REGISTER(rh);
650 shift = fetch_byte_imm();
651 DECODE_PRINTF2("%d\n", shift);
653 *destreg = shrd_word(*destreg,*shiftreg,shift);
656 DECODE_CLEAR_SEGOVR();
660 /****************************************************************************
662 Handles opcode 0x0f,0xad
663 ****************************************************************************/
664 void x86emuOp2_shrd_CL(u8 X86EMU_UNUSED(op2))
670 DECODE_PRINTF("SHLD\t");
671 FETCH_DECODE_MODRM(mod, rh, rl);
673 destoffset = decode_rmXX_address(mod, rl);
675 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
679 shiftreg = DECODE_RM_LONG_REGISTER(rh);
680 DECODE_PRINTF(",CL\n");
682 destval = fetch_data_long(destoffset);
683 destval = shrd_long(destval,*shiftreg,M.x86.R_CL);
684 store_data_long(destoffset, destval);
689 shiftreg = DECODE_RM_WORD_REGISTER(rh);
690 DECODE_PRINTF(",CL\n");
692 destval = fetch_data_word(destoffset);
693 destval = shrd_word(destval,*shiftreg,M.x86.R_CL);
694 store_data_word(destoffset, destval);
696 } else { /* register to register */
697 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
698 u32 *destreg,*shiftreg;
700 destreg = DECODE_RM_LONG_REGISTER(rl);
702 shiftreg = DECODE_RM_LONG_REGISTER(rh);
703 DECODE_PRINTF(",CL\n");
705 *destreg = shrd_long(*destreg,*shiftreg,M.x86.R_CL);
707 u16 *destreg,*shiftreg;
709 destreg = DECODE_RM_WORD_REGISTER(rl);
711 shiftreg = DECODE_RM_WORD_REGISTER(rh);
712 DECODE_PRINTF(",CL\n");
714 *destreg = shrd_word(*destreg,*shiftreg,M.x86.R_CL);
717 DECODE_CLEAR_SEGOVR();
721 /****************************************************************************
723 Handles opcode 0x0f,0xaf
724 ****************************************************************************/
725 void x86emuOp2_imul_R_RM(u8 X86EMU_UNUSED(op2))
731 DECODE_PRINTF("IMUL\t");
732 FETCH_DECODE_MODRM(mod, rh, rl);
734 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
739 destreg = DECODE_RM_LONG_REGISTER(rh);
741 srcoffset = decode_rmXX_address(mod, rl);
742 srcval = fetch_data_long(srcoffset);
744 imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)srcval);
752 *destreg = (u32)res_lo;
758 destreg = DECODE_RM_WORD_REGISTER(rh);
760 srcoffset = decode_rmXX_address(mod, rl);
761 srcval = fetch_data_word(srcoffset);
763 res = (s16)*destreg * (s16)srcval;
773 } else { /* register to register */
774 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
775 u32 *destreg,*srcreg;
778 destreg = DECODE_RM_LONG_REGISTER(rh);
780 srcreg = DECODE_RM_LONG_REGISTER(rl);
782 imul_long_direct(&res_lo,&res_hi,(s32)*destreg,(s32)*srcreg);
790 *destreg = (u32)res_lo;
792 u16 *destreg,*srcreg;
795 destreg = DECODE_RM_WORD_REGISTER(rh);
797 srcreg = DECODE_RM_WORD_REGISTER(rl);
798 res = (s16)*destreg * (s16)*srcreg;
809 DECODE_CLEAR_SEGOVR();
813 /****************************************************************************
815 Handles opcode 0x0f,0xb2
816 ****************************************************************************/
817 void x86emuOp2_lss_R_IMM(u8 X86EMU_UNUSED(op2))
824 DECODE_PRINTF("LSS\t");
825 FETCH_DECODE_MODRM(mod, rh, rl);
827 dstreg = DECODE_RM_WORD_REGISTER(rh);
829 srcoffset = decode_rmXX_address(mod, rl);
832 *dstreg = fetch_data_word(srcoffset);
833 M.x86.R_SS = fetch_data_word(srcoffset + 2);
834 } else { /* register to register */
838 DECODE_CLEAR_SEGOVR();
842 /****************************************************************************
844 Handles opcode 0x0f,0xb3
845 ****************************************************************************/
846 void x86emuOp2_btr_R(u8 X86EMU_UNUSED(op2))
853 DECODE_PRINTF("BTR\t");
854 FETCH_DECODE_MODRM(mod, rh, rl);
856 srcoffset = decode_rmXX_address(mod, rl);
858 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
862 shiftreg = DECODE_RM_LONG_REGISTER(rh);
864 bit = *shiftreg & 0x1F;
865 disp = (s16)*shiftreg >> 5;
866 srcval = fetch_data_long(srcoffset+disp);
868 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
869 store_data_long(srcoffset+disp, srcval & ~mask);
874 shiftreg = DECODE_RM_WORD_REGISTER(rh);
876 bit = *shiftreg & 0xF;
877 disp = (s16)*shiftreg >> 4;
878 srcval = fetch_data_word(srcoffset+disp);
879 mask = (u16)(0x1 << bit);
880 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
881 store_data_word(srcoffset+disp, (u16)(srcval & ~mask));
883 } else { /* register to register */
884 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
885 u32 *srcreg,*shiftreg;
888 srcreg = DECODE_RM_LONG_REGISTER(rl);
890 shiftreg = DECODE_RM_LONG_REGISTER(rh);
892 bit = *shiftreg & 0x1F;
894 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
897 u16 *srcreg,*shiftreg;
900 srcreg = DECODE_RM_WORD_REGISTER(rl);
902 shiftreg = DECODE_RM_WORD_REGISTER(rh);
904 bit = *shiftreg & 0xF;
905 mask = (u16)(0x1 << bit);
906 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
910 DECODE_CLEAR_SEGOVR();
914 /****************************************************************************
916 Handles opcode 0x0f,0xb4
917 ****************************************************************************/
918 void x86emuOp2_lfs_R_IMM(u8 X86EMU_UNUSED(op2))
925 DECODE_PRINTF("LFS\t");
926 FETCH_DECODE_MODRM(mod, rh, rl);
928 dstreg = DECODE_RM_WORD_REGISTER(rh);
930 srcoffset = decode_rmXX_address(mod, rl);
933 *dstreg = fetch_data_word(srcoffset);
934 M.x86.R_FS = fetch_data_word(srcoffset + 2);
935 } else { /* register to register */
939 DECODE_CLEAR_SEGOVR();
943 /****************************************************************************
945 Handles opcode 0x0f,0xb5
946 ****************************************************************************/
947 void x86emuOp2_lgs_R_IMM(u8 X86EMU_UNUSED(op2))
954 DECODE_PRINTF("LGS\t");
955 FETCH_DECODE_MODRM(mod, rh, rl);
957 dstreg = DECODE_RM_WORD_REGISTER(rh);
959 srcoffset = decode_rmXX_address(mod, rl);
962 *dstreg = fetch_data_word(srcoffset);
963 M.x86.R_GS = fetch_data_word(srcoffset + 2);
964 } else { /* register to register */
968 DECODE_CLEAR_SEGOVR();
972 /****************************************************************************
974 Handles opcode 0x0f,0xb6
975 ****************************************************************************/
976 void x86emuOp2_movzx_byte_R_RM(u8 X86EMU_UNUSED(op2))
982 DECODE_PRINTF("MOVZX\t");
983 FETCH_DECODE_MODRM(mod, rh, rl);
985 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
989 destreg = DECODE_RM_LONG_REGISTER(rh);
991 srcoffset = decode_rmXX_address(mod, rl);
992 srcval = fetch_data_byte(srcoffset);
1000 destreg = DECODE_RM_WORD_REGISTER(rh);
1002 srcoffset = decode_rmXX_address(mod, rl);
1003 srcval = fetch_data_byte(srcoffset);
1004 DECODE_PRINTF("\n");
1008 } else { /* register to register */
1009 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1013 destreg = DECODE_RM_LONG_REGISTER(rh);
1015 srcreg = DECODE_RM_BYTE_REGISTER(rl);
1016 DECODE_PRINTF("\n");
1023 destreg = DECODE_RM_WORD_REGISTER(rh);
1025 srcreg = DECODE_RM_BYTE_REGISTER(rl);
1026 DECODE_PRINTF("\n");
1031 DECODE_CLEAR_SEGOVR();
1035 /****************************************************************************
1037 Handles opcode 0x0f,0xb7
1038 ****************************************************************************/
1039 void x86emuOp2_movzx_word_R_RM(u8 X86EMU_UNUSED(op2))
1048 DECODE_PRINTF("MOVZX\t");
1049 FETCH_DECODE_MODRM(mod, rh, rl);
1051 destreg = DECODE_RM_LONG_REGISTER(rh);
1053 srcoffset = decode_rmXX_address(mod, rl);
1054 srcval = fetch_data_word(srcoffset);
1055 DECODE_PRINTF("\n");
1058 } else { /* register to register */
1059 destreg = DECODE_RM_LONG_REGISTER(rh);
1061 srcreg = DECODE_RM_WORD_REGISTER(rl);
1062 DECODE_PRINTF("\n");
1066 DECODE_CLEAR_SEGOVR();
1070 /****************************************************************************
1072 Handles opcode 0x0f,0xba
1073 ****************************************************************************/
1074 void x86emuOp2_btX_I(u8 X86EMU_UNUSED(op2))
1082 FETCH_DECODE_MODRM(mod, rh, rl);
1085 DECODE_PRINTF("BT\t");
1088 DECODE_PRINTF("BTS\t");
1091 DECODE_PRINTF("BTR\t");
1094 DECODE_PRINTF("BTC\t");
1097 DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n");
1099 printk("%04x:%04x: %02X%02X ILLEGAL EXTENDED X86 OPCODE EXTENSION!\n",
1100 M.x86.R_CS, M.x86.R_IP-3,op2, (mod<<6)|(rh<<3)|rl);
1105 srcoffset = decode_rmXX_address(mod, rl);
1106 shift = fetch_byte_imm();
1107 DECODE_PRINTF2(",%d\n", shift);
1110 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1114 srcval = fetch_data_long(srcoffset);
1115 mask = (0x1 << bit);
1116 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
1119 store_data_long(srcoffset, srcval | mask);
1122 store_data_long(srcoffset, srcval & ~mask);
1125 store_data_long(srcoffset, srcval ^ mask);
1134 srcval = fetch_data_word(srcoffset);
1135 mask = (0x1 << bit);
1136 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
1139 store_data_word(srcoffset, srcval | mask);
1142 store_data_word(srcoffset, srcval & ~mask);
1145 store_data_word(srcoffset, srcval ^ mask);
1151 } else { /* register to register */
1152 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1156 srcreg = DECODE_RM_LONG_REGISTER(rl);
1157 shift = fetch_byte_imm();
1158 DECODE_PRINTF2(",%d\n", shift);
1161 mask = (0x1 << bit);
1162 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
1180 srcreg = DECODE_RM_WORD_REGISTER(rl);
1181 shift = fetch_byte_imm();
1182 DECODE_PRINTF2(",%d\n", shift);
1185 mask = (0x1 << bit);
1186 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
1202 DECODE_CLEAR_SEGOVR();
1206 /****************************************************************************
1208 Handles opcode 0x0f,0xbb
1209 ****************************************************************************/
1210 void x86emuOp2_btc_R(u8 X86EMU_UNUSED(op2))
1217 DECODE_PRINTF("BTC\t");
1218 FETCH_DECODE_MODRM(mod, rh, rl);
1220 srcoffset = decode_rmXX_address(mod, rl);
1222 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1226 shiftreg = DECODE_RM_LONG_REGISTER(rh);
1228 bit = *shiftreg & 0x1F;
1229 disp = (s16)*shiftreg >> 5;
1230 srcval = fetch_data_long(srcoffset+disp);
1231 mask = (0x1 << bit);
1232 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
1233 store_data_long(srcoffset+disp, srcval ^ mask);
1238 shiftreg = DECODE_RM_WORD_REGISTER(rh);
1240 bit = *shiftreg & 0xF;
1241 disp = (s16)*shiftreg >> 4;
1242 srcval = fetch_data_word(srcoffset+disp);
1243 mask = (u16)(0x1 << bit);
1244 CONDITIONAL_SET_FLAG(srcval & mask,F_CF);
1245 store_data_word(srcoffset+disp, (u16)(srcval ^ mask));
1247 } else { /* register to register */
1248 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1249 u32 *srcreg,*shiftreg;
1252 srcreg = DECODE_RM_LONG_REGISTER(rl);
1254 shiftreg = DECODE_RM_LONG_REGISTER(rh);
1256 bit = *shiftreg & 0x1F;
1257 mask = (0x1 << bit);
1258 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
1261 u16 *srcreg,*shiftreg;
1264 srcreg = DECODE_RM_WORD_REGISTER(rl);
1266 shiftreg = DECODE_RM_WORD_REGISTER(rh);
1268 bit = *shiftreg & 0xF;
1269 mask = (u16)(0x1 << bit);
1270 CONDITIONAL_SET_FLAG(*srcreg & mask,F_CF);
1274 DECODE_CLEAR_SEGOVR();
1278 /****************************************************************************
1280 Handles opcode 0x0f,0xbc
1281 ****************************************************************************/
1282 void x86emuOp2_bsf(u8 X86EMU_UNUSED(op2))
1288 DECODE_PRINTF("BSF\n");
1289 FETCH_DECODE_MODRM(mod, rh, rl);
1291 srcoffset = decode_rmXX_address(mod, rl);
1293 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1294 u32 srcval, *dstreg;
1296 dstreg = DECODE_RM_LONG_REGISTER(rh);
1298 srcval = fetch_data_long(srcoffset);
1299 CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
1300 for(*dstreg = 0; *dstreg < 32; (*dstreg)++)
1301 if ((srcval >> *dstreg) & 1) break;
1303 u16 srcval, *dstreg;
1305 dstreg = DECODE_RM_WORD_REGISTER(rh);
1307 srcval = fetch_data_word(srcoffset);
1308 CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
1309 for(*dstreg = 0; *dstreg < 16; (*dstreg)++)
1310 if ((srcval >> *dstreg) & 1) break;
1312 } else { /* register to register */
1313 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1314 u32 *srcreg, *dstreg;
1316 srcreg = DECODE_RM_LONG_REGISTER(rl);
1318 dstreg = DECODE_RM_LONG_REGISTER(rh);
1320 CONDITIONAL_SET_FLAG(*srcreg == 0, F_ZF);
1321 for(*dstreg = 0; *dstreg < 32; (*dstreg)++)
1322 if ((*srcreg >> *dstreg) & 1) break;
1324 u16 *srcreg, *dstreg;
1326 srcreg = DECODE_RM_WORD_REGISTER(rl);
1328 dstreg = DECODE_RM_WORD_REGISTER(rh);
1330 CONDITIONAL_SET_FLAG(*srcreg == 0, F_ZF);
1331 for(*dstreg = 0; *dstreg < 16; (*dstreg)++)
1332 if ((*srcreg >> *dstreg) & 1) break;
1335 DECODE_CLEAR_SEGOVR();
1339 /****************************************************************************
1341 Handles opcode 0x0f,0xbd
1342 ****************************************************************************/
1343 void x86emuOp2_bsr(u8 X86EMU_UNUSED(op2))
1349 DECODE_PRINTF("BSF\n");
1350 FETCH_DECODE_MODRM(mod, rh, rl);
1352 srcoffset = decode_rmXX_address(mod, rl);
1354 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1355 u32 srcval, *dstreg;
1357 dstreg = DECODE_RM_LONG_REGISTER(rh);
1359 srcval = fetch_data_long(srcoffset);
1360 CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
1361 for(*dstreg = 31; *dstreg > 0; (*dstreg)--)
1362 if ((srcval >> *dstreg) & 1) break;
1364 u16 srcval, *dstreg;
1366 dstreg = DECODE_RM_WORD_REGISTER(rh);
1368 srcval = fetch_data_word(srcoffset);
1369 CONDITIONAL_SET_FLAG(srcval == 0, F_ZF);
1370 for(*dstreg = 15; *dstreg > 0; (*dstreg)--)
1371 if ((srcval >> *dstreg) & 1) break;
1373 } else { /* register to register */
1374 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1375 u32 *srcreg, *dstreg;
1377 srcreg = DECODE_RM_LONG_REGISTER(rl);
1379 dstreg = DECODE_RM_LONG_REGISTER(rh);
1381 CONDITIONAL_SET_FLAG(*srcreg == 0, F_ZF);
1382 for(*dstreg = 31; *dstreg > 0; (*dstreg)--)
1383 if ((*srcreg >> *dstreg) & 1) break;
1385 u16 *srcreg, *dstreg;
1387 srcreg = DECODE_RM_WORD_REGISTER(rl);
1389 dstreg = DECODE_RM_WORD_REGISTER(rh);
1391 CONDITIONAL_SET_FLAG(*srcreg == 0, F_ZF);
1392 for(*dstreg = 15; *dstreg > 0; (*dstreg)--)
1393 if ((*srcreg >> *dstreg) & 1) break;
1396 DECODE_CLEAR_SEGOVR();
1400 /****************************************************************************
1402 Handles opcode 0x0f,0xbe
1403 ****************************************************************************/
1404 void x86emuOp2_movsx_byte_R_RM(u8 X86EMU_UNUSED(op2))
1410 DECODE_PRINTF("MOVSX\t");
1411 FETCH_DECODE_MODRM(mod, rh, rl);
1413 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1417 destreg = DECODE_RM_LONG_REGISTER(rh);
1419 srcoffset = decode_rmXX_address(mod, rl);
1420 srcval = (s32)((s8)fetch_data_byte(srcoffset));
1421 DECODE_PRINTF("\n");
1428 destreg = DECODE_RM_WORD_REGISTER(rh);
1430 srcoffset = decode_rmXX_address(mod, rl);
1431 srcval = (s16)((s8)fetch_data_byte(srcoffset));
1432 DECODE_PRINTF("\n");
1436 } else { /* register to register */
1437 if (M.x86.mode & SYSMODE_PREFIX_DATA) {
1441 destreg = DECODE_RM_LONG_REGISTER(rh);
1443 srcreg = DECODE_RM_BYTE_REGISTER(rl);
1444 DECODE_PRINTF("\n");
1446 *destreg = (s32)((s8)*srcreg);
1451 destreg = DECODE_RM_WORD_REGISTER(rh);
1453 srcreg = DECODE_RM_BYTE_REGISTER(rl);
1454 DECODE_PRINTF("\n");
1456 *destreg = (s16)((s8)*srcreg);
1459 DECODE_CLEAR_SEGOVR();
1463 /****************************************************************************
1465 Handles opcode 0x0f,0xbf
1466 ****************************************************************************/
1467 void x86emuOp2_movsx_word_R_RM(u8 X86EMU_UNUSED(op2))
1476 DECODE_PRINTF("MOVSX\t");
1477 FETCH_DECODE_MODRM(mod, rh, rl);
1479 destreg = DECODE_RM_LONG_REGISTER(rh);
1481 srcoffset = decode_rmXX_address(mod, rl);
1482 srcval = (s32)((s16)fetch_data_word(srcoffset));
1483 DECODE_PRINTF("\n");
1486 } else { /* register to register */
1487 destreg = DECODE_RM_LONG_REGISTER(rh);
1489 srcreg = DECODE_RM_WORD_REGISTER(rl);
1490 DECODE_PRINTF("\n");
1492 *destreg = (s32)((s16)*srcreg);
1494 DECODE_CLEAR_SEGOVR();
1498 /***************************************************************************
1499 * Double byte operation code table:
1500 **************************************************************************/
1501 void (*x86emu_optab2[256])(u8) __attribute__((section(".got2"))) =
1503 /* 0x00 */ x86emuOp2_illegal_op, /* Group F (ring 0 PM) */
1504 /* 0x01 */ x86emuOp2_illegal_op, /* Group G (ring 0 PM) */
1505 /* 0x02 */ x86emuOp2_illegal_op, /* lar (ring 0 PM) */
1506 /* 0x03 */ x86emuOp2_illegal_op, /* lsl (ring 0 PM) */
1507 /* 0x04 */ x86emuOp2_illegal_op,
1508 /* 0x05 */ x86emuOp2_illegal_op, /* loadall (undocumented) */
1509 /* 0x06 */ x86emuOp2_illegal_op, /* clts (ring 0 PM) */
1510 /* 0x07 */ x86emuOp2_illegal_op, /* loadall (undocumented) */
1511 /* 0x08 */ x86emuOp2_illegal_op, /* invd (ring 0 PM) */
1512 /* 0x09 */ x86emuOp2_illegal_op, /* wbinvd (ring 0 PM) */
1513 /* 0x0a */ x86emuOp2_illegal_op,
1514 /* 0x0b */ x86emuOp2_illegal_op,
1515 /* 0x0c */ x86emuOp2_illegal_op,
1516 /* 0x0d */ x86emuOp2_illegal_op,
1517 /* 0x0e */ x86emuOp2_illegal_op,
1518 /* 0x0f */ x86emuOp2_illegal_op,
1520 /* 0x10 */ x86emuOp2_illegal_op,
1521 /* 0x11 */ x86emuOp2_illegal_op,
1522 /* 0x12 */ x86emuOp2_illegal_op,
1523 /* 0x13 */ x86emuOp2_illegal_op,
1524 /* 0x14 */ x86emuOp2_illegal_op,
1525 /* 0x15 */ x86emuOp2_illegal_op,
1526 /* 0x16 */ x86emuOp2_illegal_op,
1527 /* 0x17 */ x86emuOp2_illegal_op,
1528 /* 0x18 */ x86emuOp2_illegal_op,
1529 /* 0x19 */ x86emuOp2_illegal_op,
1530 /* 0x1a */ x86emuOp2_illegal_op,
1531 /* 0x1b */ x86emuOp2_illegal_op,
1532 /* 0x1c */ x86emuOp2_illegal_op,
1533 /* 0x1d */ x86emuOp2_illegal_op,
1534 /* 0x1e */ x86emuOp2_illegal_op,
1535 /* 0x1f */ x86emuOp2_illegal_op,
1537 /* 0x20 */ x86emuOp2_illegal_op, /* mov reg32,creg (ring 0 PM) */
1538 /* 0x21 */ x86emuOp2_illegal_op, /* mov reg32,dreg (ring 0 PM) */
1539 /* 0x22 */ x86emuOp2_illegal_op, /* mov creg,reg32 (ring 0 PM) */
1540 /* 0x23 */ x86emuOp2_illegal_op, /* mov dreg,reg32 (ring 0 PM) */
1541 /* 0x24 */ x86emuOp2_illegal_op, /* mov reg32,treg (ring 0 PM) */
1542 /* 0x25 */ x86emuOp2_illegal_op,
1543 /* 0x26 */ x86emuOp2_illegal_op, /* mov treg,reg32 (ring 0 PM) */
1544 /* 0x27 */ x86emuOp2_illegal_op,
1545 /* 0x28 */ x86emuOp2_illegal_op,
1546 /* 0x29 */ x86emuOp2_illegal_op,
1547 /* 0x2a */ x86emuOp2_illegal_op,
1548 /* 0x2b */ x86emuOp2_illegal_op,
1549 /* 0x2c */ x86emuOp2_illegal_op,
1550 /* 0x2d */ x86emuOp2_illegal_op,
1551 /* 0x2e */ x86emuOp2_illegal_op,
1552 /* 0x2f */ x86emuOp2_illegal_op,
1554 /* 0x30 */ x86emuOp2_illegal_op,
1555 /* 0x31 */ x86emuOp2_illegal_op,
1556 /* 0x32 */ x86emuOp2_illegal_op,
1557 /* 0x33 */ x86emuOp2_illegal_op,
1558 /* 0x34 */ x86emuOp2_illegal_op,
1559 /* 0x35 */ x86emuOp2_illegal_op,
1560 /* 0x36 */ x86emuOp2_illegal_op,
1561 /* 0x37 */ x86emuOp2_illegal_op,
1562 /* 0x38 */ x86emuOp2_illegal_op,
1563 /* 0x39 */ x86emuOp2_illegal_op,
1564 /* 0x3a */ x86emuOp2_illegal_op,
1565 /* 0x3b */ x86emuOp2_illegal_op,
1566 /* 0x3c */ x86emuOp2_illegal_op,
1567 /* 0x3d */ x86emuOp2_illegal_op,
1568 /* 0x3e */ x86emuOp2_illegal_op,
1569 /* 0x3f */ x86emuOp2_illegal_op,
1571 /* 0x40 */ x86emuOp2_illegal_op,
1572 /* 0x41 */ x86emuOp2_illegal_op,
1573 /* 0x42 */ x86emuOp2_illegal_op,
1574 /* 0x43 */ x86emuOp2_illegal_op,
1575 /* 0x44 */ x86emuOp2_illegal_op,
1576 /* 0x45 */ x86emuOp2_illegal_op,
1577 /* 0x46 */ x86emuOp2_illegal_op,
1578 /* 0x47 */ x86emuOp2_illegal_op,
1579 /* 0x48 */ x86emuOp2_illegal_op,
1580 /* 0x49 */ x86emuOp2_illegal_op,
1581 /* 0x4a */ x86emuOp2_illegal_op,
1582 /* 0x4b */ x86emuOp2_illegal_op,
1583 /* 0x4c */ x86emuOp2_illegal_op,
1584 /* 0x4d */ x86emuOp2_illegal_op,
1585 /* 0x4e */ x86emuOp2_illegal_op,
1586 /* 0x4f */ x86emuOp2_illegal_op,
1588 /* 0x50 */ x86emuOp2_illegal_op,
1589 /* 0x51 */ x86emuOp2_illegal_op,
1590 /* 0x52 */ x86emuOp2_illegal_op,
1591 /* 0x53 */ x86emuOp2_illegal_op,
1592 /* 0x54 */ x86emuOp2_illegal_op,
1593 /* 0x55 */ x86emuOp2_illegal_op,
1594 /* 0x56 */ x86emuOp2_illegal_op,
1595 /* 0x57 */ x86emuOp2_illegal_op,
1596 /* 0x58 */ x86emuOp2_illegal_op,
1597 /* 0x59 */ x86emuOp2_illegal_op,
1598 /* 0x5a */ x86emuOp2_illegal_op,
1599 /* 0x5b */ x86emuOp2_illegal_op,
1600 /* 0x5c */ x86emuOp2_illegal_op,
1601 /* 0x5d */ x86emuOp2_illegal_op,
1602 /* 0x5e */ x86emuOp2_illegal_op,
1603 /* 0x5f */ x86emuOp2_illegal_op,
1605 /* 0x60 */ x86emuOp2_illegal_op,
1606 /* 0x61 */ x86emuOp2_illegal_op,
1607 /* 0x62 */ x86emuOp2_illegal_op,
1608 /* 0x63 */ x86emuOp2_illegal_op,
1609 /* 0x64 */ x86emuOp2_illegal_op,
1610 /* 0x65 */ x86emuOp2_illegal_op,
1611 /* 0x66 */ x86emuOp2_illegal_op,
1612 /* 0x67 */ x86emuOp2_illegal_op,
1613 /* 0x68 */ x86emuOp2_illegal_op,
1614 /* 0x69 */ x86emuOp2_illegal_op,
1615 /* 0x6a */ x86emuOp2_illegal_op,
1616 /* 0x6b */ x86emuOp2_illegal_op,
1617 /* 0x6c */ x86emuOp2_illegal_op,
1618 /* 0x6d */ x86emuOp2_illegal_op,
1619 /* 0x6e */ x86emuOp2_illegal_op,
1620 /* 0x6f */ x86emuOp2_illegal_op,
1622 /* 0x70 */ x86emuOp2_illegal_op,
1623 /* 0x71 */ x86emuOp2_illegal_op,
1624 /* 0x72 */ x86emuOp2_illegal_op,
1625 /* 0x73 */ x86emuOp2_illegal_op,
1626 /* 0x74 */ x86emuOp2_illegal_op,
1627 /* 0x75 */ x86emuOp2_illegal_op,
1628 /* 0x76 */ x86emuOp2_illegal_op,
1629 /* 0x77 */ x86emuOp2_illegal_op,
1630 /* 0x78 */ x86emuOp2_illegal_op,
1631 /* 0x79 */ x86emuOp2_illegal_op,
1632 /* 0x7a */ x86emuOp2_illegal_op,
1633 /* 0x7b */ x86emuOp2_illegal_op,
1634 /* 0x7c */ x86emuOp2_illegal_op,
1635 /* 0x7d */ x86emuOp2_illegal_op,
1636 /* 0x7e */ x86emuOp2_illegal_op,
1637 /* 0x7f */ x86emuOp2_illegal_op,
1639 /* 0x80 */ x86emuOp2_long_jump,
1640 /* 0x81 */ x86emuOp2_long_jump,
1641 /* 0x82 */ x86emuOp2_long_jump,
1642 /* 0x83 */ x86emuOp2_long_jump,
1643 /* 0x84 */ x86emuOp2_long_jump,
1644 /* 0x85 */ x86emuOp2_long_jump,
1645 /* 0x86 */ x86emuOp2_long_jump,
1646 /* 0x87 */ x86emuOp2_long_jump,
1647 /* 0x88 */ x86emuOp2_long_jump,
1648 /* 0x89 */ x86emuOp2_long_jump,
1649 /* 0x8a */ x86emuOp2_long_jump,
1650 /* 0x8b */ x86emuOp2_long_jump,
1651 /* 0x8c */ x86emuOp2_long_jump,
1652 /* 0x8d */ x86emuOp2_long_jump,
1653 /* 0x8e */ x86emuOp2_long_jump,
1654 /* 0x8f */ x86emuOp2_long_jump,
1656 /* 0x90 */ x86emuOp2_set_byte,
1657 /* 0x91 */ x86emuOp2_set_byte,
1658 /* 0x92 */ x86emuOp2_set_byte,
1659 /* 0x93 */ x86emuOp2_set_byte,
1660 /* 0x94 */ x86emuOp2_set_byte,
1661 /* 0x95 */ x86emuOp2_set_byte,
1662 /* 0x96 */ x86emuOp2_set_byte,
1663 /* 0x97 */ x86emuOp2_set_byte,
1664 /* 0x98 */ x86emuOp2_set_byte,
1665 /* 0x99 */ x86emuOp2_set_byte,
1666 /* 0x9a */ x86emuOp2_set_byte,
1667 /* 0x9b */ x86emuOp2_set_byte,
1668 /* 0x9c */ x86emuOp2_set_byte,
1669 /* 0x9d */ x86emuOp2_set_byte,
1670 /* 0x9e */ x86emuOp2_set_byte,
1671 /* 0x9f */ x86emuOp2_set_byte,
1673 /* 0xa0 */ x86emuOp2_push_FS,
1674 /* 0xa1 */ x86emuOp2_pop_FS,
1675 /* 0xa2 */ x86emuOp2_illegal_op,
1676 /* 0xa3 */ x86emuOp2_bt_R,
1677 /* 0xa4 */ x86emuOp2_shld_IMM,
1678 /* 0xa5 */ x86emuOp2_shld_CL,
1679 /* 0xa6 */ x86emuOp2_illegal_op,
1680 /* 0xa7 */ x86emuOp2_illegal_op,
1681 /* 0xa8 */ x86emuOp2_push_GS,
1682 /* 0xa9 */ x86emuOp2_pop_GS,
1683 /* 0xaa */ x86emuOp2_illegal_op,
1684 /* 0xab */ x86emuOp2_bt_R,
1685 /* 0xac */ x86emuOp2_shrd_IMM,
1686 /* 0xad */ x86emuOp2_shrd_CL,
1687 /* 0xae */ x86emuOp2_illegal_op,
1688 /* 0xaf */ x86emuOp2_imul_R_RM,
1690 /* 0xb0 */ x86emuOp2_illegal_op, /* TODO: cmpxchg */
1691 /* 0xb1 */ x86emuOp2_illegal_op, /* TODO: cmpxchg */
1692 /* 0xb2 */ x86emuOp2_lss_R_IMM,
1693 /* 0xb3 */ x86emuOp2_btr_R,
1694 /* 0xb4 */ x86emuOp2_lfs_R_IMM,
1695 /* 0xb5 */ x86emuOp2_lgs_R_IMM,
1696 /* 0xb6 */ x86emuOp2_movzx_byte_R_RM,
1697 /* 0xb7 */ x86emuOp2_movzx_word_R_RM,
1698 /* 0xb8 */ x86emuOp2_illegal_op,
1699 /* 0xb9 */ x86emuOp2_illegal_op,
1700 /* 0xba */ x86emuOp2_btX_I,
1701 /* 0xbb */ x86emuOp2_btc_R,
1702 /* 0xbc */ x86emuOp2_bsf,
1703 /* 0xbd */ x86emuOp2_bsr,
1704 /* 0xbe */ x86emuOp2_movsx_byte_R_RM,
1705 /* 0xbf */ x86emuOp2_movsx_word_R_RM,
1707 /* 0xc0 */ x86emuOp2_illegal_op, /* TODO: xadd */
1708 /* 0xc1 */ x86emuOp2_illegal_op, /* TODO: xadd */
1709 /* 0xc2 */ x86emuOp2_illegal_op,
1710 /* 0xc3 */ x86emuOp2_illegal_op,
1711 /* 0xc4 */ x86emuOp2_illegal_op,
1712 /* 0xc5 */ x86emuOp2_illegal_op,
1713 /* 0xc6 */ x86emuOp2_illegal_op,
1714 /* 0xc7 */ x86emuOp2_illegal_op,
1715 /* 0xc8 */ x86emuOp2_illegal_op, /* TODO: bswap */
1716 /* 0xc9 */ x86emuOp2_illegal_op, /* TODO: bswap */
1717 /* 0xca */ x86emuOp2_illegal_op, /* TODO: bswap */
1718 /* 0xcb */ x86emuOp2_illegal_op, /* TODO: bswap */
1719 /* 0xcc */ x86emuOp2_illegal_op, /* TODO: bswap */
1720 /* 0xcd */ x86emuOp2_illegal_op, /* TODO: bswap */
1721 /* 0xce */ x86emuOp2_illegal_op, /* TODO: bswap */
1722 /* 0xcf */ x86emuOp2_illegal_op, /* TODO: bswap */
1724 /* 0xd0 */ x86emuOp2_illegal_op,
1725 /* 0xd1 */ x86emuOp2_illegal_op,
1726 /* 0xd2 */ x86emuOp2_illegal_op,
1727 /* 0xd3 */ x86emuOp2_illegal_op,
1728 /* 0xd4 */ x86emuOp2_illegal_op,
1729 /* 0xd5 */ x86emuOp2_illegal_op,
1730 /* 0xd6 */ x86emuOp2_illegal_op,
1731 /* 0xd7 */ x86emuOp2_illegal_op,
1732 /* 0xd8 */ x86emuOp2_illegal_op,
1733 /* 0xd9 */ x86emuOp2_illegal_op,
1734 /* 0xda */ x86emuOp2_illegal_op,
1735 /* 0xdb */ x86emuOp2_illegal_op,
1736 /* 0xdc */ x86emuOp2_illegal_op,
1737 /* 0xdd */ x86emuOp2_illegal_op,
1738 /* 0xde */ x86emuOp2_illegal_op,
1739 /* 0xdf */ x86emuOp2_illegal_op,
1741 /* 0xe0 */ x86emuOp2_illegal_op,
1742 /* 0xe1 */ x86emuOp2_illegal_op,
1743 /* 0xe2 */ x86emuOp2_illegal_op,
1744 /* 0xe3 */ x86emuOp2_illegal_op,
1745 /* 0xe4 */ x86emuOp2_illegal_op,
1746 /* 0xe5 */ x86emuOp2_illegal_op,
1747 /* 0xe6 */ x86emuOp2_illegal_op,
1748 /* 0xe7 */ x86emuOp2_illegal_op,
1749 /* 0xe8 */ x86emuOp2_illegal_op,
1750 /* 0xe9 */ x86emuOp2_illegal_op,
1751 /* 0xea */ x86emuOp2_illegal_op,
1752 /* 0xeb */ x86emuOp2_illegal_op,
1753 /* 0xec */ x86emuOp2_illegal_op,
1754 /* 0xed */ x86emuOp2_illegal_op,
1755 /* 0xee */ x86emuOp2_illegal_op,
1756 /* 0xef */ x86emuOp2_illegal_op,
1758 /* 0xf0 */ x86emuOp2_illegal_op,
1759 /* 0xf1 */ x86emuOp2_illegal_op,
1760 /* 0xf2 */ x86emuOp2_illegal_op,
1761 /* 0xf3 */ x86emuOp2_illegal_op,
1762 /* 0xf4 */ x86emuOp2_illegal_op,
1763 /* 0xf5 */ x86emuOp2_illegal_op,
1764 /* 0xf6 */ x86emuOp2_illegal_op,
1765 /* 0xf7 */ x86emuOp2_illegal_op,
1766 /* 0xf8 */ x86emuOp2_illegal_op,
1767 /* 0xf9 */ x86emuOp2_illegal_op,
1768 /* 0xfa */ x86emuOp2_illegal_op,
1769 /* 0xfb */ x86emuOp2_illegal_op,
1770 /* 0xfc */ x86emuOp2_illegal_op,
1771 /* 0xfd */ x86emuOp2_illegal_op,
1772 /* 0xfe */ x86emuOp2_illegal_op,
1773 /* 0xff */ x86emuOp2_illegal_op,