YAD

Aug 18, 2008 16:02


#ifdef CHECK_LOCK_PREFIX /* check lock prefix */ if (diza->p_lock) { if (mod == 3) return 0; /* two byte opcodes */ if (diza->opcode2) { c = diza->opcode2; if (c == 0xba && reg > 4) goto lock_ok; if (c == 0xc7 && reg == 1) goto lock_ok; /* ab c0 c1 b0 b1 b3 bb */ if (c == 0xab || ((c & 0xfc) == 0xb0 && c != 0xb2) || (c & 0xfe) == 0xc0 || c == 0xbb) goto lock_ok; /* MOV Rd,CR8D / MOV CR8D,Rd */ if (c == 0x20 || c == 0x22) goto lock_ok; } else { c = diza->opcode & 0xfe; /* 00 01 08 09 10 11 18 19 20 21 28 29 30 31 */ if ((c & 7) == 0 && (c >> 3) < 7) goto lock_ok; /* 86 87 */ if (c == 0x86) goto lock_ok; if (c == 0xf6 && (reg & 0xfe) == 2) goto lock_ok; if (c == 0xfe && (reg & 0xfe) == 0) goto lock_ok; /* group1 */ if ((diza->opcode & 0xfc) == 0x80 && reg != 7) goto lock_ok; } return 0; } lock_ok: #endif .......................................... #ifdef CHECK_ARGS /* mod != 11, check oprands */ /* MOV Rd,Cd / MOV Rd,Dd / MOV Cd,Rd / MOV Dd,Rd */ if ((diza->opcode2 & 0xfc) == 0x20) return 0; /* FIXME: more checks here ... */ #endif } else { #ifdef CHECK_ARGS /* mod == 11, check operands, the code was taken from HDE32 */ if (diza->opcode2) { c = diza->opcode2; if /* group#7 0f 01 SGDT/SIDT/LGDT/LIDT Ms/../../../INVLPG M */ (c == 0x01 && (reg < 4 || reg == 7)) || /* group#9 0f c7 CMPXCHG Mq */ (c == 0xc7 && reg == 1) || /* 0f b2 LSS Gz,Mp */ /* 0f b4 LFS Gz,Mp */ /* 0f b5 LGS Gz,Mp */ (c == 0xb2 || c == 0xb4 || c == 0xb5) || /* group#16 0f ae FXSAVE M512 / FXRSTOR M512 / LDMXCSR Md / STMXCSR Md / XSAVE M */ (c == 0xae && reg < 5) /* FIXME: more checks here, SSE... */ return 0; } else { c = diza->opcode; if /* 62 BOUND Gv,Ma */ /* 8d LEA Gv,M */ /* c4 LES Gz,Mp */ /* c5 LDS Gz,Mp */ (c == 0x62 || c == 0x8d || (c & 0xfe) == 0xc4) || /* group#5 CALL Mp, JMP Mp */ (c == 0xff && reg == 3 || reg == 5) return 0; } #endif } А еще нужно забить reg-only команды и SSE mem-only. Но на сегодня пожалуй хватит. Ж-)
Previous post Next post
Up