Changeset 621
- Timestamp:
- 08/21/10 08:36:24 (14 years ago)
- Files:
-
- branches/dmd-1.x/src/backend/cod1.c (modified) (2 diffs)
- branches/dmd-1.x/src/backend/ptrntab.c (modified) (10 diffs)
- branches/dmd-1.x/src/e2ir.c (modified) (1 diff)
- branches/dmd-1.x/src/impcnvgen.c (modified) (1 diff)
- trunk/src/backend/cod1.c (modified) (2 diffs)
- trunk/src/backend/ptrntab.c (modified) (10 diffs)
- trunk/src/e2ir.c (modified) (1 diff)
- trunk/src/impcnvgen.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/dmd-1.x/src/backend/cod1.c
r619 r621 1146 1146 c = cdisscaledindex(e11,&idxregs,keepmsk); 1147 1147 reg = findreg(idxregs); 1148 1148 pcs->Irm = modregrm(0,0,4); 1149 1149 pcs->Isib = modregrm(ss,reg & 7,5); 1150 1150 if (reg & 8) 1151 1151 pcs->Irex |= REX_X; 1152 1152 } 1153 1153 else 1154 1154 { 1155 1155 c = scodelem(e11,&idxregs,keepmsk,TRUE); // load index reg 1156 1156 setaddrmode(pcs, idxregs); 1157 1157 } 1158 1158 goto Lptr; 1159 1159 } 1160 1160 1161 1161 /* Look for *(v1 + v2) 1162 1162 * EA = [v1][v2] 1163 1163 */ 1164 1164 1165 1165 if (!I16 && e1isadd && (!e1->Ecount || !e1free) && 1166 tysize[e1ty] == REGSIZE)1166 (tysize[e1ty] == REGSIZE || (I64 && tysize[e1ty] == 4))) 1167 1167 { code *c2; 1168 1168 regm_t idxregs2; 1169 1169 unsigned base,index; 1170 1170 int ss; 1171 1171 1172 1172 L4: 1173 1173 // Look for *(v1 + v2 << scale) 1174 1174 ss = isscaledindex(e12); 1175 1175 if (ss) 1176 1176 { 1177 1177 c = scodelem(e11,&idxregs,keepmsk,TRUE); 1178 1178 idxregs2 = allregs & ~(idxregs | keepmsk); 1179 1179 c2 = cdisscaledindex(e12,&idxregs2,keepmsk | idxregs); 1180 1180 } 1181 1181 1182 1182 // Look for *(v1 << scale + v2) 1183 1183 else if ((ss = isscaledindex(e11)) != 0) 1184 1184 { 1185 1185 idxregs2 = idxregs; 1186 1186 c = cdisscaledindex(e11,&idxregs2,keepmsk); … … 3522 3522 L3: 3523 3523 cssave(e,*pretregs,FALSE); 3524 3524 freenode(e); 3525 3525 return c; 3526 3526 } 3527 3527 3528 3528 3529 3529 /****************************** 3530 3530 * Generate code to load data into registers. 3531 3531 */ 3532 3532 3533 3533 code *loaddata(elem *e,regm_t *pretregs) 3534 3534 { unsigned reg,nreg,op,sreg; 3535 3535 tym_t tym; 3536 3536 int sz; 3537 3537 code *c,*ce,cs; 3538 3538 regm_t flags,forregs,regm; 3539 3539 3540 3540 #ifdef DEBUG 3541 3541 if (debugw) 3542 printf("loaddata(e = %p,*pretregs = x%x)\n",e,*pretregs);3542 printf("loaddata(e = %p,*pretregs = %s)\n",e,regm_str(*pretregs)); 3543 3543 //elem_print(e); 3544 3544 #endif 3545 3545 assert(e); 3546 3546 elem_debug(e); 3547 3547 if (*pretregs == 0) 3548 3548 return CNIL; 3549 3549 tym = tybasic(e->Ety); 3550 3550 if (tym == TYstruct) 3551 3551 return cdrelconst(e,pretregs); 3552 3552 if (tyfloating(tym)) 3553 3553 { obj_fltused(); 3554 3554 if (config.inline8087) 3555 3555 { if (*pretregs & mST0) 3556 3556 return load87(e,0,pretregs,NULL,-1); 3557 3557 else if (tycomplex(tym)) 3558 3558 return cload87(e, pretregs); 3559 3559 } 3560 3560 } 3561 3561 sz = tysize[tym]; 3562 3562 cs.Iflags = 0; branches/dmd-1.x/src/backend/ptrntab.c
r619 r621 15 15 #include <stdlib.h> 16 16 #include <string.h> 17 17 #include <time.h> 18 18 19 19 #include "cc.h" 20 20 #include "code.h" 21 21 #include "iasm.h" 22 22 23 23 static char __file__[] = __FILE__; /* for tassert.h */ 24 24 #include "tassert.h" 25 25 26 26 // 27 27 // NOTE: For 0 operand instructions, the opcode is taken from 28 28 // the first entry and no subsequent entries are required. 29 29 // for instructions with operands, a NULL entry is required at the end 30 30 // as a terminator 31 31 // 32 32 // 0 Operand instructions 33 33 // 34 34 35 PTRNTAB0 aptb0AAA[] = /* AAA */ { 36 { 0x37, _modax }, 37 }; 38 39 PTRNTAB0 aptb0AAD[] = /* AAD */ { 40 { 0xd50a, _modax } 41 }; 42 43 PTRNTAB0 aptb0AAM[] = /* AAM */ { 44 { 0xd40a, _modax } 45 }; 46 PTRNTAB0 aptb0AAS[] = /* AAS */ { 47 { 0x3f, _modax } 48 }; 49 PTRNTAB0 aptb0CBW[] = /* CBW */ { 50 { 0x98, _16_bit | _modax } 51 }; 52 PTRNTAB0 aptb0CWDE[] = /* CWDE */ { 53 { 0x98, _32_bit | _I386 | _modax } 54 }; 55 PTRNTAB0 aptb0CDQE[] = /* CDQE */ { 56 { 0x98, _64_bit | _modax } 57 }; 58 PTRNTAB0 aptb0CLC[] = /* CLC */ { 59 { 0xf8, 0 } 60 }; 61 62 PTRNTAB0 aptb0CLD[] = /* CLD */ { 63 { 0xfc, 0 } 64 }; 65 PTRNTAB0 aptb0CLI[] = /* CLI */ { 66 { 0xfa, 0 } 67 }; 68 69 PTRNTAB0 aptb0CLTS[] = /* CLTS */ { 70 { 0x0f06, 0 } 71 }; 72 73 PTRNTAB0 aptb0CMC[] = /* CMC */ { 74 { 0xf5, 0 } 75 }; 76 77 PTRNTAB0 aptb0CMPSB[] = /* CMPSB */ { 78 { 0xa6, _modsidi } 79 }; 80 81 PTRNTAB0 aptb0CMPSW[] = /* CMPSW */ { 82 { 0xa7, _16_bit | _modsidi } 83 }; 84 85 #if 0 86 PTRNTAB0 aptb0CMPSD[] = /* CMPSD */ { 87 { 0xa7, _32_bit | _I386 | _modsidi } 88 }; 89 #endif 90 91 PTRNTAB0 aptb0CWD[] = /* CWD */ { 92 { 0x99, _16_bit | _modaxdx } 93 }; 94 95 PTRNTAB0 aptb0CDQ[] = /* CDQ */ { 96 { 0x99, _32_bit | _I386 | _modaxdx } 97 }; 98 99 PTRNTAB0 aptb0CQO[] = /* CQO */ { 100 { 0x99, _64_bit | _modaxdx } 101 }; 102 103 PTRNTAB0 aptb0DAA[] = /* DAA */ { 104 { 0x27, _modax } 105 }; 106 107 PTRNTAB0 aptb0DAS[] = /* DAS */ { 108 { 0x2f, _modax } 109 }; 110 111 PTRNTAB0 aptb0HLT[] = /* HLT */ { 112 { 0xf4, 0 } 113 }; 114 115 PTRNTAB0 aptb0INSB[] = /* INSB */ { 116 { 0x6c, _I386 | _modsi } 117 }; 118 119 PTRNTAB0 aptb0INSW[] = /* INSW */ { 120 { 0x6d, _16_bit | _I386 | _modsi } 121 }; 122 123 PTRNTAB0 aptb0INSD[] = /* INSD */ { 124 { 0x6d, _32_bit | _I386 | _modsi } 125 }; 126 127 PTRNTAB0 aptb0INTO[] = /* INTO */ { 128 { 0xce, 0 } 129 }; 130 PTRNTAB0 aptb0INVD[] = /* INVD */ { 131 { 0x0f08, _I386 } // Actually a 486 only instruction 132 }; 133 PTRNTAB0 aptb0IRET[] = /* IRET */ { 134 { 0xcf, _16_bit } 135 }; 136 137 PTRNTAB0 aptb0IRETD[] = /* IRETD */ { 138 { 0xcf, _32_bit | _I386 } 139 }; 140 141 PTRNTAB0 aptb0LAHF[] = /* LAHF */ { 142 { 0x9f, _modax } 143 }; 144 145 PTRNTAB0 aptb0LEAVE[] = /* LEAVE */ { 146 { 0xc9, _I386 } 147 }; 148 149 PTRNTAB0 aptb0LOCK[] = /* LOCK */ { 150 { 0xf0, 0 } 151 }; 152 153 PTRNTAB0 aptb0LODSB[] = /* LODSB */ { 154 { 0xac, _modsiax } 155 }; 156 157 PTRNTAB0 aptb0LODSW[] = /* LODSW */ { 158 { 0xad, _16_bit | _modsiax } 159 }; 160 161 PTRNTAB0 aptb0LODSD[] = /* LODSD */ { 162 { 0xad, _32_bit | _I386 | _modsiax } 163 }; 164 165 PTRNTAB0 aptb0MOVSB[] = /* MOVSB */ { 166 { 0xa4, _modsidi} 167 }; 168 169 PTRNTAB0 aptb0MOVSW[] = /* MOVSW */ { 170 { 0xa5, _16_bit | _modsidi } 171 }; 35 #define OPTABLE0(str,op,mod) PTRNTAB0 aptb0##str[] = { { op, mod }, }; 36 37 OPTABLE0(AAA, 0x37,_modax); 38 OPTABLE0(AAD, 0xd50a,_modax); 39 OPTABLE0(AAM, 0xd40a,_modax); 40 OPTABLE0(AAS, 0x3f,_modax); 41 OPTABLE0(CBW, 0x98,_16_bit | _modax); 42 OPTABLE0(CWDE, 0x98,_32_bit | _I386 | _modax); 43 OPTABLE0(CDQE, 0x98,_64_bit | _modax); 44 OPTABLE0(CLC, 0xf8,0); 45 OPTABLE0(CLD, 0xfc,0); 46 OPTABLE0(CLI, 0xfa,0); 47 OPTABLE0(CLTS, 0x0f06,0); 48 OPTABLE0(CMC, 0xf5,0); 49 OPTABLE0(CMPSB, 0xa6,_modsidi); 50 OPTABLE0(CMPSW, 0xa7,_16_bit | _modsidi); 51 //OPTABLE0(CMPSD, 0xa7,_32_bit | _I386 | _modsidi); 52 OPTABLE0(CMPSQ, 0xa7,_64_bit | _modsidi); 53 OPTABLE0(CWD, 0x99, _16_bit | _modaxdx); 54 OPTABLE0(CDQ, 0x99,_32_bit | _I386 | _modaxdx); 55 OPTABLE0(CQO, 0x99, _64_bit | _modaxdx); 56 OPTABLE0(DAA, 0x27,_modax); 57 OPTABLE0(DAS, 0x2f,_modax); 58 OPTABLE0(HLT, 0xf4,0); 59 OPTABLE0(INSB, 0x6c,_I386 | _modsi); 60 OPTABLE0(INSW, 0x6d,_16_bit | _I386 | _modsi); 61 OPTABLE0(INSD, 0x6d,_32_bit | _I386 | _modsi); 62 OPTABLE0(INTO, 0xce,0); 63 OPTABLE0(INVD, 0x0f08,_I386); // Actually a 486 only instruction 64 OPTABLE0(IRET, 0xcf,_16_bit); 65 OPTABLE0(IRETD, 0xcf,_32_bit | _I386); 66 OPTABLE0(LAHF, 0x9f,_modax); 67 OPTABLE0(LEAVE, 0xc9,_I386); 68 OPTABLE0(LOCK, 0xf0,0); 69 OPTABLE0(LODSB, 0xac,_modsiax); 70 OPTABLE0(LODSW, 0xad,_16_bit | _modsiax); 71 OPTABLE0(LODSD, 0xad,_32_bit | _I386 | _modsiax); 72 OPTABLE0(LODSQ, 0xad,_64_bit | _modsiax); 73 OPTABLE0(MOVSB, 0xa4, _modsidi); 74 OPTABLE0(MOVSW, 0xa5, _16_bit | _modsidi); 75 OPTABLE0(MOVSQ, 0xa5, _64_bit | _modsidi); 76 OPTABLE0(NOP, 0x90, 0); 77 OPTABLE0(OUTSB, 0x6e, _I386 | _modsi); 78 OPTABLE0(OUTSW, 0x6f, _16_bit | _I386 | _modsi); 79 OPTABLE0(OUTSD, 0x6f, _32_bit | _I386 | _modsi); 80 OPTABLE0(POPA, 0x61, _16_bit | _I386 | _modall); 81 OPTABLE0(POPAD, 0x61, _32_bit | _I386 | _modall); 82 OPTABLE0(POPF, 0x9d, _16_bit); 83 OPTABLE0(POPFD, 0x9d, _32_bit | _I386); 84 OPTABLE0(PUSHA, 0x60, _16_bit | _I386); 85 OPTABLE0(PUSHAD, 0x60, _32_bit | _I386); 86 OPTABLE0(PUSHF, 0x9c, _16_bit); 87 OPTABLE0(PUSHFD, 0x9c, _32_bit | _I386); 88 OPTABLE0(REP, 0xf3, _modcx); 89 OPTABLE0(REPNE, 0xf2, _modcx); 90 OPTABLE0(SAHF, 0x9e, 0); 91 OPTABLE0(SCASB, 0xAE, _moddi); 92 OPTABLE0(SCASW, 0xAF, _16_bit | _moddi); 93 OPTABLE0(SCASD, 0xAF, _32_bit | _I386 | _moddi); 94 OPTABLE0(SCASQ, 0xAF, _64_bit | _moddi); 95 OPTABLE0(STC, 0xf9, 0); 96 OPTABLE0(STD, 0xfd, 0); 97 OPTABLE0(STI, 0xfb, 0); 98 OPTABLE0(STOSB, 0xaa, _moddi); 99 OPTABLE0(STOSW, 0xAB, _16_bit | _moddi); 100 OPTABLE0(STOSD, 0xAB, _32_bit | _I386 | _moddi); 101 OPTABLE0(STOSQ, 0xAB, _64_bit | _moddi); 102 OPTABLE0(WAIT, 0x9B, 0); 103 OPTABLE0(WBINVD, 0x0f09, _I386); // Really a 486 opcode 104 OPTABLE0(XLATB, 0xd7, _modax); 105 OPTABLE0(CPUID, 0x0fa2, _I386 | _modall); 106 OPTABLE0(RDMSR, 0x0f32, _I386 | _modaxdx); 107 OPTABLE0(RDPMC, 0x0f33, _I386 | _modaxdx); 108 OPTABLE0(RDTSC, 0x0f31, _I386 | _modaxdx); 109 OPTABLE0(WRMSR, 0x0f30, _I386); 110 OPTABLE0(RSM, 0x0faa, _I386); 172 111 173 112 PTRNTAB2 aptb2MOVSD[] = /* MOVSD */ { 174 113 { 0xa5, _32_bit | _I386 | _modsidi }, 175 114 { 0xF20F10, _r, _xmm, _xmm_m64 }, 176 115 { 0xF20F11, _r, _xmm_m64, _xmm }, 177 116 }; 178 117 179 PTRNTAB0 aptb0NOP[] = /* NOP */ {180 { 0x90, 0 }181 };182 183 PTRNTAB0 aptb0OUTSB[] = /* OUTSB */ {184 { 0x6e, _I386 | _modsi }185 };186 187 PTRNTAB0 aptb0OUTSW[] = /* OUTSW */ {188 { 0x6f, _16_bit | _I386 | _modsi }189 };190 191 PTRNTAB0 aptb0OUTSD[] = /* OUTSD */ {192 { 0x6f, _32_bit | _I386 | _modsi }193 };194 195 PTRNTAB0 aptb0POPA[] = /* POPA */ {196 { 0x61, _16_bit | _I386 | _modall }197 };198 199 PTRNTAB0 aptb0POPAD[] = /* POPAD */ {200 { 0x61, _32_bit | _I386 | _modall }201 };202 203 PTRNTAB0 aptb0POPF[] = /* POPF */ {204 { 0x9d, _16_bit }205 };206 207 PTRNTAB0 aptb0POPFD[] = /* POPFD */ {208 { 0x9d, _32_bit | _I386 }209 };210 211 PTRNTAB0 aptb0PUSHA[] = /* PUSHA */ {212 { 0x60, _16_bit | _I386 }213 };214 215 PTRNTAB0 aptb0PUSHAD[] = /* PUSHAD */ {216 { 0x60, _32_bit | _I386 }217 };218 219 PTRNTAB0 aptb0PUSHF[]= /* PUSHF */ {220 {0x9c, _16_bit }221 };222 223 PTRNTAB0 aptb0PUSHFD[] = /* PUSHFD */ {224 { 0x9c, _32_bit | _I386 }225 };226 227 PTRNTAB0 aptb0REP[] = /* REP */ {228 { 0xf3, _modcx }229 };230 231 PTRNTAB0 aptb0REPNE[] = /* REPNE */ {232 { 0xf2, _modcx }233 };234 235 PTRNTAB0 aptb0SAHF[] = /* SAHF */ {236 { 0x9e, 0 }237 };238 239 PTRNTAB0 aptb0SCASB[] = /* SCASB */ {240 { 0xAE, _moddi }241 };242 243 PTRNTAB0 aptb0SCASW[] = /* SCASW */ {244 { 0xAF, _16_bit | _moddi}245 };246 247 PTRNTAB0 aptb0SCASD[] = /* SCASD */ {248 { 0xAF, _32_bit | _I386 | _moddi }249 };250 251 PTRNTAB0 aptb0STC[] = /* STC */ {252 { 0xf9, 0 }253 };254 255 PTRNTAB0 aptb0STD[] = /* STD */ {256 { 0xfd, 0 }257 };258 259 PTRNTAB0 aptb0STI[] = /* STI */ {260 { 0xfb, 0 }261 };262 PTRNTAB0 aptb0STOSB[] = /* STOSB */ {263 { 0xaa, _moddi }264 };265 266 PTRNTAB0 aptb0STOSW[] = /* STOSW */ {267 { 0xAB, _16_bit | _moddi }268 };269 270 PTRNTAB0 aptb0STOSD[] = /* STOSD */ {271 { 0xAB, _32_bit | _I386 | _moddi }272 };273 274 PTRNTAB0 aptb0WAIT[] = /* WAIT */ {275 { 0x9B, 0 }276 };277 PTRNTAB0 aptb0WBINVD[] = /* WBINVD */ {278 { 0xf09, _I386 } // Really a 486 opcode279 };280 PTRNTAB0 aptb0XLATB[] = /* XLATB */ {281 { 0xd7, _modax }282 };283 PTRNTAB0 aptb0CPUID[] = {284 { 0x0fa2, _I386 | _modall }285 };286 287 PTRNTAB0 aptb0RDMSR[] = {288 { 0x0f32, _I386 | _modaxdx }289 };290 291 PTRNTAB0 aptb0RDPMC[] = {292 { 0x0f33, _I386 | _modaxdx }293 };294 295 PTRNTAB0 aptb0RDTSC[] = {296 { 0x0f31, _I386 | _modaxdx }297 };298 299 PTRNTAB0 aptb0WRMSR[] = {300 { 0x0f30, _I386 }301 };302 303 PTRNTAB0 aptb0RSM[] = {304 { 0x0faa, _I386 }305 };306 118 // 307 119 // Now come the one operand instructions 308 120 // These will prove to be a little more challenging than the 0 309 121 // operand instructions 310 122 // 311 123 PTRNTAB1 aptb1BSWAP[] = /* BSWAP */ { 312 124 // Really is a 486 only instruction 313 125 { 0x0fc8, _I386, _plus_r | _r32 }, 314 126 { ASM_END, 0, 0 } 315 127 }; 316 128 317 129 PTRNTAB1 aptb1CALL[] = /* CALL */ { 318 130 { 0xe8, _cw | _modall , _rel16 }, 319 131 { 0xff, _2 | _16_bit | _modall, _r16 }, 320 132 { 0xff, _2 | _modall , _m16 }, 321 133 { 0x9a, _cd | _modall , _p1616 }, 322 134 { 0xff, _3 | _modall , _m1616 }, 323 135 { 0xe8, _cd | _modall , _rel32 }, 324 136 { 0xff, _2 | _32_bit | _modall , _r32 }, 137 { 0xff, _2 | _64_bit | _modall , _r64 }, 325 138 { 0xff, _2 | _modall , _m32 }, 139 { 0xff, _2 | _64_bit | _modall , _m64 }, 326 140 { 0x9a, _cp | _modall , _p1632 }, 327 141 { 0xff, _3 | _modall , _m1632 }, 328 142 { ASM_END, 0, 0 } 329 143 }; 330 144 331 145 PTRNTAB1 aptb1DEC[] = /* DEC */ { 332 146 { 0xfe, _1, _rm8 }, 333 147 { 0xff, _1 | _16_bit, _m16 }, // Also _r16 synonym 334 148 { 0xff, _1 | _32_bit, _m32 }, // Also _r32 synonym 149 { 0xff, _1 | _64_bit, _rm64 }, // Also _r64 synonym 335 150 { 0x48, _rw | _16_bit, _r16 | _plus_r }, 336 151 { 0x48, _rw | _32_bit, _r32 | _plus_r }, 337 152 { ASM_END, 0, 0 } 338 153 }; 339 154 340 155 PTRNTAB1 aptb1INC[] = /* INC */ { 341 156 { 0xfe, _0, _rm8 }, 342 157 { 0xff, _0 | _16_bit, _m16 }, // Also _r16 synonym 343 158 { 0xff, _0 | _32_bit, _m32 }, // Also _r32 synonym 159 { 0xff, _0 | _64_bit, _rm64 }, // Also _r64 synonym 344 160 { 0x40, _rw | _16_bit,_r16 | _plus_r }, 345 161 { 0x40, _rd | _32_bit,_r32 | _plus_r }, 346 162 { ASM_END, 0, 0 } 347 163 }; 348 164 // INT and INT 3 349 165 PTRNTAB1 aptb1INT[]= /* INT */ { 350 166 { 0xcc, 3, 0 }, // The ulFlags here are meant to 351 167 // be the value of the immediate 352 168 // operand 353 169 { 0xcd, 0, _imm8 }, 354 170 { ASM_END, 0, 0 } 355 171 }; 356 172 PTRNTAB1 aptb1INVLPG[] = /* INVLPG */ { // 486 only instruction 357 173 { 0x0f01, _I386|_7, _m8 | _m16 | _m32 | _m48 }, 358 174 { ASM_END, 0, 0 } 359 175 }; 360 176 361 PTRNTAB1 aptb1JB[] = /* JB */ { 362 { 0x72, _cb,_rel8 }, 363 { 0x0f82, _cw,_rel16 }, 364 { 0x0f82, _cd,_rel32 }, 365 { ASM_END, 0, 0 } 366 }; 367 PTRNTAB1 aptb1JBE[] = /* JBE */ { 368 { 0x76, _cb,_rel8 }, 369 { 0x0f86, _cw,_rel16 }, 370 { 0x0f86, _cd,_rel32 }, 371 { ASM_END, 0, 0 } 372 }; 177 #define OPTABLE(str,op) \ 178 PTRNTAB1 aptb1##str[] = { \ 179 { 0x70|op, _cb,_rel8 }, \ 180 { 0x0f80|op, _cw,_rel16 }, \ 181 { 0x0f80|op, _cd,_rel32 }, \ 182 { ASM_END, 0, 0 } \ 183 } 184 185 OPTABLE(JO,0); 186 OPTABLE(JNO,1); 187 OPTABLE(JB,2); 188 OPTABLE(JNB,3); 189 OPTABLE(JZ,4); 190 OPTABLE(JNZ,5); 191 OPTABLE(JBE,6); 192 OPTABLE(JNBE,7); 193 OPTABLE(JS,8); 194 OPTABLE(JNS,9); 195 OPTABLE(JP,0xA); 196 OPTABLE(JNP,0xB); 197 OPTABLE(JL,0xC); 198 OPTABLE(JNL,0xD); 199 OPTABLE(JLE,0xE); 200 OPTABLE(JNLE,0xF); 201 202 #undef OPTABLE 203 373 204 PTRNTAB1 aptb1JCXZ[] = /* JCXZ */ { 374 205 { 0xe3, _cb | _16_bit_addr,_rel8 }, 375 206 { ASM_END, 0, 0 } 376 207 }; 377 208 PTRNTAB1 aptb1JECXZ[] = /* JECXZ */ { 378 209 { 0xe3, _cb | _32_bit_addr | _I386,_rel8 }, 379 { ASM_END, 0, 0 }380 };381 PTRNTAB1 aptb1JZ[] = /* JZ */ {382 { 0x74, _cb,_rel8 },383 { 0x0f84, _cw,_rel16 },384 { 0x0f84, _cd,_rel32 },385 { ASM_END, 0, 0 }386 };387 PTRNTAB1 aptb1JL[] = /* JL */ {388 { 0x7c, _cb,_rel8 },389 { 0x0f8c, _cw,_rel16 },390 { 0x0f8c, _cd,_rel32 },391 { ASM_END, 0, 0 }392 };393 PTRNTAB1 aptb1JLE[] = /* JLE */ {394 { 0x7e, _cb,_rel8 },395 { 0x0f8e, _cw,_rel16 },396 { 0x0f8e, _cd,_rel32 },397 { ASM_END, 0, 0 }398 };399 PTRNTAB1 aptb1JNB[] = /* JNB */ {400 { 0x73, _cb,_rel8 },401 { 0x0f83, _cw,_rel16 },402 { 0x0f83, _cd,_rel32 },403 { ASM_END, 0, 0 }404 };405 PTRNTAB1 aptb1JNBE[] = /* JNBE */ {406 { 0x77, _cb,_rel8 },407 { 0x0f87, _cw,_rel16 },408 { 0x0f87, _cd,_rel32 },409 { ASM_END, 0, 0 }410 };411 PTRNTAB1 aptb1JNL[] = /* JNL */ {412 { 0x7d, _cb,_rel8 },413 { 0x0f8d, _cw,_rel16 },414 { 0x0f8d, _cd,_rel32 },415 { ASM_END, 0, 0 }416 };417 PTRNTAB1 aptb1JNLE[] = /* JNLE */ {418 { 0x7f, _cb,_rel8 },419 { 0x0f8f, _cw,_rel16 },420 { 0x0f8f, _cd,_rel32 },421 { ASM_END, 0, 0 }422 };423 PTRNTAB1 aptb1JNO[] = /* JNO */ {424 { 0x71, _cb,_rel8 },425 { 0x0f81, _cw,_rel16 },426 { 0x0f81, _cd,_rel32 },427 { ASM_END, 0, 0 }428 };429 PTRNTAB1 aptb1JNP[] = /* JNP */ {430 { 0x7b, _cb,_rel8 },431 { 0x0f8b, _cw,_rel16 },432 { 0x0f8b, _cd,_rel32 },433 { ASM_END, 0, 0 }434 };435 PTRNTAB1 aptb1JNS[] = /* JNS */ {436 { 0x79, _cb,_rel8 },437 { 0x0f89, _cw,_rel16 },438 { 0x0f89, _cd,_rel32 },439 { ASM_END, 0, 0 }440 };441 PTRNTAB1 aptb1JNZ[] = /* JNZ */ {442 { 0x75, _cb,_rel8 },443 { 0x0f85, _cw,_rel16 },444 { 0x0f85, _cd,_rel32 },445 { ASM_END, 0, 0 }446 };447 PTRNTAB1 aptb1JO[] = /* JO */ {448 { 0x70, _cb,_rel8 },449 { 0x0f80, _cw,_rel16 },450 { 0x0f80, _cd,_rel32 },451 { ASM_END, 0, 0 }452 };453 PTRNTAB1 aptb1JP[] = /* JP */ {454 { 0x7a, _cb,_rel8 },455 { 0x0f8a, _cw,_rel16 },456 { 0x0f8a, _cd,_rel32 },457 { ASM_END, 0, 0 }458 };459 PTRNTAB1 aptb1JS[] = /* JS */ {460 { 0x78, _cb,_rel8 },461 { 0x0f88, _cw,_rel16 },462 { 0x0f88, _cd,_rel32 },463 210 { ASM_END, 0, 0 } 464 211 }; 465 212 PTRNTAB1 aptb1JMP[] = /* JMP */ { 466 213 { 0xe9, _cw,_rel16 }, 467 214 { 0xe9, _cd,_rel32 }, 468 215 { 0xeb, _cb,_rel8 }, 469 216 { 0xff, _4 | _16_bit, _rm16 }, 470 217 { 0xea, _cd,_p1616 }, 471 218 { 0xff, _5, _m1616 }, 472 219 { 0xff, _4 | _32_bit, _rm32 }, 473 220 { 0xea, _cp,_p1632 }, 474 221 { 0xff, _5, _m1632 }, 475 222 { ASM_END, 0, 0 } 476 223 }; 477 224 PTRNTAB1 aptb1LGDT[] = /* LGDT */ { 478 225 { 0x0f01, _2, _m48 }, 479 226 { ASM_END, 0, 0 } 480 227 }; 481 228 PTRNTAB1 aptb1LIDT[] = /* LIDT */ { 482 229 { 0x0f01, _3, _m48 }, 483 230 { ASM_END, 0, 0 } 484 231 }; 485 232 PTRNTAB1 aptb1LLDT[] = /* LLDT */ { 486 233 { 0x0f00, _2|_modnot1, _rm16 }, 487 234 { ASM_END, 0, 0 } 488 235 }; 489 236 PTRNTAB1 aptb1LMSW[] = /* LMSW */ { 490 237 { 0x0f01, _6|_modnot1, _rm16 }, 491 238 { ASM_END, 0, 0 } 492 239 }; 493 240 PTRNTAB1 aptb1LODS[] = /* LODS */ { 494 241 { 0xac, _modax,_m8 }, 495 242 { 0xad, _16_bit | _modax,_m16 }, 496 243 { 0xad, _32_bit | _I386 | _modax,_m32 }, 497 244 { ASM_END, 0, 0 } 498 245 }; 499 246 PTRNTAB1 aptb1LOOP[] = /* LOOP */ { 500 247 { 0xe2, _cb | _modcx,_rel8 }, 501 248 { ASM_END, 0, 0 } 502 249 }; 503 PTRNTAB1 aptb1LOOPE[] = /* LOOPE */ {250 PTRNTAB1 aptb1LOOPE[] = /* LOOPE/LOOPZ */ { 504 251 { 0xe1, _cb | _modcx,_rel8 }, 505 252 { ASM_END, 0, 0 } 506 253 }; 507 PTRNTAB1 aptb1LOOPZ[] = /* LOOPZ */ { 508 { 0xe1, _cb | _modcx,_rel8 }, 509 { ASM_END, 0, 0 } 510 }; 511 PTRNTAB1 aptb1LOOPNE[] = /* LOOPNE */ { 512 { 0xe0, _cb | _modcx,_rel8 }, 513 { ASM_END, 0, 0 } 514 }; 515 PTRNTAB1 aptb1LOOPNZ[] = /* LOOPNZ */ { 254 PTRNTAB1 aptb1LOOPNE[] = /* LOOPNE/LOOPNZ */ { 516 255 { 0xe0, _cb | _modcx,_rel8 }, 517 256 { ASM_END, 0, 0 } 518 257 }; 519 258 PTRNTAB1 aptb1LTR[] = /* LTR */ { 520 259 { 0x0f00, _3|_modnot1, _rm16 }, 521 260 { ASM_END, 0, 0 } 522 261 }; 523 262 PTRNTAB1 aptb1NEG[] = /* NEG */ { 524 263 { 0xf6, _3, _rm8 }, 525 264 { 0xf7, _3 | _16_bit, _rm16 }, 526 265 { 0xf7, _3 | _32_bit, _rm32 }, 527 266 { 0xf7, _3 | _64_bit, _rm64 }, 528 267 { ASM_END, 0, 0 } 529 268 }; 530 269 PTRNTAB1 aptb1NOT[] = /* NOT */ { 531 270 { 0xf6, _2, _rm8 }, 532 271 { 0xf7, _2 | _16_bit, _rm16 }, 533 272 { 0xf7, _2 | _32_bit, _rm32 }, 273 { 0xf7, _2 | _64_bit, _rm64 }, 534 274 { ASM_END, 0, 0 } 535 275 }; 536 276 PTRNTAB1 aptb1POP[] = /* POP */ { 537 277 { 0x8f, _0 | _16_bit, _m16 }, 538 278 { 0x8f, _0 | _32_bit, _m32}, 539 279 { 0x58, _rw | _16_bit, _r16 | _plus_r }, 540 280 { 0x58, _rd | _32_bit, _r32 | _plus_r }, 541 281 { 0x58, _r | _64_bit, _r64 | _plus_r }, 542 282 { 0x1f, 0, _ds | _seg }, 543 283 { 0x07, _modes, _es | _seg}, 544 284 { 0x17, 0, _ss | _seg}, 545 285 { 0x0fa1, 0, _fs | _seg}, 546 286 { 0x0fa9, 0, _gs | _seg}, 547 287 { ASM_END, 0, 0 } 548 288 }; 549 289 PTRNTAB1 aptb1PUSH[] = /* PUSH */ { 550 290 { 0xff, _6 | _16_bit, _m16 }, 551 291 { 0xff, _6 | _32_bit, _m32 }, 552 292 { 0xff, _6 | _64_bit, _m64 }, 553 293 { 0x50, _r | _16_bit, _r16 | _plus_r }, … … 566 306 { 0x0fa8, 0,_gs | _seg}, 567 307 { ASM_END, 0, 0 } 568 308 }; 569 309 PTRNTAB1 aptb1RET[] = /* RET */ { 570 310 { 0xc3, 0, 0 }, 571 311 { 0xc2, _iw, _imm16 }, 572 312 { ASM_END, 0, 0 } 573 313 }; 574 314 PTRNTAB1 aptb1RETF[] = /* RETF */ { 575 315 { 0xcb, 0, 0 }, 576 316 { 0xca, _iw, _imm16 }, 577 317 { ASM_END, 0, 0 } 578 318 }; 579 319 PTRNTAB1 aptb1SCAS[] = /* SCAS */ { 580 320 { 0xae, _moddi, _m8 }, 581 321 { 0xaf, _16_bit | _moddi, _m16 }, 582 322 { 0xaf, _32_bit | _moddi, _m32 }, 583 323 { ASM_END, 0, 0 } 584 324 }; 585 325 586 PTRNTAB1 aptb1SETB[] = /* SETB */ { 587 { 0xf92, _cb, _rm8 }, 588 { ASM_END, 0, 0 } 589 }; 590 PTRNTAB1 aptb1SETBE[] = /* SETBE */ { 591 { 0xf96, _cb, _rm8 }, 592 { ASM_END, 0, 0 } 593 }; 594 PTRNTAB1 aptb1SETL[] = /* SETL */ { 595 { 0xf9c, _cb, _rm8 }, 596 { ASM_END, 0, 0 } 597 }; 598 PTRNTAB1 aptb1SETLE[] = /* SETLE */ { 599 { 0xf9e, _cb, _rm8 }, 600 { ASM_END, 0, 0 } 601 }; 602 PTRNTAB1 aptb1SETNB[] = /* SETNB */ { 603 { 0xf93, _cb, _rm8 }, 604 { ASM_END, 0, 0 } 605 }; 606 PTRNTAB1 aptb1SETNBE[] = /* SETNBE */ { 607 { 0xf97, _cb, _rm8 }, 608 { ASM_END, 0, 0 } 609 }; 610 PTRNTAB1 aptb1SETNL[] = /* SETNL */ { 611 { 0xf9d, _cb, _rm8 }, 612 { ASM_END, 0, 0 } 613 }; 614 PTRNTAB1 aptb1SETNLE[] = /* SETNLE */ { 615 { 0xf9f, _cb, _rm8 }, 616 { ASM_END, 0, 0 } 617 }; 618 PTRNTAB1 aptb1SETNO[] = /* SETNO */ { 619 { 0xf91, _cb, _rm8 }, 620 { ASM_END, 0, 0 } 621 }; 622 PTRNTAB1 aptb1SETNP[] = /* SETNP */ { 623 { 0xf9b, _cb, _rm8 }, 624 { ASM_END, 0, 0 } 625 }; 626 PTRNTAB1 aptb1SETNS[] = /* SETNS */ { 627 { 0xf99, _cb, _rm8 }, 628 { ASM_END, 0, 0 } 629 }; 630 PTRNTAB1 aptb1SETNZ[] = /* SETNZ */ { 631 { 0xf95, _cb, _rm8 }, 632 { ASM_END, 0, 0 } 633 }; 634 PTRNTAB1 aptb1SETO[] = /* SETO */ { 635 { 0xf90, _cb, _rm8 }, 636 { ASM_END, 0, 0 } 637 }; 638 PTRNTAB1 aptb1SETP[] = /* SETP */ { 639 { 0xf9a, _cb, _rm8 }, 640 { ASM_END, 0, 0 } 641 }; 642 PTRNTAB1 aptb1SETS[] = /* SETS */ { 643 { 0xf98, _cb, _rm8 }, 644 { ASM_END, 0, 0 } 645 }; 646 PTRNTAB1 aptb1SETZ[] = /* SETZ */ { 647 { 0xf94, _cb, _rm8 }, 648 { ASM_END, 0, 0 } 649 }; 326 #define OPTABLE(str,op) \ 327 PTRNTAB1 aptb1##str[] = { \ 328 { 0xf90|op, _cb, _rm8 }, \ 329 { ASM_END, 0, 0 } \ 330 } 331 332 OPTABLE(SETO,0); 333 OPTABLE(SETNO,1); 334 OPTABLE(SETB,2); 335 OPTABLE(SETNB,3); 336 OPTABLE(SETZ,4); 337 OPTABLE(SETNZ,5); 338 OPTABLE(SETBE,6); 339 OPTABLE(SETNBE,7); 340 OPTABLE(SETS,8); 341 OPTABLE(SETNS,9); 342 OPTABLE(SETP,0xA); 343 OPTABLE(SETNP,0xB); 344 OPTABLE(SETL,0xC); 345 OPTABLE(SETNL,0xD); 346 OPTABLE(SETLE,0xE); 347 OPTABLE(SETNLE,0xF); 348 349 #undef OPTABLE 350 650 351 PTRNTAB1 aptb1SGDT[]= /* SGDT */ { 651 352 { 0xf01, _0, _m48 }, 652 353 { ASM_END, 0, 0 } 653 354 }; 654 355 PTRNTAB1 aptb1SIDT[] = /* SIDT */ { 655 356 { 0xf01, _1, _m48 }, 656 357 { ASM_END, 0, 0 } 657 358 }; 658 359 PTRNTAB1 aptb1SLDT[] = /* SLDT */ { 659 360 { 0xf00, _0, _rm16 }, 660 361 { ASM_END, 0, 0 } 661 362 }; 662 363 PTRNTAB1 aptb1SMSW[] = /* SMSW */ { 663 364 { 0xf01, _4, _rm16 }, 664 365 { 0xf01, _4, _r32 }, 665 366 { ASM_END, 0, 0 } 666 367 }; 667 368 PTRNTAB1 aptb1STOS[] = /* STOS */ { 668 369 { 0xaa, _moddi, _m8 }, 669 370 { 0xab, _16_bit | _moddi, _m16 }, … … 674 375 { 0xf00, _1, _rm16 }, 675 376 { ASM_END, 0, 0 } 676 377 }; 677 378 PTRNTAB1 aptb1VERR[] = /* VERR */ { 678 379 { 0xf00, _4|_modnot1, _rm16 }, 679 380 { ASM_END, 0, 0 } 680 381 }; 681 382 PTRNTAB1 aptb1VERW[] = /* VERW */ { 682 383 { 0xf00, _5|_modnot1, _rm16 }, 683 384 { ASM_END, 0, 0 } 684 385 }; 685 386 PTRNTAB1 aptb1XLAT[] = /* XLAT */ { 686 387 { 0xd7, _modax, 0 }, 687 388 { 0xd7, _modax, _m8 }, 688 389 { ASM_END, 0, 0 } 689 390 }; 690 391 PTRNTAB1 aptb1CMPXCH8B[] = { 691 392 { 0x0fc7, _1 | _modaxdx | _I386 , _m64 }, 692 393 { ASM_END, 0, 0 } 693 394 }; 694 PTRNTAB2 aptb2ADC[] = /* ADC */ { 695 { 0x14, _ib, _al, _imm8 }, 696 { 0x83, _2|_ib|_16_bit, _rm16, _imm8 }, 697 { 0x15, _iw|_16_bit, _ax, _imm16 }, 698 { 0x83, _2|_ib|_32_bit, _rm32, _imm8 }, 699 { 0x15, _id|_32_bit, _eax, _imm32 }, 700 { 0x80, _2|_ib, _rm8, _imm8 }, 701 { 0x81, _2|_iw|_16_bit, _rm16, _imm16 }, 702 { 0x81, _2|_id|_32_bit, _rm32, _imm32 }, 703 { 0x10, _r, _rm8, _r8 }, 704 { 0x11, _r|_16_bit, _rm16, _r16 }, 705 { 0x11, _r|_32_bit, _rm32, _r32 }, 706 { 0x12, _r, _r8, _rm8 }, 707 { 0x13, _r|_16_bit, _r16, _rm16 }, 708 { 0x13, _r|_32_bit, _r32, _rm32 }, 709 { ASM_END, 0, 0, 0 } 710 }; 711 PTRNTAB2 aptb2ADD[] = /* ADD */ { 712 { 0x04, _ib, _al, _imm8 }, 713 { 0x83, _0|_ib|_16_bit, _rm16, _imm8 }, 714 { 0x05, _iw | _16_bit, _ax, _imm16 }, 715 { 0x83, _0|_ib|_32_bit, _rm32, _imm8 }, 716 { 0x05, _id | _32_bit, _eax, _imm32 }, 717 { 0x80, _0|_ib, _rm8, _imm8 }, 718 { 0x81, _0|_iw|_16_bit, _rm16, _imm16 }, 719 { 0x81, _0|_id|_32_bit, _rm32, _imm32 }, 720 { 0x00, _r, _rm8, _r8 }, 721 { 0x01, _r|_16_bit, _rm16, _r16 }, 722 { 0x01, _r|_32_bit, _rm32, _r32 }, 723 { 0x2, _r, _r8, _rm8 }, 724 { 0x3, _r|_16_bit, _r16, _rm16 }, 725 { 0x3, _r|_32_bit, _r32, _rm32 }, 726 { ASM_END, 0, 0, 0 } 727 }; 728 729 PTRNTAB2 aptb2AND[] = /* AND */ { 730 { 0x24, _ib, _al, _imm8 }, 731 { 0x83, _4|_ib|_16_bit, _rm16, _imm8 }, 732 { 0x25, _iw|_16_bit, _ax, _imm16 }, 733 { 0x83, _4|_ib|_32_bit, _rm32, _imm8 }, 734 { 0x25, _id|_32_bit, _eax, _imm32 }, 735 { 0x80, _4|_ib, _rm8, _imm8 }, 736 { 0x81, _4|_iw|_16_bit, _rm16, _imm16 }, 737 { 0x81, _4|_id|_32_bit, _rm32, _imm32 }, 738 { 0x20, _r, _rm8, _r8 }, 739 { 0x21, _r|_16_bit, _rm16, _r16 }, 740 { 0x21, _r|_32_bit, _rm32, _r32 }, 741 { 0x22, _r, _r8, _rm8 }, 742 { 0x23, _r|_16_bit, _r16, _rm16 }, 743 { 0x23, _r|_32_bit, _r32, _rm32 }, 744 { ASM_END, 0, 0, 0 } 745 }; 395 396 #define OPTABLE(str,op,rr,m) \ 397 PTRNTAB2 aptb2##str[] = { \ 398 { op+4, _ib|m, _al, _imm8 }, \ 399 { 0x83, rr|_ib|_16_bit|m, _rm16, _imm8 }, \ 400 { op+5, _iw|_16_bit|m, _ax, _imm16 }, \ 401 { 0x83, rr|_ib|_32_bit|m, _rm32, _imm8 }, \ 402 { 0x83, rr|_ib|_64_bit|m, _rm64, _imm8 }, \ 403 { op+5, _id|_32_bit|m, _eax, _imm32 }, \ 404 { op+5, _id|_64_bit|m, _rax, _imm32 }, \ 405 { 0x80, rr|_ib|m, _rm8, _imm8 }, \ 406 { 0x81, rr|_iw|_16_bit|m, _rm16, _imm16 }, \ 407 { 0x81, rr|_id|_32_bit|m, _rm32, _imm32 }, \ 408 { 0x81, rr|_id|_64_bit|m, _rm64, _imm32 }, \ 409 { op+0, _r|m, _rm8, _r8 }, \ 410 { op+1, _r|_16_bit|m, _rm16, _r16 }, \ 411 { op+1, _r|_32_bit|m, _rm32, _r32 }, \ 412 { op+1, _r|_64_bit|m, _rm64, _r64 }, \ 413 { op+2, _r|m, _r8, _rm8 }, \ 414 { op+3, _r|_16_bit|m, _r16, _rm16 }, \ 415 { op+3, _r|_32_bit|m, _r32, _rm32 }, \ 416 { op+3, _r|_64_bit|m, _r64, _rm64 }, \ 417 { ASM_END, 0, 0, 0 } \ 418 } 419 420 OPTABLE(ADD,0x00,_0,0); 421 OPTABLE(OR, 0x08,_1,0); 422 OPTABLE(ADC,0x10,_2,0); 423 OPTABLE(SBB,0x18,_3,0); 424 OPTABLE(AND,0x20,_4,0); 425 OPTABLE(SUB,0x28,_5,0); 426 OPTABLE(XOR,0x30,_6,0); 427 OPTABLE(CMP,0x38,_7,_modnot1); 428 429 #undef OPTABLE 430 746 431 PTRNTAB2 aptb2ARPL[] = /* ARPL */ { 747 432 { 0x63, _r, _rm16, _r16 }, 748 433 { ASM_END, 0, 0, 0 } 749 434 }; 750 435 PTRNTAB2 aptb2BOUND[] = /* BOUND */ { 751 436 { 0x62, _r|_16_bit|_modnot1,_r16,_m16 },// Should really b3 _m16_16 752 437 { 0x62, _r|_32_bit|_modnot1,_r32,_m32 },// Should really be _m32_32 753 438 { ASM_END, 0, 0, 0 } 754 439 }; 755 440 PTRNTAB2 aptb2BSF[] = /* BSF */ { 756 441 { 0x0fbc, _cw | _16_bit, _r16, _rm16 }, 757 442 { 0x0fbc, _cd|_32_bit, _r32, _rm32 }, 443 { 0x0fbc, _cd|_64_bit, _r64, _rm64 }, 758 444 { ASM_END, 0, 0, 0 } 759 445 }; 760 446 PTRNTAB2 aptb2BSR[] = /* BSR */ { 761 447 { 0x0fbd, _cw|_16_bit, _r16, _rm16 }, 762 448 { 0x0fbd, _cd|_32_bit, _r32, _rm32 }, 449 { 0x0fbd, _cd|_64_bit, _r64, _rm64 }, 763 450 { ASM_END, 0, 0, 0 } 764 451 }; 765 452 PTRNTAB2 aptb2BT[] = /* BT */ { 766 453 { 0x0fa3, _cw|_16_bit|_modnot1, _rm16, _r16 }, 767 454 { 0x0fa3, _cd|_32_bit|_modnot1, _rm32, _r32 }, 455 { 0x0fa3, _cd|_64_bit|_modnot1, _rm64, _r64 }, 768 456 { 0x0fba, _4|_ib|_16_bit|_modnot1, _rm16, _imm8 }, 769 457 { 0x0fba, _4|_ib|_32_bit|_modnot1, _rm32, _imm8 }, 458 { 0x0fba, _4|_ib|_64_bit|_modnot1, _rm64, _imm8 }, 770 459 { ASM_END, 0, 0, 0 } 771 460 }; 772 461 PTRNTAB2 aptb2BTC[] = /* BTC */ { 773 462 { 0x0fbb, _cw|_16_bit, _rm16, _r16 }, 774 463 { 0x0fbb, _cd|_32_bit, _rm32, _r32 }, 464 { 0x0fbb, _cd|_64_bit, _rm64, _r64 }, 775 465 { 0x0fba, _7|_ib|_16_bit, _rm16, _imm8 }, 776 466 { 0x0fba, _7|_ib|_32_bit, _rm32, _imm8 }, 467 { 0x0fba, _7|_ib|_64_bit, _rm64, _imm8 }, 777 468 { ASM_END, 0, 0, 0 } 778 469 }; 779 470 PTRNTAB2 aptb2BTR[] = /* BTR */ { 780 471 { 0x0fb3, _cw|_16_bit, _rm16, _r16 }, 781 472 { 0x0fb3, _cd|_32_bit, _rm32, _r32 }, 473 { 0x0fb3, _cd|_64_bit, _rm64, _r64 }, 782 474 { 0x0fba, _6|_ib|_16_bit, _rm16, _imm8 }, 783 475 { 0x0fba, _6|_ib|_32_bit, _rm32, _imm8 }, 476 { 0x0fba, _6|_ib|_64_bit, _rm64, _imm8 }, 784 477 { ASM_END, 0, 0, 0 } 785 478 }; 786 479 PTRNTAB2 aptb2BTS[] = /* BTS */ { 787 480 { 0x0fab, _cw|_16_bit, _rm16, _r16 }, 788 481 { 0x0fab, _cd|_32_bit, _rm32, _r32 }, 482 { 0x0fab, _cd|_64_bit, _rm64, _r64 }, 789 483 { 0x0fba, _5|_ib|_16_bit, _rm16, _imm8 }, 790 484 { 0x0fba, _5|_ib|_32_bit, _rm32, _imm8 }, 791 { ASM_END, 0, 0, 0 } 792 }; 793 PTRNTAB2 aptb2CMP[] = /* CMP */ { 794 { 0x3c, _ib|_modnot1, _al, _imm8 }, 795 { 0x83, _7|_ib|_16_bit|_modnot1, _rm16, _imm8 }, 796 { 0x3d, _iw|_16_bit|_modnot1, _ax, _imm16 }, 797 { 0x83, _7|_ib|_32_bit|_modnot1, _rm32, _imm8 }, 798 { 0x3d, _id|_32_bit|_modnot1, _eax, _imm32 }, 799 { 0x80, _7|_ib|_modnot1, _rm8, _imm8 }, 800 { 0x81, _7|_iw|_16_bit|_modnot1, _rm16, _imm16 }, 801 { 0x81, _7|_id|_32_bit|_modnot1, _rm32, _imm32 }, 802 { 0x38, _r|_modnot1, _rm8, _r8 }, 803 { 0x39, _r|_16_bit|_modnot1, _rm16, _r16 }, 804 { 0x39, _r|_32_bit|_modnot1, _rm32, _r32 }, 805 { 0x3a, _r|_modnot1, _r8, _rm8 }, 806 { 0x3b, _r|_16_bit|_modnot1, _r16, _rm16 }, 807 { 0x3b, _r|_32_bit|_modnot1, _r32, _rm32 }, 485 { 0x0fba, _5|_ib|_64_bit, _rm64, _imm8 }, 808 486 { ASM_END, 0, 0, 0 } 809 487 }; 810 488 PTRNTAB2 aptb2CMPS[] = /* CMPS */ { 811 489 { 0xa6, _modsidi, _m8, _m8 }, 812 490 { 0xa7, _modsidi, _m16, _m16 }, 813 491 { 0xa7, _modsidi, _m32, _m32 }, 814 492 { ASM_END, 0, 0, 0 } 815 493 }; 816 494 PTRNTAB2 aptb2CMPXCHG[] = /* CMPXCHG */ { 817 495 { 0xfb0, _I386 | _cb|_mod2, _rm8, _r8 }, 818 496 // This is really a 486 only 819 497 // instruction 820 498 { 0xfb1, _I386 | _cw | _16_bit|_mod2, _rm16, _r16 }, 821 499 { 0xfb1, _I386 | _cd | _32_bit|_mod2, _rm32, _r32 }, 822 500 { 0xfb1, _I386 | _cq | _64_bit|_mod2, _rm64, _r64 }, 823 501 { ASM_END, 0, 0, 0 } 824 502 }; 825 503 PTRNTAB2 aptb2DIV[] = /* DIV */ { 826 504 { 0xf6, _6, _al, _rm8 }, 827 505 { 0xf7, _6 | _16_bit | _moddx, _ax, _rm16 }, … … 913 591 { 0xa0, 0, _al, _moffs8 }, 914 592 { 0xa1, _16_bit, _ax, _moffs16 }, 915 593 { 0xa1, _32_bit, _eax, _moffs32 }, 916 594 { 0xa2, 0, _moffs8, _al }, 917 595 { 0xa3, _16_bit, _moffs16, _ax }, 918 596 { 0xa3, _32_bit, _moffs32, _eax }, 919 597 #endif 920 598 { 0x88, _r, _rm8, _r8 }, 921 599 { 0x89, _r|_16_bit, _rm16, _r16 }, 922 600 { 0x89, _r|_32_bit, _rm32, _r32 }, 923 601 { 0x89, _r|_64_bit, _rm64, _r64 }, 924 602 { 0x8a, _r, _r8, _rm8 }, 925 603 { 0x8b, _r|_16_bit, _r16, _rm16 }, 926 604 { 0x8b, _r|_32_bit, _r32, _rm32 }, 927 605 { 0x8b, _r|_64_bit, _r64, _rm64 }, 928 606 { 0x8c, _r, _rm16, _seg|_ds|_es| _ss | _fs | _gs | _cs }, 929 607 { 0x8e, _r, _seg|_ds|_es|_ss|_fs|_gs|_cs, _rm16 }, 930 608 { 0xb0, _rb, _r8 | _plus_r, _imm8 }, 931 609 { 0xb8, _rw | _16_bit, _r16 | _plus_r, _imm16 }, 932 610 { 0xb8, _rd|_32_bit, _r32 | _plus_r, _imm32 }, 611 { 0xb8, _rd|_64_bit, _r64 | _plus_r, _imm32 }, 933 612 { 0xc6, _cb, _rm8, _imm8 }, 934 613 { 0xc7, _cw|_16_bit, _rm16, _imm16 }, 935 614 { 0xc7, _cd|_32_bit, _rm32, _imm32 }, 936 615 #if 0 // Let pinholeopt() do this 937 616 { 0xc6, _cb, _moffs8, _imm8 }, 938 617 { 0xc7, _cw|_16_bit, _moffs16, _imm16 }, 939 618 { 0xc7, _cd|_32_bit, _moffs32, _imm32 }, 940 619 #endif 941 620 { 0x0f20, _r, _r32, _special | _crn }, 942 621 { 0x0f22, _r, _special|_crn, _r32 }, 943 622 { 0x0f21, _r, _r32, _special | _drn }, 944 623 { 0x0f23, _r, _special|_drn, _r32 }, 945 624 { 0x0f24, _r, _r32, _special | _trn }, 946 625 { 0x0f26, _r, _special|_trn, _r32 }, 947 626 { ASM_END, 0, 0, 0 } 948 627 }; 949 628 950 629 PTRNTAB2 aptb2MOVS[] = { 951 630 { 0xa4, _modsidi , _m8, _m8 }, 952 631 { 0xa5, _modsidi | _16_bit, _m16, _m16 }, … … 969 648 { 0x0fb6, _r|_32_bit, _r32, _rm8 }, 970 649 #if 1 971 650 { 0x0fb7, _r|_16_bit, _r16, _rm16 }, 972 651 { 0x0fb7, _r|_32_bit, _r32, _rm16 }, 973 652 #else 974 653 { 0x0fb7, _r, _r32, _rm16 }, 975 654 #endif 976 655 { ASM_END, 0, 0, 0 } 977 656 }; 978 657 PTRNTAB2 aptb2MUL[] = /* MUL */ { 979 658 { 0xf6, _4, _al, _rm8 }, 980 659 { 0xf7, _4|_16_bit|_moddx, _ax, _rm16 }, 981 660 { 0xf7, _4|_32_bit|_moddx, _eax, _rm32 }, 982 661 { 0xf7, _4|_64_bit|_moddx, _rax, _rm64 }, 983 662 { 0xf6, _4|_modax, _rm8, 0 }, 984 663 { 0xf7, _4|_16_bit|_modaxdx, _rm16, 0 }, 985 664 { 0xf7, _4|_32_bit|_modaxdx, _rm32, 0 }, 986 665 { 0xf7, _4|_64_bit|_modaxdx, _rm64, 0 }, 987 666 { ASM_END, 0, 0, 0 } 988 667 }; 989 PTRNTAB2 aptb2OR[] = /* OR */ {990 { 0x0c, _ib, _al, _imm8 },991 { 0x83, _1|_ib|_16_bit, _rm16, _imm8 },992 { 0x0d, _iw|_16_bit, _ax, _imm16 },993 { 0x83, _1|_ib|_32_bit, _rm32, _imm8 },994 { 0x0d, _id|_32_bit, _eax, _imm32 },995 { 0x80, _1|_ib, _rm8, _imm8 },996 { 0x81, _1|_iw|_16_bit, _rm16, _imm16 },997 { 0x81, _1|_id|_32_bit, _rm32, _imm32 },998 { 0x08, _r, _rm8, _r8 },999 { 0x09, _r|_16_bit, _rm16, _r16 },1000 { 0x09, _r|_32_bit, _rm32, _r32 },1001 { 0x0a, _r, _r8, _rm8 },1002 { 0x0b, _r|_16_bit, _r16, _rm16 },1003 { 0x0b, _r|_32_bit, _r32, _rm32 },1004 { ASM_END, 0, 0, 0 }1005 };1006 668 PTRNTAB2 aptb2OUT[] = { 1007 669 { 0xe6, _ib, _imm8, _al }, 1008 670 { 0xe7, _ib|_16_bit, _imm8, _ax }, 1009 671 { 0xe7, _ib|_32_bit, _imm8, _eax }, 1010 672 { 0xee, _modnot1, _dx, _al }, 1011 673 { 0xef, _16_bit|_modnot1, _dx, _ax }, 1012 674 { 0xef, _32_bit|_modnot1, _dx, _eax }, 1013 675 { ASM_END, 0, 0, 0 } 1014 676 }; 1015 677 PTRNTAB2 aptb2OUTS[] = /* OUTS */ { 1016 678 { 0x6e, _modsinot1, _dx, _rm8 }, 1017 679 { 0x6f, _16_bit | _I386 |_modsinot1, _dx, _rm16 }, 1018 680 { 0x6f, _32_bit | _I386| _modsinot1, _dx, _rm32 }, 1019 681 { ASM_END, 0, 0, 0 } 1020 682 }; 1021 PTRNTAB2 aptb2RCL[] = /* RCL */{ 1022 // { 0xd0, _2, _rm8, 0 }, 1023 { 0xd2, _2, _rm8, _cl }, 1024 { 0xc0, _2|_ib, _rm8, _imm8 }, 1025 // { 0xd1, _2|_16_bit, _rm16, 0 }, 1026 { 0xd3, _2|_16_bit, _rm16, _cl }, 1027 { 0xc1, _2|_ib|_16_bit, _rm16, _imm8 }, 1028 // { 0xd1, _2|_32_bit, _rm32, 0 }, 1029 { 0xd3, _2|_32_bit, _rm32, _cl }, 1030 { 0xc1, _2|_ib|_32_bit, _rm32, _imm8, }, 1031 { ASM_END, 0, 0, 0 } 1032 }; 1033 PTRNTAB2 aptb2RCR[] = /* RCR */ { 1034 // { 0xd0, _3, _rm8, 0 }, 1035 { 0xd2, _3, _rm8, _cl }, 1036 { 0xc0, _3|_ib, _rm8, _imm8 }, 1037 // { 0xd1, _3|_16_bit, _rm16, 0 }, 1038 { 0xd3, _3|_16_bit, _rm16, _cl }, 1039 { 0xc1, _3|_ib|_16_bit, _rm16, _imm8 }, 1040 // { 0xd1, _3|_32_bit, _rm32, 0 }, 1041 { 0xd3, _3|_32_bit, _rm32, _cl }, 1042 { 0xc1, _3|_ib|_32_bit, _rm32, _imm8 }, 1043 { ASM_END, 0, 0, 0 } 1044 }; 1045 PTRNTAB2 aptb2ROL[] = /* ROL */ { 1046 // { 0xd0, _0, _rm8, 0 }, 1047 { 0xd2, _0, _rm8, _cl }, 1048 { 0xc0, _0, _rm8, _imm8 }, 1049 // { 0xd1, _0|_16_bit, _rm16, 0 }, 1050 { 0xd3, _0|_16_bit, _rm16, _cl }, 1051 { 0xc1, _0|_16_bit, _rm16, _imm8 }, 1052 // { 0xd1, _0|_32_bit, _rm32, 0 }, 1053 { 0xd3, _0|_32_bit, _rm32, _cl }, 1054 { 0xc1, _0|_32_bit, _rm32, _imm8 }, 1055 { ASM_END, 0, 0, 0 } 1056 }; 1057 PTRNTAB2 aptb2ROR[] = /* ROR */ { 1058 // { 0xd0, _1, _rm8, 0 }, 1059 { 0xd2, _1, _rm8, _cl }, 1060 { 0xc0, _1, _rm8, _imm8 }, 1061 // { 0xd1, _1|_16_bit, _rm16, 0 }, 1062 { 0xd3, _1|_16_bit, _rm16, _cl }, 1063 { 0xc1, _1|_16_bit, _rm16, _imm8 }, 1064 // { 0xd1, _1|_32_bit, _rm32, 0 }, 1065 { 0xd3, _1|_32_bit, _rm32, _cl }, 1066 { 0xc1, _1|_32_bit, _rm32, _imm8 }, 1067 { ASM_END, 0, 0, 0 } 1068 }; 1069 PTRNTAB2 aptb2SAL[] = /* SAL */ { 1070 // { 0xd0, _4, _rm8, 0 }, 1071 { 0xd2, _4, _rm8, _cl }, 1072 { 0xc0, _4, _rm8, _imm8 }, 1073 // { 0xd1, _4|_16_bit, _rm16, 0 }, 1074 { 0xd3, _4|_16_bit, _rm16, _cl }, 1075 { 0xc1, _4|_16_bit, _rm16, _imm8 }, 1076 // { 0xd1, _4|_32_bit, _rm32, 0 }, 1077 { 0xd3, _4|_32_bit, _rm32, _cl }, 1078 { 0xc1, _4|_32_bit, _rm32, _imm8 }, 1079 { ASM_END, 0, 0, 0 } 1080 }; 1081 PTRNTAB2 aptb2SBB[] = /* SBB */ { 1082 { 0x1c, _ib, _al, _imm8 }, 1083 { 0x83, _3|_16_bit, _rm16, _imm8 }, 1084 { 0x1d, _iw|_16_bit, _ax, _imm16 }, 1085 { 0x83, _3|_32_bit, _rm32, _imm8 }, 1086 { 0x1d, _id|_32_bit, _eax, _imm32 }, 1087 { 0x80, _3 | _ib, _rm8, _imm8 }, 1088 { 0x81, _3 | _iw|_16_bit, _rm16, _imm16 }, 1089 { 0x81, _3 | _id|_32_bit, _rm32, _imm32 }, 1090 { 0x18, _r, _rm8, _r8 }, 1091 { 0x19, _r|_16_bit, _rm16, _r16 }, 1092 { 0x19, _r|_32_bit, _rm32, _r32 }, 1093 { 0x1A, _r, _r8, _rm8 }, 1094 { 0x1B, _r|_16_bit, _r16, _rm16 }, 1095 { 0x1B, _r|_32_bit, _r32, _rm32 }, 1096 { ASM_END, 0, 0, 0 } 1097 }; 1098 1099 1100 PTRNTAB2 aptb2SAR[] = /* SAR */ { 1101 // { 0xd0, _7, _rm8, 0 }, 1102 { 0xd2, _7, _rm8, _cl }, 1103 { 0xc0, _7, _rm8, _imm8 }, 1104 // { 0xd1, _7|_16_bit, _rm16, 0 }, 1105 { 0xd3, _7|_16_bit, _rm16, _cl }, 1106 { 0xc1, _7|_16_bit, _rm16, _imm8 }, 1107 // { 0xd1, _7|_32_bit, _rm32, 0 }, 1108 { 0xd3, _7|_32_bit, _rm32, _cl }, 1109 { 0xc1, _7|_32_bit, _rm32, _imm8 }, 1110 { ASM_END, 0, 0, 0 } 1111 }; 1112 PTRNTAB2 aptb2SHL[] = /* SHL */ { 1113 // { 0xd0, _4, _rm8, 0 }, 1114 { 0xd2, _4, _rm8, _cl }, 1115 { 0xc0, _4, _rm8, _imm8 }, 1116 // { 0xd1, _4|_16_bit, _rm16, 0 }, 1117 { 0xd3, _4|_16_bit, _rm16, _cl }, 1118 { 0xc1, _4|_16_bit, _rm16, _imm8 }, 1119 // { 0xd1, _4|_32_bit, _rm32, 0 }, 1120 { 0xd3, _4|_32_bit, _rm32, _cl }, 1121 { 0xc1, _4|_32_bit, _rm32, _imm8 }, 1122 { ASM_END, 0, 0, 0 } 1123 }; 1124 PTRNTAB2 aptb2SHR[] = /* SHR */ { 1125 // { 0xd0, _5, _rm8, 0 }, 1126 { 0xd2, _5, _rm8, _cl }, 1127 { 0xc0, _5, _rm8, _imm8 }, 1128 // { 0xd1, _5|_16_bit, _rm16, 0 }, 1129 { 0xd3, _5|_16_bit, _rm16, _cl }, 1130 { 0xc1, _5|_16_bit, _rm16, _imm8 }, 1131 // { 0xd1, _5|_32_bit, _rm32, 0 }, 1132 { 0xd3, _5|_32_bit, _rm32, _cl }, 1133 { 0xc1, _5|_32_bit, _rm32, _imm8 }, 1134 { ASM_END, 0, 0, 0 } 1135 }; 1136 PTRNTAB2 aptb2SUB[] = /* SUB */ { 1137 { 0x2c, _ib, _al, _imm8 }, 1138 { 0x83, _5|_16_bit, _rm16, _imm8 }, 1139 { 0x2d, _iw|_16_bit, _ax, _imm16 }, 1140 { 0x83, _5|_32_bit, _rm32, _imm8 }, 1141 { 0x2d, _id|_32_bit, _eax, _imm32 }, 1142 { 0x80, _5 | _ib, _rm8, _imm8 }, 1143 { 0x81, _5 | _iw|_16_bit, _rm16, _imm16 }, 1144 { 0x81, _5 | _id|_32_bit, _rm32, _imm32 }, 1145 { 0x28, _r, _rm8, _r8 }, 1146 { 0x29, _r|_16_bit, _rm16, _r16 }, 1147 { 0x29, _r|_32_bit, _rm32, _r32 }, 1148 { 0x2A, _r, _r8, _rm8 }, 1149 { 0x2B, _r|_16_bit, _r16, _rm16 }, 1150 { 0x2B, _r|_32_bit, _r32, _rm32 }, 1151 { ASM_END, 0, 0, 0 } 1152 }; 683 684 #define OPTABLE(str,op) \ 685 PTRNTAB2 aptb2##str[] = { \ 686 { 0xd2, op, _rm8, _cl }, \ 687 { 0xc0, op|_ib, _rm8, _imm8 }, \ 688 { 0xd3, op|_16_bit, _rm16, _cl }, \ 689 { 0xc1, op|_ib|_16_bit, _rm16, _imm8 }, \ 690 { 0xd3, op|_32_bit, _rm32, _cl }, \ 691 { 0xc1, op|_ib|_32_bit, _rm32, _imm8, }, \ 692 { 0xd3, op|_64_bit, _rm64, _cl }, \ 693 { 0xc1, op|_ib|_64_bit, _rm64, _imm8, }, \ 694 { ASM_END, 0, 0, 0 } \ 695 } 696 697 OPTABLE(ROL,_0); 698 OPTABLE(ROR,_1); 699 OPTABLE(RCL,_2); 700 OPTABLE(RCR,_3); 701 OPTABLE(SHL,_4); 702 OPTABLE(SHR,_5); 703 OPTABLE(SAR,_7); 704 705 #undef OPTABLE 706 1153 707 PTRNTAB2 aptb2TEST[] = /* TEST */ { 1154 708 { 0xa8, _ib|_modnot1, _al, _imm8 }, 1155 709 { 0xa9, _iw|_16_bit|_modnot1, _ax, _imm16 }, 1156 710 { 0xa9, _id|_32_bit|_modnot1, _eax, _imm32 }, 1157 711 { 0xf6, _0|_modnot1, _rm8, _imm8 }, 1158 712 { 0xf7, _0|_16_bit|_modnot1, _rm16, _imm16 }, 1159 713 { 0xf7, _0|_32_bit|_modnot1, _rm32, _imm32 }, 1160 714 { 0x84, _r|_modnot1, _rm8, _r8 }, 1161 715 { 0x85, _r|_16_bit|_modnot1, _rm16, _r16 }, 1162 716 { 0x85, _r|_32_bit|_modnot1, _rm32, _r32 }, 1163 717 { ASM_END, 0, 0, 0 } 1164 718 }; 1165 719 PTRNTAB2 aptb2XADD[] = /* XADD */ { // 486 only instruction 1166 720 // { 0x0fc0, _ib | _I386|_mod2, _rm8, _r8 }, 1167 721 // { 0x0fc1, _iw | _I386|_16_bit|_mod2, _rm16, _r16 }, 1168 722 // { 0x0fc1, _id | _I386|_32_bit|_mod2, _rm32, _r32 }, 1169 723 { 0x0fc0, _r | _I386|_mod2, _rm8, _r8 }, 1170 724 { 0x0fc1, _r | _I386|_16_bit|_mod2, _rm16, _r16 }, 1171 725 { 0x0fc1, _r | _I386|_32_bit|_mod2, _rm32, _r32 }, 1172 726 { ASM_END, 0, 0, 0 } 1173 727 }; 1174 728 PTRNTAB2 aptb2XCHG[] = /* XCHG */ { 1175 729 { 0x90, _r|_16_bit|_mod2, _ax , _r16 | _plus_r }, 1176 730 { 0x90, _r|_16_bit|_mod2, _r16 | _plus_r, _ax }, 1177 731 { 0x90, _r|_32_bit|_mod2, _eax, _r32 | _plus_r }, 1178 732 { 0x90, _r|_32_bit|_mod2, _r32 | _plus_r, _eax }, 1179 733 { 0x86, _r|_mod2, _rm8, _r8 }, 1180 734 { 0x86, _r|_mod2, _r8, _rm8 }, 1181 735 { 0x87, _r|_16_bit|_mod2, _rm16, _r16 }, 1182 736 { 0x87, _r|_16_bit|_mod2, _r16, _rm16 }, 1183 737 { 0x87, _r|_32_bit|_mod2, _rm32, _r32 }, 1184 738 { 0x87, _r|_32_bit|_mod2, _r32, _rm32 }, 1185 739 { ASM_END, 0, 0, 0 } 1186 740 }; 1187 PTRNTAB2 aptb2XOR[] = { 1188 { 0x34, _ib, _al, _imm8 }, 1189 { 0x83, _6|_16_bit, _rm16, _imm8 }, 1190 { 0x35, _iw|_16_bit, _ax, _imm16 }, 1191 { 0x83, _6|_32_bit, _rm32, _imm8 }, 1192 { 0x35, _id|_32_bit, _eax, _imm32 }, 1193 { 0x80, _6, _rm8, _imm8 }, 1194 { 0x81, _6|_16_bit, _rm16, _imm16 }, 1195 { 0x81, _6|_32_bit, _rm32, _imm32 }, 1196 { 0x30, _r, _rm8, _r8 }, 1197 { 0x31, _r|_16_bit, _rm16, _r16 }, 1198 { 0x31, _r|_32_bit, _rm32, _r32 }, 1199 { 0x32, _r, _r8, _rm8 }, 1200 { 0x33, _r|_16_bit, _r16, _rm16 }, 1201 { 0x33, _r|_32_bit, _r32, _rm32 }, 1202 { ASM_END, 0, 0, 0 } 1203 }; 1204 1205 PTRNTAB2 aptb2CMOVO[] = { 1206 { 0x0F40, _r|_16_bit, _r16, _rm16 }, 1207 { 0x0F40, _r|_32_bit, _r32, _rm32 }, 1208 { ASM_END, 0, 0, 0 } 1209 }; 1210 PTRNTAB2 aptb2CMOVNO[] = { 1211 { 0x0F41, _r|_16_bit, _r16, _rm16 }, 1212 { 0x0F41, _r|_32_bit, _r32, _rm32 }, 1213 { ASM_END, 0, 0, 0 } 1214 }; 1215 PTRNTAB2 aptb2CMOVB[] = { 1216 { 0x0F42, _r|_16_bit, _r16, _rm16 }, 1217 { 0x0F42, _r|_32_bit, _r32, _rm32 }, 1218 { ASM_END, 0, 0, 0 } 1219 }; 1220 PTRNTAB2 aptb2CMOVNB[] = { 1221 { 0x0F43, _r|_16_bit, _r16, _rm16 }, 1222 { 0x0F43, _r|_32_bit, _r32, _rm32 }, 1223 { ASM_END, 0, 0, 0 } 1224 }; 1225 PTRNTAB2 aptb2CMOVZ[] = { 1226 { 0x0F44, _r|_16_bit, _r16, _rm16 }, 1227 { 0x0F44, _r|_32_bit, _r32, _rm32 }, 1228 { ASM_END, 0, 0, 0 } 1229 }; 1230 PTRNTAB2 aptb2CMOVNZ[] = { 1231 { 0x0F45, _r|_16_bit, _r16, _rm16 }, 1232 { 0x0F45, _r|_32_bit, _r32, _rm32 }, 1233 { ASM_END, 0, 0, 0 } 1234 }; 1235 PTRNTAB2 aptb2CMOVBE[] = { 1236 { 0x0F46, _r|_16_bit, _r16, _rm16 }, 1237 { 0x0F46, _r|_32_bit, _r32, _rm32 }, 1238 { ASM_END, 0, 0, 0 } 1239 }; 1240 PTRNTAB2 aptb2CMOVNBE[] = { 1241 { 0x0F47, _r|_16_bit, _r16, _rm16 }, 1242 { 0x0F47, _r|_32_bit, _r32, _rm32 }, 1243 { ASM_END, 0, 0, 0 } 1244 }; 1245 PTRNTAB2 aptb2CMOVS[] = { 1246 { 0x0F48, _r|_16_bit, _r16, _rm16 }, 1247 { 0x0F48, _r|_32_bit, _r32, _rm32 }, 1248 { ASM_END, 0, 0, 0 } 1249 }; 1250 PTRNTAB2 aptb2CMOVNS[] = { 1251 { 0x0F49, _r|_16_bit, _r16, _rm16 }, 1252 { 0x0F49, _r|_32_bit, _r32, _rm32 }, 1253 { ASM_END, 0, 0, 0 } 1254 }; 1255 PTRNTAB2 aptb2CMOVP[] = { 1256 { 0x0F4A, _r|_16_bit, _r16, _rm16 }, 1257 { 0x0F4A, _r|_32_bit, _r32, _rm32 }, 1258 { ASM_END, 0, 0, 0 } 1259 }; 1260 PTRNTAB2 aptb2CMOVNP[] = { 1261 { 0x0F4B, _r|_16_bit, _r16, _rm16 }, 1262 { 0x0F4B, _r|_32_bit, _r32, _rm32 }, 1263 { ASM_END, 0, 0, 0 } 1264 }; 1265 PTRNTAB2 aptb2CMOVL[] = { 1266 { 0x0F4C, _r|_16_bit, _r16, _rm16 }, 1267 { 0x0F4C, _r|_32_bit, _r32, _rm32 }, 1268 { ASM_END, 0, 0, 0 } 1269 }; 1270 PTRNTAB2 aptb2CMOVNL[] = { 1271 { 0x0F4D, _r|_16_bit, _r16, _rm16 }, 1272 { 0x0F4D, _r|_32_bit, _r32, _rm32 }, 1273 { ASM_END, 0, 0, 0 } 1274 }; 1275 PTRNTAB2 aptb2CMOVLE[] = { 1276 { 0x0F4E, _r|_16_bit, _r16, _rm16 }, 1277 { 0x0F4E, _r|_32_bit, _r32, _rm32 }, 1278 { ASM_END, 0, 0, 0 } 1279 }; 1280 PTRNTAB2 aptb2CMOVNLE[] = { 1281 { 0x0F4F, _r|_16_bit, _r16, _rm16 }, 1282 { 0x0F4F, _r|_32_bit, _r32, _rm32 }, 1283 { ASM_END, 0, 0, 0 } 1284 }; 741 742 #define OPTABLE(str,op) \ 743 PTRNTAB2 aptb2##str[] = { \ 744 { 0x0F40|op, _r|_16_bit, _r16, _rm16 }, \ 745 { 0x0F40|op, _r|_32_bit, _r32, _rm32 }, \ 746 { 0x0F40|op, _r|_64_bit, _r64, _rm64 }, \ 747 { ASM_END, 0, 0, 0 } \ 748 } 749 750 OPTABLE(CMOVO,0); 751 OPTABLE(CMOVNO,1); 752 OPTABLE(CMOVB,2); 753 OPTABLE(CMOVNB,3); 754 OPTABLE(CMOVZ,4); 755 OPTABLE(CMOVNZ,5); 756 OPTABLE(CMOVBE,6); 757 OPTABLE(CMOVNBE,7); 758 OPTABLE(CMOVS,8); 759 OPTABLE(CMOVNS,9); 760 OPTABLE(CMOVP,0xA); 761 OPTABLE(CMOVNP,0xB); 762 OPTABLE(CMOVL,0xC); 763 OPTABLE(CMOVNL,0xD); 764 OPTABLE(CMOVLE,0xE); 765 OPTABLE(CMOVNLE,0xF); 766 767 #undef OPTABLE 1285 768 1286 769 PTRNTAB3 aptb3IMUL[] = /* IMUL */ { 1287 770 { 0x0faf, _r|_16_bit, _r16, _rm16, 0 }, 1288 771 { 0x0faf, _r|_32_bit, _r32, _rm32, 0 }, 1289 772 { 0x0faf, _r|_64_bit, _r64, _rm64, 0 }, 1290 773 { 0xf6, _5|_modax, _rm8, 0, 0 }, 1291 774 { 0xf7, _5|_16_bit|_modaxdx, _rm16, 0, 0 }, 1292 775 { 0xf7, _5|_32_bit|_modaxdx, _rm32, 0, 0 }, 1293 776 { 0xf7, _5|_64_bit|_modaxdx, _rm64, 0, 0 }, 1294 777 { 0x6b, _r|_ib|_16_bit, _r16, _imm8, 0 }, 1295 778 { 0x6b, _r|_ib|_32_bit, _r32, _imm8, 0 }, 1296 779 { 0x69, _r|_iw|_16_bit, _r16, _imm16, 0 }, 1297 780 { 0x69, _r|_id|_32_bit, _r32, _imm32, 0 }, 1298 781 { 0x69, _r|_id|_64_bit, _r64, _imm32, 0 }, 1299 782 { 0x6b, _r|_ib|_16_bit, _r16, _rm16, _imm8 }, 1300 783 { 0x6b, _r|_ib|_32_bit, _r32, _rm32, _imm8 }, 1301 784 { 0x6b, _r|_ib|_64_bit, _r64, _rm64, _imm8 }, 1302 785 { 0x69, _r|_iw|_16_bit, _r16, _rm16, _imm16 }, 1303 786 { 0x69, _r|_id|_32_bit, _r32, _rm32, _imm32 }, 1304 787 { 0x69, _r|_id|_64_bit, _r64, _rm64, _imm32 }, 1305 788 { ASM_END, 0, 0, 0 } 1306 789 }; 1307 790 PTRNTAB3 aptb3SHLD[] = /* SHLD */ { 1308 791 { 0x0fa4, _cw|_16_bit, _rm16, _r16, _imm8 }, 1309 792 { 0x0fa4, _cd|_32_bit, _rm32, _r32, _imm8 }, 1310 793 { 0x0fa5, _cw|_16_bit, _rm16, _r16, _cl }, 1311 794 { 0x0fa5, _cd|_32_bit, _rm32, _r32, _cl }, 1312 795 { ASM_END, 0, 0, 0 } 1313 796 }; 1314 797 PTRNTAB3 aptb3SHRD[] = /* SHRD */ { 1315 798 { 0x0fac, _cw|_16_bit, _rm16, _r16, _imm8 }, 1316 799 { 0x0fac, _cd|_32_bit, _rm32, _r32, _imm8 }, 1317 800 { 0x0fad, _cw|_16_bit, _rm16, _r16, _cl }, 1318 801 { 0x0fad, _cd|_32_bit, _rm32, _r32, _cl }, 1319 802 { ASM_END, 0, 0, 0 } 1320 803 }; 1321 804 // 1322 805 // Floating point instructions which have entirely different flag 1323 806 // interpretations 1324 807 // 1325 PTRNTAB0 aptb0F2XM1[] = /* F2XM1 */ { 1326 { 0xd9f0, 0 } 1327 }; 1328 PTRNTAB0 aptb0FABS[] = /* FABS */ { 1329 { 0xd9e1, 0 } 1330 }; 1331 PTRNTAB0 aptb0FCHS[] = /* FCHS */ { 1332 { 0xd9e0, 0 } 1333 }; 1334 PTRNTAB0 aptb0FCLEX[] = /* FCLEX */ { 1335 { 0xdbe2, _fwait } 1336 }; 1337 PTRNTAB0 aptb0FNCLEX[] = /* FNCLEX */ { 1338 { 0xdbe2, _nfwait } 1339 }; 1340 PTRNTAB0 aptb0FCOMPP[] = /* FCOMPP */ { 1341 { 0xded9, 0 } 1342 }; 1343 PTRNTAB0 aptb0FCOS[] = /* FCOS */ { 1344 { 0xd9ff, 0 } 1345 }; 1346 PTRNTAB0 aptb0FUCOMPP[] = /* FUCOMPP */ { 1347 { 0xdae9, 0 } 1348 }; 1349 PTRNTAB0 aptb0FDECSTP[] = /* FDECSTP */ { 1350 { 0xd9f6, 0 } 1351 }; 1352 PTRNTAB0 aptb0FINCSTP[] = /* FINCSTP */ { 1353 { 0xd9f7, 0 } 1354 }; 1355 PTRNTAB0 aptb0FINIT[] = /* FINIT */ { 1356 { 0xdbe3, _fwait } 1357 }; 1358 PTRNTAB0 aptb0FNINIT[] = /* FNINIT */ { 1359 { 0xdbe3, _nfwait } 1360 }; 1361 PTRNTAB0 aptb0FENI[] = /* FENI */ { 1362 { 0xdbe0, _fwait } 1363 }; 1364 PTRNTAB0 aptb0FNENI[] = /* FNENI */ { 1365 { 0xdbe0, _nfwait } 1366 }; 1367 PTRNTAB0 aptb0FDISI[] = /* FDISI */ { 1368 { 0xdbe1, _fwait } 1369 }; 1370 PTRNTAB0 aptb0FNDISI[] = /* FNDISI */ { 1371 { 0xdbe1, _nfwait } 1372 }; 1373 PTRNTAB0 aptb0FLD1[] = /* FLD1 */ { 1374 { 0xd9e8, 0 } 1375 }; 1376 PTRNTAB0 aptb0FLDL2T[] = /* FLDL2T */ { 1377 { 0xd9e9, 0 } 1378 }; 1379 PTRNTAB0 aptb0FLDL2E[] = /* FLDL2E */ { 1380 { 0xd9ea, 0 } 1381 }; 1382 PTRNTAB0 aptb0FLDPI[] = /* FLDPI */ { 1383 { 0xd9eb, 0 } 1384 }; 1385 PTRNTAB0 aptb0FLDLG2[] = /* FLDLG2 */ { 1386 { 0xd9ec, 0 } 1387 }; 1388 PTRNTAB0 aptb0FLDLN2[] = /* FLDLN2 */ { 1389 { 0xd9ed, 0 } 1390 }; 1391 PTRNTAB0 aptb0FLDZ[] = /* FLDZ */ { 1392 { 0xd9ee, 0 } 1393 }; 1394 PTRNTAB0 aptb0FNOP[] = /* FNOP */ { 1395 { 0xd9d0, 0 } 1396 }; 1397 PTRNTAB0 aptb0FPATAN[] = /* FPATAN */ { 1398 { 0xd9f3, 0 } 1399 }; 1400 PTRNTAB0 aptb0FPREM[] = /* FPREM */ { 1401 { 0xd9f8, 0 } 1402 }; 1403 PTRNTAB0 aptb0FPREM1[] = /* FPREM1 */ { 1404 { 0xd9f5, 0 } 1405 }; 1406 PTRNTAB0 aptb0FPTAN[] = /* FPTAN */ { 1407 { 0xd9f2, 0 } 1408 }; 1409 PTRNTAB0 aptb0FRNDINT[] = /* FRNDINT */ { 1410 { 0xd9fc, 0 } 1411 }; 1412 PTRNTAB0 aptb0FSCALE[] = /* FSCALE */ { 1413 { 0xd9fd, 0 } 1414 }; 1415 PTRNTAB0 aptb0FSETPM[] = /* FSETPM */ { 1416 { 0xdbe4, 0 } 1417 }; 1418 PTRNTAB0 aptb0FSIN[] = /* FSIN */ { 1419 { 0xd9fe, 0 } 1420 }; 1421 PTRNTAB0 aptb0FSINCOS[] = /* FSINCOS */ { 1422 { 0xd9fb, 0 } 1423 }; 1424 PTRNTAB0 aptb0FSQRT[] = /* FSQRT */ { 1425 { 0xd9fa, 0 } 1426 }; 1427 PTRNTAB0 aptb0FTST[] = /* FTST */ { 1428 { 0xd9e4, 0 } 1429 }; 1430 PTRNTAB0 aptb0FWAIT[] = /* FWAIT */ { 1431 { 0x9b, 0 } 1432 }; 1433 PTRNTAB0 aptb0FXAM[] = /* FXAM */ { 1434 { 0xd9e5, 0 } 1435 }; 1436 PTRNTAB0 aptb0FXTRACT[] = /* FXTRACT */ { 1437 { 0xd9f4, 0 } 1438 }; 1439 PTRNTAB0 aptb0FYL2X[] = /* FYL2X */ { 1440 { 0xd9f1, 0 } 1441 }; 1442 PTRNTAB0 aptb0FYL2XP1[] = /* FYL2XP1 */ { 1443 { 0xd9f9, 0 } 1444 }; 808 809 OPTABLE0(F2XM1, 0xd9f0,0); 810 OPTABLE0(FABS, 0xd9e1,0); 811 OPTABLE0(FCHS, 0xd9e0,0); 812 OPTABLE0(FCLEX, 0xdbe2,_fwait); 813 OPTABLE0(FNCLEX, 0xdbe2, _nfwait); 814 OPTABLE0(FCOMPP, 0xded9, 0); 815 OPTABLE0(FCOS, 0xd9ff, 0); 816 OPTABLE0(FUCOMPP, 0xdae9, 0); 817 OPTABLE0(FDECSTP, 0xd9f6, 0); 818 OPTABLE0(FINCSTP, 0xd9f7, 0); 819 OPTABLE0(FINIT, 0xdbe3, _fwait); 820 OPTABLE0(FNINIT, 0xdbe3, _nfwait); 821 OPTABLE0(FENI, 0xdbe0, _fwait); 822 OPTABLE0(FNENI, 0xdbe0, _nfwait); 823 OPTABLE0(FDISI, 0xdbe1, _fwait); 824 OPTABLE0(FNDISI, 0xdbe1, _nfwait); 825 OPTABLE0(FLD1, 0xd9e8, 0); 826 OPTABLE0(FLDL2T, 0xd9e9, 0); 827 OPTABLE0(FLDL2E, 0xd9ea, 0); 828 OPTABLE0(FLDPI, 0xd9eb, 0); 829 OPTABLE0(FLDLG2, 0xd9ec, 0); 830 OPTABLE0(FLDLN2, 0xd9ed, 0); 831 OPTABLE0(FLDZ, 0xd9ee, 0); 832 OPTABLE0(FNOP, 0xd9d0, 0); 833 OPTABLE0(FPATAN, 0xd9f3, 0); 834 OPTABLE0(FPREM, 0xd9f8, 0); 835 OPTABLE0(FPREM1, 0xd9f5, 0); 836 OPTABLE0(FPTAN, 0xd9f2, 0); 837 OPTABLE0(FRNDINT, 0xd9fc, 0); 838 OPTABLE0(FSCALE, 0xd9fd, 0); 839 OPTABLE0(FSETPM, 0xdbe4, 0); 840 OPTABLE0(FSIN, 0xd9fe, 0); 841 OPTABLE0(FSINCOS, 0xd9fb, 0); 842 OPTABLE0(FSQRT, 0xd9fa, 0); 843 OPTABLE0(FTST, 0xd9e4, 0); 844 OPTABLE0(FWAIT, 0x9b, 0); 845 OPTABLE0(FXAM, 0xd9e5, 0); 846 OPTABLE0(FXTRACT, 0xd9f4, 0); 847 OPTABLE0(FYL2X, 0xd9f1, 0); 848 OPTABLE0(FYL2XP1, 0xd9f9, 0); 1445 849 // 1446 850 // Floating point instructions which have entirely different flag 1447 851 // interpretations but they overlap, only asm_determine_operator 1448 852 // flags needs to know the difference 1449 853 // 1 operand floating point instructions follow 1450 854 // 1451 855 PTRNTAB1 aptb1FBLD[] = /* FBLD */ { 1452 856 { 0xdf, _4, _fm80 }, 1453 857 { ASM_END, 0, 0 } 1454 858 }; 1455 859 1456 860 PTRNTAB1 aptb1FBSTP[] = /* FBSTP */ { 1457 861 { 0xdf, _6, _fm80 }, 1458 862 { ASM_END, 0, 0 } 1459 863 }; 1460 864 PTRNTAB2 aptb2FCMOVB[] = /* FCMOVB */ { 1461 865 { 0xdac0, 0, _st, _sti | _plus_r }, 1462 866 { 0xdac1, 0, 0 }, 1463 867 { ASM_END, 0, 0 } 1464 868 }; … … 3203 2607 X("cmovnge", 2, (P) aptb2CMOVL ) \ 3204 2608 X("cmovnl", 2, (P) aptb2CMOVNL ) \ 3205 2609 X("cmovnle", 2, (P) aptb2CMOVNLE ) \ 3206 2610 X("cmovno", 2, (P) aptb2CMOVNO ) \ 3207 2611 X("cmovnp", 2, (P) aptb2CMOVNP ) \ 3208 2612 X("cmovns", 2, (P) aptb2CMOVNS ) \ 3209 2613 X("cmovnz", 2, (P) aptb2CMOVNZ ) \ 3210 2614 X("cmovo", 2, (P) aptb2CMOVO ) \ 3211 2615 X("cmovp", 2, (P) aptb2CMOVP ) \ 3212 2616 X("cmovpe", 2, (P) aptb2CMOVP ) \ 3213 2617 X("cmovpo", 2, (P) aptb2CMOVNP ) \ 3214 2618 X("cmovs", 2, (P) aptb2CMOVS ) \ 3215 2619 X("cmovz", 2, (P) aptb2CMOVZ ) \ 3216 2620 X("cmp", 2, (P) aptb2CMP ) \ 3217 2621 X("cmppd", 3, (P) aptb3CMPPD ) \ 3218 2622 X("cmpps", 3, (P) aptb3CMPPS ) \ 3219 2623 X("cmps", 2, (P) aptb2CMPS ) \ 3220 2624 X("cmpsb", 0, aptb0CMPSB ) \ 3221 2625 /*X("cmpsd", 0, aptb0CMPSD )*/ \ 3222 2626 X("cmpsd", ITopt|3, (P) aptb3CMPSD ) \ 2627 X("cmpsq", 0, aptb0CMPSQ ) \ 3223 2628 X("cmpss", 3, (P) aptb3CMPSS ) \ 3224 2629 X("cmpsw", 0, aptb0CMPSW ) \ 3225 2630 X("cmpxch8b", 1, (P) aptb1CMPXCH8B ) \ 3226 2631 X("cmpxchg", 2, (P) aptb2CMPXCHG ) \ 3227 2632 X("comisd", 2, (P) aptb2COMISD ) \ 3228 2633 X("comiss", 2, (P) aptb2COMISS ) \ 3229 2634 X("cpuid", 0, aptb0CPUID ) \ 3230 2635 X("cqo", 0, aptb0CQO ) \ 3231 2636 X("cvtdq2pd", 2, (P) aptb2CVTDQ2PD ) \ 3232 2637 X("cvtdq2ps", 2, (P) aptb2CVTDQ2PS ) \ 3233 2638 X("cvtpd2dq", 2, (P) aptb2CVTPD2DQ ) \ 3234 2639 X("cvtpd2pi", 2, (P) aptb2CVTPD2PI ) \ 3235 2640 X("cvtpd2ps", 2, (P) aptb2CVTPD2PS ) \ 3236 2641 X("cvtpi2pd", 2, (P) aptb2CVTPI2PD ) \ 3237 2642 X("cvtpi2ps", 2, (P) aptb2CVTPI2PS ) \ 3238 2643 X("cvtps2dq", 2, (P) aptb2CVTPS2DQ ) \ 3239 2644 X("cvtps2pd", 2, (P) aptb2CVTPS2PD ) \ 3240 2645 X("cvtps2pi", 2, (P) aptb2CVTPS2PI ) \ 3241 2646 X("cvtsd2si", 2, (P) aptb2CVTSD2SI ) \ 3242 2647 X("cvtsd2ss", 2, (P) aptb2CVTSD2SS ) \ … … 3432 2837 #define OPCODETABLE2 \ 3433 2838 X("lahf", 0, aptb0LAHF ) \ 3434 2839 X("lar", 2, (P) aptb2LAR ) \ 3435 2840 X("lddqu", 2, (P) aptb2LDDQU ) \ 3436 2841 X("ldmxcsr", 1, (P) aptb1LDMXCSR ) \ 3437 2842 X("lds", 2, (P) aptb2LDS ) \ 3438 2843 X("lea", 2, (P) aptb2LEA ) \ 3439 2844 X("leave", 0, aptb0LEAVE ) \ 3440 2845 X("les", 2, (P) aptb2LES ) \ 3441 2846 X("lfence", 0, aptb0LFENCE) \ 3442 2847 X("lfs", 2, (P) aptb2LFS ) \ 3443 2848 X("lgdt", 1, (P) aptb1LGDT ) \ 3444 2849 X("lgs", 2, (P) aptb2LGS ) \ 3445 2850 X("lidt", 1, (P) aptb1LIDT ) \ 3446 2851 X("lldt", 1, (P) aptb1LLDT ) \ 3447 2852 X("lmsw", 1, (P) aptb1LMSW ) \ 3448 2853 X("lock", ITprefix | 0, aptb0LOCK ) \ 3449 2854 X("lods", 1, (P) aptb1LODS ) \ 3450 2855 X("lodsb", 0, aptb0LODSB ) \ 3451 2856 X("lodsd", 0, aptb0LODSD ) \ 2857 X("lodsq", 0, aptb0LODSQ ) \ 3452 2858 X("lodsw", 0, aptb0LODSW ) \ 3453 2859 X("loop", ITjump | 1, (P) aptb1LOOP ) \ 3454 2860 X("loope", ITjump | 1, (P) aptb1LOOPE ) \ 3455 2861 X("loopne", ITjump | 1, (P) aptb1LOOPNE ) \ 3456 X("loopnz", ITjump | 1, (P) aptb1LOOPN Z) \3457 X("loopz", ITjump | 1, (P) aptb1LOOP Z) \2862 X("loopnz", ITjump | 1, (P) aptb1LOOPNE ) \ 2863 X("loopz", ITjump | 1, (P) aptb1LOOPE ) \ 3458 2864 X("lsl", 2, (P) aptb2LSL ) \ 3459 2865 X("lss", 2, (P) aptb2LSS ) \ 3460 2866 X("ltr", 1, (P) aptb1LTR ) \ 3461 2867 X("maskmovdqu", 2, (P) aptb2MASKMOVDQU ) \ 3462 2868 X("maskmovq", 2, (P) aptb2MASKMOVQ ) \ 3463 2869 X("maxpd", 2, (P) aptb2MAXPD ) \ 3464 2870 X("maxps", 2, (P) aptb2MAXPS ) \ 3465 2871 X("maxsd", 2, (P) aptb2MAXSD ) \ 3466 2872 X("maxss", 2, (P) aptb2MAXSS ) \ 3467 2873 X("mfence", 0, aptb0MFENCE) \ 3468 2874 X("minpd", 2, (P) aptb2MINPD ) \ 3469 2875 X("minps", 2, (P) aptb2MINPS ) \ 3470 2876 X("minsd", 2, (P) aptb2MINSD ) \ 3471 2877 X("minss", 2, (P) aptb2MINSS ) \ 3472 2878 X("monitor", 0, (P) aptb0MONITOR ) \ 3473 2879 X("mov", 2, (P) aptb2MOV ) \ 3474 2880 X("movapd", 2, (P) aptb2MOVAPD ) \ 3475 2881 X("movaps", 2, (P) aptb2MOVAPS ) \ 3476 2882 X("movd", 2, (P) aptb2MOVD ) \ 3477 2883 X("movddup", 2, (P) aptb2MOVDDUP ) \ … … 3481 2887 X("movhlps", 2, (P) aptb2MOVHLPS ) \ 3482 2888 X("movhpd", 2, (P) aptb2MOVHPD ) \ 3483 2889 X("movhps", 2, (P) aptb2MOVHPS ) \ 3484 2890 X("movlhps", 2, (P) aptb2MOVLHPS ) \ 3485 2891 X("movlpd", 2, (P) aptb2MOVLPD ) \ 3486 2892 X("movlps", 2, (P) aptb2MOVLPS ) \ 3487 2893 X("movmskpd", 2, (P) aptb2MOVMSKPD ) \ 3488 2894 X("movmskps", 2, (P) aptb2MOVMSKPS ) \ 3489 2895 X("movntdq", 2, (P) aptb2MOVNTDQ ) \ 3490 2896 X("movnti", 2, (P) aptb2MOVNTI ) \ 3491 2897 X("movntpd", 2, (P) aptb2MOVNTPD ) \ 3492 2898 X("movntps", 2, (P) aptb2MOVNTPS ) \ 3493 2899 X("movntq", 2, (P) aptb2MOVNTQ ) \ 3494 2900 X("movq", 2, (P) aptb2MOVQ ) \ 3495 2901 X("movq2dq", 2, (P) aptb2MOVQ2DQ ) \ 3496 2902 X("movs", 2, (P) aptb2MOVS ) \ 3497 2903 X("movsb", 0, aptb0MOVSB ) \ 3498 2904 X("movsd", ITopt | 2, (P) aptb2MOVSD ) \ 3499 2905 X("movshdup", 2, (P) aptb2MOVSHDUP ) \ 3500 2906 X("movsldup", 2, (P) aptb2MOVSLDUP ) \ 2907 X("movsq", 0, aptb0MOVSQ ) \ 3501 2908 X("movss", 2, (P) aptb2MOVSS ) \ 3502 2909 X("movsw", 0, aptb0MOVSW ) \ 3503 2910 X("movsx", 2, (P) aptb2MOVSX ) \ 3504 2911 X("movupd", 2, (P) aptb2MOVUPD ) \ 3505 2912 X("movups", 2, (P) aptb2MOVUPS ) \ 3506 2913 X("movzx", 2, (P) aptb2MOVZX ) \ 3507 2914 X("mul", ITopt | 2, (P) aptb2MUL ) \ 3508 2915 X("mulpd", 2, (P) aptb2MULPD ) \ 3509 2916 X("mulps", 2, (P) aptb2MULPS ) \ 3510 2917 X("mulsd", 2, (P) aptb2MULSD ) \ 3511 2918 X("mulss", 2, (P) aptb2MULSS ) \ 3512 2919 X("mwait", 0, (P) aptb0MWAIT ) \ 3513 2920 X("neg", 1, (P) aptb1NEG ) \ 3514 2921 X("nop", 0, aptb0NOP ) \ 3515 2922 X("not", 1, (P) aptb1NOT ) \ 3516 2923 X("or", 2, (P) aptb2OR ) \ 3517 2924 X("orpd", 2, (P) aptb2ORPD ) \ 3518 2925 X("orps", 2, (P) aptb2ORPS ) \ 3519 2926 X("out", 2, (P) aptb2OUT ) \ 3520 2927 X("outs", 2, (P) aptb2OUTS ) \ … … 3627 3034 X("rcl", ITshift | 2, (P) aptb2RCL ) \ 3628 3035 X("rcpps", 2, (P) aptb2RCPPS ) \ 3629 3036 X("rcpss", 2, (P) aptb2RCPSS ) \ 3630 3037 X("rcr", ITshift | 2, (P) aptb2RCR ) \ 3631 3038 X("rdmsr", 0, aptb0RDMSR ) \ 3632 3039 X("rdpmc", 0, aptb0RDPMC ) \ 3633 3040 X("rdtsc", 0, aptb0RDTSC ) \ 3634 3041 X("rep", ITprefix | 0, aptb0REP ) \ 3635 3042 X("repe", ITprefix | 0, aptb0REP ) \ 3636 3043 X("repne", ITprefix | 0, aptb0REPNE ) \ 3637 3044 X("repnz", ITprefix | 0, aptb0REPNE ) \ 3638 3045 X("repz", ITprefix | 0, aptb0REP ) \ 3639 3046 X("ret", ITopt | 1, (P) aptb1RET ) \ 3640 3047 X("retf", ITopt | 1, (P) aptb1RETF ) \ 3641 3048 X("rol", ITshift | 2, (P) aptb2ROL ) \ 3642 3049 X("ror", ITshift | 2, (P) aptb2ROR ) \ 3643 3050 X("rsm", 0, aptb0RSM ) \ 3644 3051 X("rsqrtps", 2, (P) aptb2RSQRTPS ) \ 3645 3052 X("rsqrtss", 2, (P) aptb2RSQRTSS ) \ 3646 3053 X("sahf", 0, aptb0SAHF ) \ 3647 X("sal", ITshift | 2, (P) aptb2S AL ) \3054 X("sal", ITshift | 2, (P) aptb2SHL ) \ 3648 3055 X("sar", ITshift | 2, (P) aptb2SAR ) \ 3649 3056 X("sbb", 2, (P) aptb2SBB ) \ 3650 3057 X("scas", 1, (P) aptb1SCAS ) \ 3651 3058 X("scasb", 0, aptb0SCASB ) \ 3652 3059 X("scasd", 0, aptb0SCASD ) \ 3060 X("scasq", 0, aptb0SCASQ ) \ 3653 3061 X("scasw", 0, aptb0SCASW ) \ 3654 3062 X("seta", 1, (P) aptb1SETNBE ) \ 3655 3063 X("setae", 1, (P) aptb1SETNB ) \ 3656 3064 X("setb", 1, (P) aptb1SETB ) \ 3657 3065 X("setbe", 1, (P) aptb1SETBE ) \ 3658 3066 X("setc", 1, (P) aptb1SETB ) \ 3659 3067 X("sete", 1, (P) aptb1SETZ ) \ 3660 3068 X("setg", 1, (P) aptb1SETNLE ) \ 3661 3069 X("setge", 1, (P) aptb1SETNL ) \ 3662 3070 X("setl", 1, (P) aptb1SETL ) \ 3663 3071 X("setle", 1, (P) aptb1SETLE ) \ 3664 3072 X("setna", 1, (P) aptb1SETBE ) \ 3665 3073 X("setnae", 1, (P) aptb1SETB ) \ 3666 3074 X("setnb", 1, (P) aptb1SETNB ) \ 3667 3075 X("setnbe", 1, (P) aptb1SETNBE ) \ 3668 3076 X("setnc", 1, (P) aptb1SETNB ) \ 3669 3077 X("setne", 1, (P) aptb1SETNZ ) \ 3670 3078 X("setng", 1, (P) aptb1SETLE ) \ 3671 3079 X("setnge", 1, (P) aptb1SETL ) \ 3672 3080 X("setnl", 1, (P) aptb1SETNL ) \ … … 3686 3094 X("shl", ITshift | 2, (P) aptb2SHL ) \ 3687 3095 X("shld", 3, (P) aptb3SHLD ) \ 3688 3096 X("shr", ITshift | 2, (P) aptb2SHR ) \ 3689 3097 X("shrd", 3, (P) aptb3SHRD ) \ 3690 3098 X("shufpd", 3, (P) aptb3SHUFPD ) \ 3691 3099 X("shufps", 3, (P) aptb3SHUFPS ) \ 3692 3100 X("sidt", 1, (P) aptb1SIDT ) \ 3693 3101 X("sldt", 1, (P) aptb1SLDT ) \ 3694 3102 X("smsw", 1, (P) aptb1SMSW ) \ 3695 3103 X("sqrtpd", 2, (P) aptb2SQRTPD ) \ 3696 3104 X("sqrtps", 2, (P) aptb2SQRTPS ) \ 3697 3105 X("sqrtsd", 2, (P) aptb2SQRTSD ) \ 3698 3106 X("sqrtss", 2, (P) aptb2SQRTSS ) \ 3699 3107 X("stc", 0, aptb0STC ) \ 3700 3108 X("std", 0, aptb0STD ) \ 3701 3109 X("sti", 0, aptb0STI ) \ 3702 3110 X("stmxcsr", 1, (P) aptb1STMXCSR ) \ 3703 3111 X("stos", 1, (P) aptb1STOS ) \ 3704 3112 X("stosb", 0, aptb0STOSB ) \ 3705 3113 X("stosd", 0, aptb0STOSD ) \ 3114 X("stosq", 0, aptb0STOSQ ) \ 3706 3115 X("stosw", 0, aptb0STOSW ) \ 3707 3116 X("str", 1, (P) aptb1STR ) \ 3708 3117 X("sub", 2, (P) aptb2SUB ) \ 3709 3118 X("subpd", 2, (P) aptb2SUBPD ) \ 3710 3119 X("subps", 2, (P) aptb2SUBPS ) \ 3711 3120 X("subsd", 2, (P) aptb2SUBSD ) \ 3712 3121 X("subss", 2, (P) aptb2SUBSS ) \ 3713 3122 X("sysenter", 0, aptb0SYSENTER ) \ 3714 3123 X("sysexit", 0, aptb0SYSEXIT ) \ 3715 3124 X("test", 2, (P) aptb2TEST ) \ 3716 3125 X("ucomisd", 2, (P) aptb2UCOMISD ) \ 3717 3126 X("ucomiss", 2, (P) aptb2UCOMISS ) \ 3718 3127 X("ud2", 0, aptb0UD2 ) \ 3719 3128 X("unpckhpd", 2, (P) aptb2UNPCKHPD ) \ 3720 3129 X("unpckhps", 2, (P) aptb2UNPCKHPS ) \ 3721 3130 X("unpcklpd", 2, (P) aptb2UNPCKLPD ) \ 3722 3131 X("unpcklps", 2, (P) aptb2UNPCKLPS ) \ 3723 3132 X("verr", 1, (P) aptb1VERR ) \ 3724 3133 X("verw", 1, (P) aptb1VERW ) \ 3725 3134 X("wait", 0, aptb0WAIT ) \ branches/dmd-1.x/src/e2ir.c
r618 r621 4132 4132 elength = n1; 4133 4133 n1 = el_same(&elength); 4134 4134 elength = el_una(OP64_32, TYuint, elength); 4135 4135 L1: 4136 4136 n2x = n2; 4137 4137 n2 = el_same(&n2x); 4138 4138 n2x = el_bin(OPlt, TYint, n2x, elength); 4139 4139 4140 4140 // Construct: (n2x || ModuleAssert(line)) 4141 4141 Symbol *sassert; 4142 4142 4143 4143 sassert = irs->blx->module->toModuleArray(); 4144 4144 ea = el_bin(OPcall,TYvoid,el_var(sassert), 4145 4145 el_long(TYint, loc.linnum)); 4146 4146 eb = el_bin(OPoror,TYvoid,n2x,ea); 4147 4147 } 4148 4148 } 4149 4149 4150 4150 n1 = array_toPtr(t1, n1); 4151 4151 4152 { elem *escale; 4153 4154 escale = el_long(TYint, t1->nextOf()->size()); 4155 n2 = el_bin(OPmul, TYint, n2, escale); 4152 { 4153 elem *escale = el_long(TYsize_t, t1->nextOf()->size()); 4154 n2 = el_bin(OPmul, TYsize_t, n2, escale); 4156 4155 e = el_bin(OPadd, TYnptr, n1, n2); 4157 4156 e = el_una(OPind, type->totym(), e); 4158 4157 if (tybasic(e->Ety) == TYstruct || tybasic(e->Ety) == TYarray) 4159 4158 { e->Ety = TYstruct; 4160 4159 e->Enumbytes = type->size(); 4161 4160 } 4162 4161 } 4163 4162 4164 4163 eb = el_combine(einit, eb); 4165 4164 e = el_combine(eb, e); 4166 4165 } 4167 4166 el_setLoc(e,loc); 4168 4167 return e; 4169 4168 } 4170 4169 4171 4170 4172 4171 elem *TupleExp::toElem(IRState *irs) 4173 4172 { elem *e = NULL; 4174 4173 4175 4174 //printf("TupleExp::toElem() %s\n", toChars()); branches/dmd-1.x/src/impcnvgen.c
r428 r621 364 364 Y(Tint64, Tuns16) 365 365 Y(Tuns64, Tuns16) 366 366 367 367 Y(Tint16, Twchar) 368 368 Y(Tint32, Twchar) 369 369 Y(Tuns32, Twchar) 370 370 Y(Tint64, Twchar) 371 371 Y(Tuns64, Twchar) 372 372 373 373 // Y(Tuns32, Tint32) 374 374 Y(Tint64, Tint32) 375 375 Y(Tuns64, Tint32) 376 376 377 377 // Y(Tint32, Tuns32) 378 378 Y(Tint64, Tuns32) 379 379 Y(Tuns64, Tuns32) 380 380 381 381 Y(Tint64, Tdchar) 382 382 Y(Tuns64, Tdchar) 383 383 384 Y(Tint64, Tuns64)385 Y(Tuns64, Tint64)384 // Y(Tint64, Tuns64) 385 // Y(Tuns64, Tint64) 386 386 387 387 for (i = 0; i < TMAX; i++) 388 388 for (j = 0; j < TMAX; j++) 389 389 { 390 390 if (impcnvResult[i][j] == Terror) 391 391 { 392 392 impcnvResult[i][j] = impcnvResult[j][i]; 393 393 impcnvType1[i][j] = impcnvType2[j][i]; 394 394 impcnvType2[i][j] = impcnvType1[j][i]; 395 395 } 396 396 } 397 397 } 398 398 399 399 int main() 400 400 { FILE *fp; 401 401 int i; 402 402 int j; 403 403 404 404 init(); 405 405 trunk/src/backend/cod1.c
r619 r621 1146 1146 c = cdisscaledindex(e11,&idxregs,keepmsk); 1147 1147 reg = findreg(idxregs); 1148 1148 pcs->Irm = modregrm(0,0,4); 1149 1149 pcs->Isib = modregrm(ss,reg & 7,5); 1150 1150 if (reg & 8) 1151 1151 pcs->Irex |= REX_X; 1152 1152 } 1153 1153 else 1154 1154 { 1155 1155 c = scodelem(e11,&idxregs,keepmsk,TRUE); // load index reg 1156 1156 setaddrmode(pcs, idxregs); 1157 1157 } 1158 1158 goto Lptr; 1159 1159 } 1160 1160 1161 1161 /* Look for *(v1 + v2) 1162 1162 * EA = [v1][v2] 1163 1163 */ 1164 1164 1165 1165 if (!I16 && e1isadd && (!e1->Ecount || !e1free) && 1166 tysize[e1ty] == REGSIZE)1166 (tysize[e1ty] == REGSIZE || (I64 && tysize[e1ty] == 4))) 1167 1167 { code *c2; 1168 1168 regm_t idxregs2; 1169 1169 unsigned base,index; 1170 1170 int ss; 1171 1171 1172 1172 L4: 1173 1173 // Look for *(v1 + v2 << scale) 1174 1174 ss = isscaledindex(e12); 1175 1175 if (ss) 1176 1176 { 1177 1177 c = scodelem(e11,&idxregs,keepmsk,TRUE); 1178 1178 idxregs2 = allregs & ~(idxregs | keepmsk); 1179 1179 c2 = cdisscaledindex(e12,&idxregs2,keepmsk | idxregs); 1180 1180 } 1181 1181 1182 1182 // Look for *(v1 << scale + v2) 1183 1183 else if ((ss = isscaledindex(e11)) != 0) 1184 1184 { 1185 1185 idxregs2 = idxregs; 1186 1186 c = cdisscaledindex(e11,&idxregs2,keepmsk); … … 3522 3522 L3: 3523 3523 cssave(e,*pretregs,FALSE); 3524 3524 freenode(e); 3525 3525 return c; 3526 3526 } 3527 3527 3528 3528 3529 3529 /****************************** 3530 3530 * Generate code to load data into registers. 3531 3531 */ 3532 3532 3533 3533 code *loaddata(elem *e,regm_t *pretregs) 3534 3534 { unsigned reg,nreg,op,sreg; 3535 3535 tym_t tym; 3536 3536 int sz; 3537 3537 code *c,*ce,cs; 3538 3538 regm_t flags,forregs,regm; 3539 3539 3540 3540 #ifdef DEBUG 3541 3541 if (debugw) 3542 printf("loaddata(e = %p,*pretregs = x%x)\n",e,*pretregs);3542 printf("loaddata(e = %p,*pretregs = %s)\n",e,regm_str(*pretregs)); 3543 3543 //elem_print(e); 3544 3544 #endif 3545 3545 assert(e); 3546 3546 elem_debug(e); 3547 3547 if (*pretregs == 0) 3548 3548 return CNIL; 3549 3549 tym = tybasic(e->Ety); 3550 3550 if (tym == TYstruct) 3551 3551 return cdrelconst(e,pretregs); 3552 3552 if (tyfloating(tym)) 3553 3553 { obj_fltused(); 3554 3554 if (config.inline8087) 3555 3555 { if (*pretregs & mST0) 3556 3556 return load87(e,0,pretregs,NULL,-1); 3557 3557 else if (tycomplex(tym)) 3558 3558 return cload87(e, pretregs); 3559 3559 } 3560 3560 } 3561 3561 sz = tysize[tym]; 3562 3562 cs.Iflags = 0; trunk/src/backend/ptrntab.c
r619 r621 15 15 #include <stdlib.h> 16 16 #include <string.h> 17 17 #include <time.h> 18 18 19 19 #include "cc.h" 20 20 #include "code.h" 21 21 #include "iasm.h" 22 22 23 23 static char __file__[] = __FILE__; /* for tassert.h */ 24 24 #include "tassert.h" 25 25 26 26 // 27 27 // NOTE: For 0 operand instructions, the opcode is taken from 28 28 // the first entry and no subsequent entries are required. 29 29 // for instructions with operands, a NULL entry is required at the end 30 30 // as a terminator 31 31 // 32 32 // 0 Operand instructions 33 33 // 34 34 35 PTRNTAB0 aptb0AAA[] = /* AAA */ { 36 { 0x37, _modax }, 37 }; 38 39 PTRNTAB0 aptb0AAD[] = /* AAD */ { 40 { 0xd50a, _modax } 41 }; 42 43 PTRNTAB0 aptb0AAM[] = /* AAM */ { 44 { 0xd40a, _modax } 45 }; 46 PTRNTAB0 aptb0AAS[] = /* AAS */ { 47 { 0x3f, _modax } 48 }; 49 PTRNTAB0 aptb0CBW[] = /* CBW */ { 50 { 0x98, _16_bit | _modax } 51 }; 52 PTRNTAB0 aptb0CWDE[] = /* CWDE */ { 53 { 0x98, _32_bit | _I386 | _modax } 54 }; 55 PTRNTAB0 aptb0CDQE[] = /* CDQE */ { 56 { 0x98, _64_bit | _modax } 57 }; 58 PTRNTAB0 aptb0CLC[] = /* CLC */ { 59 { 0xf8, 0 } 60 }; 61 62 PTRNTAB0 aptb0CLD[] = /* CLD */ { 63 { 0xfc, 0 } 64 }; 65 PTRNTAB0 aptb0CLI[] = /* CLI */ { 66 { 0xfa, 0 } 67 }; 68 69 PTRNTAB0 aptb0CLTS[] = /* CLTS */ { 70 { 0x0f06, 0 } 71 }; 72 73 PTRNTAB0 aptb0CMC[] = /* CMC */ { 74 { 0xf5, 0 } 75 }; 76 77 PTRNTAB0 aptb0CMPSB[] = /* CMPSB */ { 78 { 0xa6, _modsidi } 79 }; 80 81 PTRNTAB0 aptb0CMPSW[] = /* CMPSW */ { 82 { 0xa7, _16_bit | _modsidi } 83 }; 84 85 #if 0 86 PTRNTAB0 aptb0CMPSD[] = /* CMPSD */ { 87 { 0xa7, _32_bit | _I386 | _modsidi } 88 }; 89 #endif 90 91 PTRNTAB0 aptb0CWD[] = /* CWD */ { 92 { 0x99, _16_bit | _modaxdx } 93 }; 94 95 PTRNTAB0 aptb0CDQ[] = /* CDQ */ { 96 { 0x99, _32_bit | _I386 | _modaxdx } 97 }; 98 99 PTRNTAB0 aptb0CQO[] = /* CQO */ { 100 { 0x99, _64_bit | _modaxdx } 101 }; 102 103 PTRNTAB0 aptb0DAA[] = /* DAA */ { 104 { 0x27, _modax } 105 }; 106 107 PTRNTAB0 aptb0DAS[] = /* DAS */ { 108 { 0x2f, _modax } 109 }; 110 111 PTRNTAB0 aptb0HLT[] = /* HLT */ { 112 { 0xf4, 0 } 113 }; 114 115 PTRNTAB0 aptb0INSB[] = /* INSB */ { 116 { 0x6c, _I386 | _modsi } 117 }; 118 119 PTRNTAB0 aptb0INSW[] = /* INSW */ { 120 { 0x6d, _16_bit | _I386 | _modsi } 121 }; 122 123 PTRNTAB0 aptb0INSD[] = /* INSD */ { 124 { 0x6d, _32_bit | _I386 | _modsi } 125 }; 126 127 PTRNTAB0 aptb0INTO[] = /* INTO */ { 128 { 0xce, 0 } 129 }; 130 PTRNTAB0 aptb0INVD[] = /* INVD */ { 131 { 0x0f08, _I386 } // Actually a 486 only instruction 132 }; 133 PTRNTAB0 aptb0IRET[] = /* IRET */ { 134 { 0xcf, _16_bit } 135 }; 136 137 PTRNTAB0 aptb0IRETD[] = /* IRETD */ { 138 { 0xcf, _32_bit | _I386 } 139 }; 140 141 PTRNTAB0 aptb0LAHF[] = /* LAHF */ { 142 { 0x9f, _modax } 143 }; 144 145 PTRNTAB0 aptb0LEAVE[] = /* LEAVE */ { 146 { 0xc9, _I386 } 147 }; 148 149 PTRNTAB0 aptb0LOCK[] = /* LOCK */ { 150 { 0xf0, 0 } 151 }; 152 153 PTRNTAB0 aptb0LODSB[] = /* LODSB */ { 154 { 0xac, _modsiax } 155 }; 156 157 PTRNTAB0 aptb0LODSW[] = /* LODSW */ { 158 { 0xad, _16_bit | _modsiax } 159 }; 160 161 PTRNTAB0 aptb0LODSD[] = /* LODSD */ { 162 { 0xad, _32_bit | _I386 | _modsiax } 163 }; 164 165 PTRNTAB0 aptb0MOVSB[] = /* MOVSB */ { 166 { 0xa4, _modsidi} 167 }; 168 169 PTRNTAB0 aptb0MOVSW[] = /* MOVSW */ { 170 { 0xa5, _16_bit | _modsidi } 171 }; 35 #define OPTABLE0(str,op,mod) PTRNTAB0 aptb0##str[] = { { op, mod }, }; 36 37 OPTABLE0(AAA, 0x37,_modax); 38 OPTABLE0(AAD, 0xd50a,_modax); 39 OPTABLE0(AAM, 0xd40a,_modax); 40 OPTABLE0(AAS, 0x3f,_modax); 41 OPTABLE0(CBW, 0x98,_16_bit | _modax); 42 OPTABLE0(CWDE, 0x98,_32_bit | _I386 | _modax); 43 OPTABLE0(CDQE, 0x98,_64_bit | _modax); 44 OPTABLE0(CLC, 0xf8,0); 45 OPTABLE0(CLD, 0xfc,0); 46 OPTABLE0(CLI, 0xfa,0); 47 OPTABLE0(CLTS, 0x0f06,0); 48 OPTABLE0(CMC, 0xf5,0); 49 OPTABLE0(CMPSB, 0xa6,_modsidi); 50 OPTABLE0(CMPSW, 0xa7,_16_bit | _modsidi); 51 //OPTABLE0(CMPSD, 0xa7,_32_bit | _I386 | _modsidi); 52 OPTABLE0(CMPSQ, 0xa7,_64_bit | _modsidi); 53 OPTABLE0(CWD, 0x99, _16_bit | _modaxdx); 54 OPTABLE0(CDQ, 0x99,_32_bit | _I386 | _modaxdx); 55 OPTABLE0(CQO, 0x99, _64_bit | _modaxdx); 56 OPTABLE0(DAA, 0x27,_modax); 57 OPTABLE0(DAS, 0x2f,_modax); 58 OPTABLE0(HLT, 0xf4,0); 59 OPTABLE0(INSB, 0x6c,_I386 | _modsi); 60 OPTABLE0(INSW, 0x6d,_16_bit | _I386 | _modsi); 61 OPTABLE0(INSD, 0x6d,_32_bit | _I386 | _modsi); 62 OPTABLE0(INTO, 0xce,0); 63 OPTABLE0(INVD, 0x0f08,_I386); // Actually a 486 only instruction 64 OPTABLE0(IRET, 0xcf,_16_bit); 65 OPTABLE0(IRETD, 0xcf,_32_bit | _I386); 66 OPTABLE0(LAHF, 0x9f,_modax); 67 OPTABLE0(LEAVE, 0xc9,_I386); 68 OPTABLE0(LOCK, 0xf0,0); 69 OPTABLE0(LODSB, 0xac,_modsiax); 70 OPTABLE0(LODSW, 0xad,_16_bit | _modsiax); 71 OPTABLE0(LODSD, 0xad,_32_bit | _I386 | _modsiax); 72 OPTABLE0(LODSQ, 0xad,_64_bit | _modsiax); 73 OPTABLE0(MOVSB, 0xa4, _modsidi); 74 OPTABLE0(MOVSW, 0xa5, _16_bit | _modsidi); 75 OPTABLE0(MOVSQ, 0xa5, _64_bit | _modsidi); 76 OPTABLE0(NOP, 0x90, 0); 77 OPTABLE0(OUTSB, 0x6e, _I386 | _modsi); 78 OPTABLE0(OUTSW, 0x6f, _16_bit | _I386 | _modsi); 79 OPTABLE0(OUTSD, 0x6f, _32_bit | _I386 | _modsi); 80 OPTABLE0(POPA, 0x61, _16_bit | _I386 | _modall); 81 OPTABLE0(POPAD, 0x61, _32_bit | _I386 | _modall); 82 OPTABLE0(POPF, 0x9d, _16_bit); 83 OPTABLE0(POPFD, 0x9d, _32_bit | _I386); 84 OPTABLE0(PUSHA, 0x60, _16_bit | _I386); 85 OPTABLE0(PUSHAD, 0x60, _32_bit | _I386); 86 OPTABLE0(PUSHF, 0x9c, _16_bit); 87 OPTABLE0(PUSHFD, 0x9c, _32_bit | _I386); 88 OPTABLE0(REP, 0xf3, _modcx); 89 OPTABLE0(REPNE, 0xf2, _modcx); 90 OPTABLE0(SAHF, 0x9e, 0); 91 OPTABLE0(SCASB, 0xAE, _moddi); 92 OPTABLE0(SCASW, 0xAF, _16_bit | _moddi); 93 OPTABLE0(SCASD, 0xAF, _32_bit | _I386 | _moddi); 94 OPTABLE0(SCASQ, 0xAF, _64_bit | _moddi); 95 OPTABLE0(STC, 0xf9, 0); 96 OPTABLE0(STD, 0xfd, 0); 97 OPTABLE0(STI, 0xfb, 0); 98 OPTABLE0(STOSB, 0xaa, _moddi); 99 OPTABLE0(STOSW, 0xAB, _16_bit | _moddi); 100 OPTABLE0(STOSD, 0xAB, _32_bit | _I386 | _moddi); 101 OPTABLE0(STOSQ, 0xAB, _64_bit | _moddi); 102 OPTABLE0(WAIT, 0x9B, 0); 103 OPTABLE0(WBINVD, 0x0f09, _I386); // Really a 486 opcode 104 OPTABLE0(XLATB, 0xd7, _modax); 105 OPTABLE0(CPUID, 0x0fa2, _I386 | _modall); 106 OPTABLE0(RDMSR, 0x0f32, _I386 | _modaxdx); 107 OPTABLE0(RDPMC, 0x0f33, _I386 | _modaxdx); 108 OPTABLE0(RDTSC, 0x0f31, _I386 | _modaxdx); 109 OPTABLE0(WRMSR, 0x0f30, _I386); 110 OPTABLE0(RSM, 0x0faa, _I386); 172 111 173 112 PTRNTAB2 aptb2MOVSD[] = /* MOVSD */ { 174 113 { 0xa5, _32_bit | _I386 | _modsidi }, 175 114 { 0xF20F10, _r, _xmm, _xmm_m64 }, 176 115 { 0xF20F11, _r, _xmm_m64, _xmm }, 177 116 }; 178 117 179 PTRNTAB0 aptb0NOP[] = /* NOP */ {180 { 0x90, 0 }181 };182 183 PTRNTAB0 aptb0OUTSB[] = /* OUTSB */ {184 { 0x6e, _I386 | _modsi }185 };186 187 PTRNTAB0 aptb0OUTSW[] = /* OUTSW */ {188 { 0x6f, _16_bit | _I386 | _modsi }189 };190 191 PTRNTAB0 aptb0OUTSD[] = /* OUTSD */ {192 { 0x6f, _32_bit | _I386 | _modsi }193 };194 195 PTRNTAB0 aptb0POPA[] = /* POPA */ {196 { 0x61, _16_bit | _I386 | _modall }197 };198 199 PTRNTAB0 aptb0POPAD[] = /* POPAD */ {200 { 0x61, _32_bit | _I386 | _modall }201 };202 203 PTRNTAB0 aptb0POPF[] = /* POPF */ {204 { 0x9d, _16_bit }205 };206 207 PTRNTAB0 aptb0POPFD[] = /* POPFD */ {208 { 0x9d, _32_bit | _I386 }209 };210 211 PTRNTAB0 aptb0PUSHA[] = /* PUSHA */ {212 { 0x60, _16_bit | _I386 }213 };214 215 PTRNTAB0 aptb0PUSHAD[] = /* PUSHAD */ {216 { 0x60, _32_bit | _I386 }217 };218 219 PTRNTAB0 aptb0PUSHF[]= /* PUSHF */ {220 {0x9c, _16_bit }221 };222 223 PTRNTAB0 aptb0PUSHFD[] = /* PUSHFD */ {224 { 0x9c, _32_bit | _I386 }225 };226 227 PTRNTAB0 aptb0REP[] = /* REP */ {228 { 0xf3, _modcx }229 };230 231 PTRNTAB0 aptb0REPNE[] = /* REPNE */ {232 { 0xf2, _modcx }233 };234 235 PTRNTAB0 aptb0SAHF[] = /* SAHF */ {236 { 0x9e, 0 }237 };238 239 PTRNTAB0 aptb0SCASB[] = /* SCASB */ {240 { 0xAE, _moddi }241 };242 243 PTRNTAB0 aptb0SCASW[] = /* SCASW */ {244 { 0xAF, _16_bit | _moddi}245 };246 247 PTRNTAB0 aptb0SCASD[] = /* SCASD */ {248 { 0xAF, _32_bit | _I386 | _moddi }249 };250 251 PTRNTAB0 aptb0STC[] = /* STC */ {252 { 0xf9, 0 }253 };254 255 PTRNTAB0 aptb0STD[] = /* STD */ {256 { 0xfd, 0 }257 };258 259 PTRNTAB0 aptb0STI[] = /* STI */ {260 { 0xfb, 0 }261 };262 PTRNTAB0 aptb0STOSB[] = /* STOSB */ {263 { 0xaa, _moddi }264 };265 266 PTRNTAB0 aptb0STOSW[] = /* STOSW */ {267 { 0xAB, _16_bit | _moddi }268 };269 270 PTRNTAB0 aptb0STOSD[] = /* STOSD */ {271 { 0xAB, _32_bit | _I386 | _moddi }272 };273 274 PTRNTAB0 aptb0WAIT[] = /* WAIT */ {275 { 0x9B, 0 }276 };277 PTRNTAB0 aptb0WBINVD[] = /* WBINVD */ {278 { 0xf09, _I386 } // Really a 486 opcode279 };280 PTRNTAB0 aptb0XLATB[] = /* XLATB */ {281 { 0xd7, _modax }282 };283 PTRNTAB0 aptb0CPUID[] = {284 { 0x0fa2, _I386 | _modall }285 };286 287 PTRNTAB0 aptb0RDMSR[] = {288 { 0x0f32, _I386 | _modaxdx }289 };290 291 PTRNTAB0 aptb0RDPMC[] = {292 { 0x0f33, _I386 | _modaxdx }293 };294 295 PTRNTAB0 aptb0RDTSC[] = {296 { 0x0f31, _I386 | _modaxdx }297 };298 299 PTRNTAB0 aptb0WRMSR[] = {300 { 0x0f30, _I386 }301 };302 303 PTRNTAB0 aptb0RSM[] = {304 { 0x0faa, _I386 }305 };306 118 // 307 119 // Now come the one operand instructions 308 120 // These will prove to be a little more challenging than the 0 309 121 // operand instructions 310 122 // 311 123 PTRNTAB1 aptb1BSWAP[] = /* BSWAP */ { 312 124 // Really is a 486 only instruction 313 125 { 0x0fc8, _I386, _plus_r | _r32 }, 314 126 { ASM_END, 0, 0 } 315 127 }; 316 128 317 129 PTRNTAB1 aptb1CALL[] = /* CALL */ { 318 130 { 0xe8, _cw | _modall , _rel16 }, 319 131 { 0xff, _2 | _16_bit | _modall, _r16 }, 320 132 { 0xff, _2 | _modall , _m16 }, 321 133 { 0x9a, _cd | _modall , _p1616 }, 322 134 { 0xff, _3 | _modall , _m1616 }, 323 135 { 0xe8, _cd | _modall , _rel32 }, 324 136 { 0xff, _2 | _32_bit | _modall , _r32 }, 137 { 0xff, _2 | _64_bit | _modall , _r64 }, 325 138 { 0xff, _2 | _modall , _m32 }, 139 { 0xff, _2 | _64_bit | _modall , _m64 }, 326 140 { 0x9a, _cp | _modall , _p1632 }, 327 141 { 0xff, _3 | _modall , _m1632 }, 328 142 { ASM_END, 0, 0 } 329 143 }; 330 144 331 145 PTRNTAB1 aptb1DEC[] = /* DEC */ { 332 146 { 0xfe, _1, _rm8 }, 333 147 { 0xff, _1 | _16_bit, _m16 }, // Also _r16 synonym 334 148 { 0xff, _1 | _32_bit, _m32 }, // Also _r32 synonym 149 { 0xff, _1 | _64_bit, _rm64 }, // Also _r64 synonym 335 150 { 0x48, _rw | _16_bit, _r16 | _plus_r }, 336 151 { 0x48, _rw | _32_bit, _r32 | _plus_r }, 337 152 { ASM_END, 0, 0 } 338 153 }; 339 154 340 155 PTRNTAB1 aptb1INC[] = /* INC */ { 341 156 { 0xfe, _0, _rm8 }, 342 157 { 0xff, _0 | _16_bit, _m16 }, // Also _r16 synonym 343 158 { 0xff, _0 | _32_bit, _m32 }, // Also _r32 synonym 159 { 0xff, _0 | _64_bit, _rm64 }, // Also _r64 synonym 344 160 { 0x40, _rw | _16_bit,_r16 | _plus_r }, 345 161 { 0x40, _rd | _32_bit,_r32 | _plus_r }, 346 162 { ASM_END, 0, 0 } 347 163 }; 348 164 // INT and INT 3 349 165 PTRNTAB1 aptb1INT[]= /* INT */ { 350 166 { 0xcc, 3, 0 }, // The ulFlags here are meant to 351 167 // be the value of the immediate 352 168 // operand 353 169 { 0xcd, 0, _imm8 }, 354 170 { ASM_END, 0, 0 } 355 171 }; 356 172 PTRNTAB1 aptb1INVLPG[] = /* INVLPG */ { // 486 only instruction 357 173 { 0x0f01, _I386|_7, _m8 | _m16 | _m32 | _m48 }, 358 174 { ASM_END, 0, 0 } 359 175 }; 360 176 361 PTRNTAB1 aptb1JB[] = /* JB */ { 362 { 0x72, _cb,_rel8 }, 363 { 0x0f82, _cw,_rel16 }, 364 { 0x0f82, _cd,_rel32 }, 365 { ASM_END, 0, 0 } 366 }; 367 PTRNTAB1 aptb1JBE[] = /* JBE */ { 368 { 0x76, _cb,_rel8 }, 369 { 0x0f86, _cw,_rel16 }, 370 { 0x0f86, _cd,_rel32 }, 371 { ASM_END, 0, 0 } 372 }; 177 #define OPTABLE(str,op) \ 178 PTRNTAB1 aptb1##str[] = { \ 179 { 0x70|op, _cb,_rel8 }, \ 180 { 0x0f80|op, _cw,_rel16 }, \ 181 { 0x0f80|op, _cd,_rel32 }, \ 182 { ASM_END, 0, 0 } \ 183 } 184 185 OPTABLE(JO,0); 186 OPTABLE(JNO,1); 187 OPTABLE(JB,2); 188 OPTABLE(JNB,3); 189 OPTABLE(JZ,4); 190 OPTABLE(JNZ,5); 191 OPTABLE(JBE,6); 192 OPTABLE(JNBE,7); 193 OPTABLE(JS,8); 194 OPTABLE(JNS,9); 195 OPTABLE(JP,0xA); 196 OPTABLE(JNP,0xB); 197 OPTABLE(JL,0xC); 198 OPTABLE(JNL,0xD); 199 OPTABLE(JLE,0xE); 200 OPTABLE(JNLE,0xF); 201 202 #undef OPTABLE 203 373 204 PTRNTAB1 aptb1JCXZ[] = /* JCXZ */ { 374 205 { 0xe3, _cb | _16_bit_addr,_rel8 }, 375 206 { ASM_END, 0, 0 } 376 207 }; 377 208 PTRNTAB1 aptb1JECXZ[] = /* JECXZ */ { 378 209 { 0xe3, _cb | _32_bit_addr | _I386,_rel8 }, 379 { ASM_END, 0, 0 }380 };381 PTRNTAB1 aptb1JZ[] = /* JZ */ {382 { 0x74, _cb,_rel8 },383 { 0x0f84, _cw,_rel16 },384 { 0x0f84, _cd,_rel32 },385 { ASM_END, 0, 0 }386 };387 PTRNTAB1 aptb1JL[] = /* JL */ {388 { 0x7c, _cb,_rel8 },389 { 0x0f8c, _cw,_rel16 },390 { 0x0f8c, _cd,_rel32 },391 { ASM_END, 0, 0 }392 };393 PTRNTAB1 aptb1JLE[] = /* JLE */ {394 { 0x7e, _cb,_rel8 },395 { 0x0f8e, _cw,_rel16 },396 { 0x0f8e, _cd,_rel32 },397 { ASM_END, 0, 0 }398 };399 PTRNTAB1 aptb1JNB[] = /* JNB */ {400 { 0x73, _cb,_rel8 },401 { 0x0f83, _cw,_rel16 },402 { 0x0f83, _cd,_rel32 },403 { ASM_END, 0, 0 }404 };405 PTRNTAB1 aptb1JNBE[] = /* JNBE */ {406 { 0x77, _cb,_rel8 },407 { 0x0f87, _cw,_rel16 },408 { 0x0f87, _cd,_rel32 },409 { ASM_END, 0, 0 }410 };411 PTRNTAB1 aptb1JNL[] = /* JNL */ {412 { 0x7d, _cb,_rel8 },413 { 0x0f8d, _cw,_rel16 },414 { 0x0f8d, _cd,_rel32 },415 { ASM_END, 0, 0 }416 };417 PTRNTAB1 aptb1JNLE[] = /* JNLE */ {418 { 0x7f, _cb,_rel8 },419 { 0x0f8f, _cw,_rel16 },420 { 0x0f8f, _cd,_rel32 },421 { ASM_END, 0, 0 }422 };423 PTRNTAB1 aptb1JNO[] = /* JNO */ {424 { 0x71, _cb,_rel8 },425 { 0x0f81, _cw,_rel16 },426 { 0x0f81, _cd,_rel32 },427 { ASM_END, 0, 0 }428 };429 PTRNTAB1 aptb1JNP[] = /* JNP */ {430 { 0x7b, _cb,_rel8 },431 { 0x0f8b, _cw,_rel16 },432 { 0x0f8b, _cd,_rel32 },433 { ASM_END, 0, 0 }434 };435 PTRNTAB1 aptb1JNS[] = /* JNS */ {436 { 0x79, _cb,_rel8 },437 { 0x0f89, _cw,_rel16 },438 { 0x0f89, _cd,_rel32 },439 { ASM_END, 0, 0 }440 };441 PTRNTAB1 aptb1JNZ[] = /* JNZ */ {442 { 0x75, _cb,_rel8 },443 { 0x0f85, _cw,_rel16 },444 { 0x0f85, _cd,_rel32 },445 { ASM_END, 0, 0 }446 };447 PTRNTAB1 aptb1JO[] = /* JO */ {448 { 0x70, _cb,_rel8 },449 { 0x0f80, _cw,_rel16 },450 { 0x0f80, _cd,_rel32 },451 { ASM_END, 0, 0 }452 };453 PTRNTAB1 aptb1JP[] = /* JP */ {454 { 0x7a, _cb,_rel8 },455 { 0x0f8a, _cw,_rel16 },456 { 0x0f8a, _cd,_rel32 },457 { ASM_END, 0, 0 }458 };459 PTRNTAB1 aptb1JS[] = /* JS */ {460 { 0x78, _cb,_rel8 },461 { 0x0f88, _cw,_rel16 },462 { 0x0f88, _cd,_rel32 },463 210 { ASM_END, 0, 0 } 464 211 }; 465 212 PTRNTAB1 aptb1JMP[] = /* JMP */ { 466 213 { 0xe9, _cw,_rel16 }, 467 214 { 0xe9, _cd,_rel32 }, 468 215 { 0xeb, _cb,_rel8 }, 469 216 { 0xff, _4 | _16_bit, _rm16 }, 470 217 { 0xea, _cd,_p1616 }, 471 218 { 0xff, _5, _m1616 }, 472 219 { 0xff, _4 | _32_bit, _rm32 }, 473 220 { 0xea, _cp,_p1632 }, 474 221 { 0xff, _5, _m1632 }, 475 222 { ASM_END, 0, 0 } 476 223 }; 477 224 PTRNTAB1 aptb1LGDT[] = /* LGDT */ { 478 225 { 0x0f01, _2, _m48 }, 479 226 { ASM_END, 0, 0 } 480 227 }; 481 228 PTRNTAB1 aptb1LIDT[] = /* LIDT */ { 482 229 { 0x0f01, _3, _m48 }, 483 230 { ASM_END, 0, 0 } 484 231 }; 485 232 PTRNTAB1 aptb1LLDT[] = /* LLDT */ { 486 233 { 0x0f00, _2|_modnot1, _rm16 }, 487 234 { ASM_END, 0, 0 } 488 235 }; 489 236 PTRNTAB1 aptb1LMSW[] = /* LMSW */ { 490 237 { 0x0f01, _6|_modnot1, _rm16 }, 491 238 { ASM_END, 0, 0 } 492 239 }; 493 240 PTRNTAB1 aptb1LODS[] = /* LODS */ { 494 241 { 0xac, _modax,_m8 }, 495 242 { 0xad, _16_bit | _modax,_m16 }, 496 243 { 0xad, _32_bit | _I386 | _modax,_m32 }, 497 244 { ASM_END, 0, 0 } 498 245 }; 499 246 PTRNTAB1 aptb1LOOP[] = /* LOOP */ { 500 247 { 0xe2, _cb | _modcx,_rel8 }, 501 248 { ASM_END, 0, 0 } 502 249 }; 503 PTRNTAB1 aptb1LOOPE[] = /* LOOPE */ {250 PTRNTAB1 aptb1LOOPE[] = /* LOOPE/LOOPZ */ { 504 251 { 0xe1, _cb | _modcx,_rel8 }, 505 252 { ASM_END, 0, 0 } 506 253 }; 507 PTRNTAB1 aptb1LOOPZ[] = /* LOOPZ */ { 508 { 0xe1, _cb | _modcx,_rel8 }, 509 { ASM_END, 0, 0 } 510 }; 511 PTRNTAB1 aptb1LOOPNE[] = /* LOOPNE */ { 512 { 0xe0, _cb | _modcx,_rel8 }, 513 { ASM_END, 0, 0 } 514 }; 515 PTRNTAB1 aptb1LOOPNZ[] = /* LOOPNZ */ { 254 PTRNTAB1 aptb1LOOPNE[] = /* LOOPNE/LOOPNZ */ { 516 255 { 0xe0, _cb | _modcx,_rel8 }, 517 256 { ASM_END, 0, 0 } 518 257 }; 519 258 PTRNTAB1 aptb1LTR[] = /* LTR */ { 520 259 { 0x0f00, _3|_modnot1, _rm16 }, 521 260 { ASM_END, 0, 0 } 522 261 }; 523 262 PTRNTAB1 aptb1NEG[] = /* NEG */ { 524 263 { 0xf6, _3, _rm8 }, 525 264 { 0xf7, _3 | _16_bit, _rm16 }, 526 265 { 0xf7, _3 | _32_bit, _rm32 }, 527 266 { 0xf7, _3 | _64_bit, _rm64 }, 528 267 { ASM_END, 0, 0 } 529 268 }; 530 269 PTRNTAB1 aptb1NOT[] = /* NOT */ { 531 270 { 0xf6, _2, _rm8 }, 532 271 { 0xf7, _2 | _16_bit, _rm16 }, 533 272 { 0xf7, _2 | _32_bit, _rm32 }, 273 { 0xf7, _2 | _64_bit, _rm64 }, 534 274 { ASM_END, 0, 0 } 535 275 }; 536 276 PTRNTAB1 aptb1POP[] = /* POP */ { 537 277 { 0x8f, _0 | _16_bit, _m16 }, 538 278 { 0x8f, _0 | _32_bit, _m32}, 539 279 { 0x58, _rw | _16_bit, _r16 | _plus_r }, 540 280 { 0x58, _rd | _32_bit, _r32 | _plus_r }, 541 281 { 0x58, _r | _64_bit, _r64 | _plus_r }, 542 282 { 0x1f, 0, _ds | _seg }, 543 283 { 0x07, _modes, _es | _seg}, 544 284 { 0x17, 0, _ss | _seg}, 545 285 { 0x0fa1, 0, _fs | _seg}, 546 286 { 0x0fa9, 0, _gs | _seg}, 547 287 { ASM_END, 0, 0 } 548 288 }; 549 289 PTRNTAB1 aptb1PUSH[] = /* PUSH */ { 550 290 { 0xff, _6 | _16_bit, _m16 }, 551 291 { 0xff, _6 | _32_bit, _m32 }, 552 292 { 0xff, _6 | _64_bit, _m64 }, 553 293 { 0x50, _r | _16_bit, _r16 | _plus_r }, … … 566 306 { 0x0fa8, 0,_gs | _seg}, 567 307 { ASM_END, 0, 0 } 568 308 }; 569 309 PTRNTAB1 aptb1RET[] = /* RET */ { 570 310 { 0xc3, 0, 0 }, 571 311 { 0xc2, _iw, _imm16 }, 572 312 { ASM_END, 0, 0 } 573 313 }; 574 314 PTRNTAB1 aptb1RETF[] = /* RETF */ { 575 315 { 0xcb, 0, 0 }, 576 316 { 0xca, _iw, _imm16 }, 577 317 { ASM_END, 0, 0 } 578 318 }; 579 319 PTRNTAB1 aptb1SCAS[] = /* SCAS */ { 580 320 { 0xae, _moddi, _m8 }, 581 321 { 0xaf, _16_bit | _moddi, _m16 }, 582 322 { 0xaf, _32_bit | _moddi, _m32 }, 583 323 { ASM_END, 0, 0 } 584 324 }; 585 325 586 PTRNTAB1 aptb1SETB[] = /* SETB */ { 587 { 0xf92, _cb, _rm8 }, 588 { ASM_END, 0, 0 } 589 }; 590 PTRNTAB1 aptb1SETBE[] = /* SETBE */ { 591 { 0xf96, _cb, _rm8 }, 592 { ASM_END, 0, 0 } 593 }; 594 PTRNTAB1 aptb1SETL[] = /* SETL */ { 595 { 0xf9c, _cb, _rm8 }, 596 { ASM_END, 0, 0 } 597 }; 598 PTRNTAB1 aptb1SETLE[] = /* SETLE */ { 599 { 0xf9e, _cb, _rm8 }, 600 { ASM_END, 0, 0 } 601 }; 602 PTRNTAB1 aptb1SETNB[] = /* SETNB */ { 603 { 0xf93, _cb, _rm8 }, 604 { ASM_END, 0, 0 } 605 }; 606 PTRNTAB1 aptb1SETNBE[] = /* SETNBE */ { 607 { 0xf97, _cb, _rm8 }, 608 { ASM_END, 0, 0 } 609 }; 610 PTRNTAB1 aptb1SETNL[] = /* SETNL */ { 611 { 0xf9d, _cb, _rm8 }, 612 { ASM_END, 0, 0 } 613 }; 614 PTRNTAB1 aptb1SETNLE[] = /* SETNLE */ { 615 { 0xf9f, _cb, _rm8 }, 616 { ASM_END, 0, 0 } 617 }; 618 PTRNTAB1 aptb1SETNO[] = /* SETNO */ { 619 { 0xf91, _cb, _rm8 }, 620 { ASM_END, 0, 0 } 621 }; 622 PTRNTAB1 aptb1SETNP[] = /* SETNP */ { 623 { 0xf9b, _cb, _rm8 }, 624 { ASM_END, 0, 0 } 625 }; 626 PTRNTAB1 aptb1SETNS[] = /* SETNS */ { 627 { 0xf99, _cb, _rm8 }, 628 { ASM_END, 0, 0 } 629 }; 630 PTRNTAB1 aptb1SETNZ[] = /* SETNZ */ { 631 { 0xf95, _cb, _rm8 }, 632 { ASM_END, 0, 0 } 633 }; 634 PTRNTAB1 aptb1SETO[] = /* SETO */ { 635 { 0xf90, _cb, _rm8 }, 636 { ASM_END, 0, 0 } 637 }; 638 PTRNTAB1 aptb1SETP[] = /* SETP */ { 639 { 0xf9a, _cb, _rm8 }, 640 { ASM_END, 0, 0 } 641 }; 642 PTRNTAB1 aptb1SETS[] = /* SETS */ { 643 { 0xf98, _cb, _rm8 }, 644 { ASM_END, 0, 0 } 645 }; 646 PTRNTAB1 aptb1SETZ[] = /* SETZ */ { 647 { 0xf94, _cb, _rm8 }, 648 { ASM_END, 0, 0 } 649 }; 326 #define OPTABLE(str,op) \ 327 PTRNTAB1 aptb1##str[] = { \ 328 { 0xf90|op, _cb, _rm8 }, \ 329 { ASM_END, 0, 0 } \ 330 } 331 332 OPTABLE(SETO,0); 333 OPTABLE(SETNO,1); 334 OPTABLE(SETB,2); 335 OPTABLE(SETNB,3); 336 OPTABLE(SETZ,4); 337 OPTABLE(SETNZ,5); 338 OPTABLE(SETBE,6); 339 OPTABLE(SETNBE,7); 340 OPTABLE(SETS,8); 341 OPTABLE(SETNS,9); 342 OPTABLE(SETP,0xA); 343 OPTABLE(SETNP,0xB); 344 OPTABLE(SETL,0xC); 345 OPTABLE(SETNL,0xD); 346 OPTABLE(SETLE,0xE); 347 OPTABLE(SETNLE,0xF); 348 349 #undef OPTABLE 350 650 351 PTRNTAB1 aptb1SGDT[]= /* SGDT */ { 651 352 { 0xf01, _0, _m48 }, 652 353 { ASM_END, 0, 0 } 653 354 }; 654 355 PTRNTAB1 aptb1SIDT[] = /* SIDT */ { 655 356 { 0xf01, _1, _m48 }, 656 357 { ASM_END, 0, 0 } 657 358 }; 658 359 PTRNTAB1 aptb1SLDT[] = /* SLDT */ { 659 360 { 0xf00, _0, _rm16 }, 660 361 { ASM_END, 0, 0 } 661 362 }; 662 363 PTRNTAB1 aptb1SMSW[] = /* SMSW */ { 663 364 { 0xf01, _4, _rm16 }, 664 365 { 0xf01, _4, _r32 }, 665 366 { ASM_END, 0, 0 } 666 367 }; 667 368 PTRNTAB1 aptb1STOS[] = /* STOS */ { 668 369 { 0xaa, _moddi, _m8 }, 669 370 { 0xab, _16_bit | _moddi, _m16 }, … … 674 375 { 0xf00, _1, _rm16 }, 675 376 { ASM_END, 0, 0 } 676 377 }; 677 378 PTRNTAB1 aptb1VERR[] = /* VERR */ { 678 379 { 0xf00, _4|_modnot1, _rm16 }, 679 380 { ASM_END, 0, 0 } 680 381 }; 681 382 PTRNTAB1 aptb1VERW[] = /* VERW */ { 682 383 { 0xf00, _5|_modnot1, _rm16 }, 683 384 { ASM_END, 0, 0 } 684 385 }; 685 386 PTRNTAB1 aptb1XLAT[] = /* XLAT */ { 686 387 { 0xd7, _modax, 0 }, 687 388 { 0xd7, _modax, _m8 }, 688 389 { ASM_END, 0, 0 } 689 390 }; 690 391 PTRNTAB1 aptb1CMPXCH8B[] = { 691 392 { 0x0fc7, _1 | _modaxdx | _I386 , _m64 }, 692 393 { ASM_END, 0, 0 } 693 394 }; 694 PTRNTAB2 aptb2ADC[] = /* ADC */ { 695 { 0x14, _ib, _al, _imm8 }, 696 { 0x83, _2|_ib|_16_bit, _rm16, _imm8 }, 697 { 0x15, _iw|_16_bit, _ax, _imm16 }, 698 { 0x83, _2|_ib|_32_bit, _rm32, _imm8 }, 699 { 0x15, _id|_32_bit, _eax, _imm32 }, 700 { 0x80, _2|_ib, _rm8, _imm8 }, 701 { 0x81, _2|_iw|_16_bit, _rm16, _imm16 }, 702 { 0x81, _2|_id|_32_bit, _rm32, _imm32 }, 703 { 0x10, _r, _rm8, _r8 }, 704 { 0x11, _r|_16_bit, _rm16, _r16 }, 705 { 0x11, _r|_32_bit, _rm32, _r32 }, 706 { 0x12, _r, _r8, _rm8 }, 707 { 0x13, _r|_16_bit, _r16, _rm16 }, 708 { 0x13, _r|_32_bit, _r32, _rm32 }, 709 { ASM_END, 0, 0, 0 } 710 }; 711 PTRNTAB2 aptb2ADD[] = /* ADD */ { 712 { 0x04, _ib, _al, _imm8 }, 713 { 0x83, _0|_ib|_16_bit, _rm16, _imm8 }, 714 { 0x05, _iw | _16_bit, _ax, _imm16 }, 715 { 0x83, _0|_ib|_32_bit, _rm32, _imm8 }, 716 { 0x05, _id | _32_bit, _eax, _imm32 }, 717 { 0x80, _0|_ib, _rm8, _imm8 }, 718 { 0x81, _0|_iw|_16_bit, _rm16, _imm16 }, 719 { 0x81, _0|_id|_32_bit, _rm32, _imm32 }, 720 { 0x00, _r, _rm8, _r8 }, 721 { 0x01, _r|_16_bit, _rm16, _r16 }, 722 { 0x01, _r|_32_bit, _rm32, _r32 }, 723 { 0x2, _r, _r8, _rm8 }, 724 { 0x3, _r|_16_bit, _r16, _rm16 }, 725 { 0x3, _r|_32_bit, _r32, _rm32 }, 726 { ASM_END, 0, 0, 0 } 727 }; 728 729 PTRNTAB2 aptb2AND[] = /* AND */ { 730 { 0x24, _ib, _al, _imm8 }, 731 { 0x83, _4|_ib|_16_bit, _rm16, _imm8 }, 732 { 0x25, _iw|_16_bit, _ax, _imm16 }, 733 { 0x83, _4|_ib|_32_bit, _rm32, _imm8 }, 734 { 0x25, _id|_32_bit, _eax, _imm32 }, 735 { 0x80, _4|_ib, _rm8, _imm8 }, 736 { 0x81, _4|_iw|_16_bit, _rm16, _imm16 }, 737 { 0x81, _4|_id|_32_bit, _rm32, _imm32 }, 738 { 0x20, _r, _rm8, _r8 }, 739 { 0x21, _r|_16_bit, _rm16, _r16 }, 740 { 0x21, _r|_32_bit, _rm32, _r32 }, 741 { 0x22, _r, _r8, _rm8 }, 742 { 0x23, _r|_16_bit, _r16, _rm16 }, 743 { 0x23, _r|_32_bit, _r32, _rm32 }, 744 { ASM_END, 0, 0, 0 } 745 }; 395 396 #define OPTABLE(str,op,rr,m) \ 397 PTRNTAB2 aptb2##str[] = { \ 398 { op+4, _ib|m, _al, _imm8 }, \ 399 { 0x83, rr|_ib|_16_bit|m, _rm16, _imm8 }, \ 400 { op+5, _iw|_16_bit|m, _ax, _imm16 }, \ 401 { 0x83, rr|_ib|_32_bit|m, _rm32, _imm8 }, \ 402 { 0x83, rr|_ib|_64_bit|m, _rm64, _imm8 }, \ 403 { op+5, _id|_32_bit|m, _eax, _imm32 }, \ 404 { op+5, _id|_64_bit|m, _rax, _imm32 }, \ 405 { 0x80, rr|_ib|m, _rm8, _imm8 }, \ 406 { 0x81, rr|_iw|_16_bit|m, _rm16, _imm16 }, \ 407 { 0x81, rr|_id|_32_bit|m, _rm32, _imm32 }, \ 408 { 0x81, rr|_id|_64_bit|m, _rm64, _imm32 }, \ 409 { op+0, _r|m, _rm8, _r8 }, \ 410 { op+1, _r|_16_bit|m, _rm16, _r16 }, \ 411 { op+1, _r|_32_bit|m, _rm32, _r32 }, \ 412 { op+1, _r|_64_bit|m, _rm64, _r64 }, \ 413 { op+2, _r|m, _r8, _rm8 }, \ 414 { op+3, _r|_16_bit|m, _r16, _rm16 }, \ 415 { op+3, _r|_32_bit|m, _r32, _rm32 }, \ 416 { op+3, _r|_64_bit|m, _r64, _rm64 }, \ 417 { ASM_END, 0, 0, 0 } \ 418 } 419 420 OPTABLE(ADD,0x00,_0,0); 421 OPTABLE(OR, 0x08,_1,0); 422 OPTABLE(ADC,0x10,_2,0); 423 OPTABLE(SBB,0x18,_3,0); 424 OPTABLE(AND,0x20,_4,0); 425 OPTABLE(SUB,0x28,_5,0); 426 OPTABLE(XOR,0x30,_6,0); 427 OPTABLE(CMP,0x38,_7,_modnot1); 428 429 #undef OPTABLE 430 746 431 PTRNTAB2 aptb2ARPL[] = /* ARPL */ { 747 432 { 0x63, _r, _rm16, _r16 }, 748 433 { ASM_END, 0, 0, 0 } 749 434 }; 750 435 PTRNTAB2 aptb2BOUND[] = /* BOUND */ { 751 436 { 0x62, _r|_16_bit|_modnot1,_r16,_m16 },// Should really b3 _m16_16 752 437 { 0x62, _r|_32_bit|_modnot1,_r32,_m32 },// Should really be _m32_32 753 438 { ASM_END, 0, 0, 0 } 754 439 }; 755 440 PTRNTAB2 aptb2BSF[] = /* BSF */ { 756 441 { 0x0fbc, _cw | _16_bit, _r16, _rm16 }, 757 442 { 0x0fbc, _cd|_32_bit, _r32, _rm32 }, 443 { 0x0fbc, _cd|_64_bit, _r64, _rm64 }, 758 444 { ASM_END, 0, 0, 0 } 759 445 }; 760 446 PTRNTAB2 aptb2BSR[] = /* BSR */ { 761 447 { 0x0fbd, _cw|_16_bit, _r16, _rm16 }, 762 448 { 0x0fbd, _cd|_32_bit, _r32, _rm32 }, 449 { 0x0fbd, _cd|_64_bit, _r64, _rm64 }, 763 450 { ASM_END, 0, 0, 0 } 764 451 }; 765 452 PTRNTAB2 aptb2BT[] = /* BT */ { 766 453 { 0x0fa3, _cw|_16_bit|_modnot1, _rm16, _r16 }, 767 454 { 0x0fa3, _cd|_32_bit|_modnot1, _rm32, _r32 }, 455 { 0x0fa3, _cd|_64_bit|_modnot1, _rm64, _r64 }, 768 456 { 0x0fba, _4|_ib|_16_bit|_modnot1, _rm16, _imm8 }, 769 457 { 0x0fba, _4|_ib|_32_bit|_modnot1, _rm32, _imm8 }, 458 { 0x0fba, _4|_ib|_64_bit|_modnot1, _rm64, _imm8 }, 770 459 { ASM_END, 0, 0, 0 } 771 460 }; 772 461 PTRNTAB2 aptb2BTC[] = /* BTC */ { 773 462 { 0x0fbb, _cw|_16_bit, _rm16, _r16 }, 774 463 { 0x0fbb, _cd|_32_bit, _rm32, _r32 }, 464 { 0x0fbb, _cd|_64_bit, _rm64, _r64 }, 775 465 { 0x0fba, _7|_ib|_16_bit, _rm16, _imm8 }, 776 466 { 0x0fba, _7|_ib|_32_bit, _rm32, _imm8 }, 467 { 0x0fba, _7|_ib|_64_bit, _rm64, _imm8 }, 777 468 { ASM_END, 0, 0, 0 } 778 469 }; 779 470 PTRNTAB2 aptb2BTR[] = /* BTR */ { 780 471 { 0x0fb3, _cw|_16_bit, _rm16, _r16 }, 781 472 { 0x0fb3, _cd|_32_bit, _rm32, _r32 }, 473 { 0x0fb3, _cd|_64_bit, _rm64, _r64 }, 782 474 { 0x0fba, _6|_ib|_16_bit, _rm16, _imm8 }, 783 475 { 0x0fba, _6|_ib|_32_bit, _rm32, _imm8 }, 476 { 0x0fba, _6|_ib|_64_bit, _rm64, _imm8 }, 784 477 { ASM_END, 0, 0, 0 } 785 478 }; 786 479 PTRNTAB2 aptb2BTS[] = /* BTS */ { 787 480 { 0x0fab, _cw|_16_bit, _rm16, _r16 }, 788 481 { 0x0fab, _cd|_32_bit, _rm32, _r32 }, 482 { 0x0fab, _cd|_64_bit, _rm64, _r64 }, 789 483 { 0x0fba, _5|_ib|_16_bit, _rm16, _imm8 }, 790 484 { 0x0fba, _5|_ib|_32_bit, _rm32, _imm8 }, 791 { ASM_END, 0, 0, 0 } 792 }; 793 PTRNTAB2 aptb2CMP[] = /* CMP */ { 794 { 0x3c, _ib|_modnot1, _al, _imm8 }, 795 { 0x83, _7|_ib|_16_bit|_modnot1, _rm16, _imm8 }, 796 { 0x3d, _iw|_16_bit|_modnot1, _ax, _imm16 }, 797 { 0x83, _7|_ib|_32_bit|_modnot1, _rm32, _imm8 }, 798 { 0x3d, _id|_32_bit|_modnot1, _eax, _imm32 }, 799 { 0x80, _7|_ib|_modnot1, _rm8, _imm8 }, 800 { 0x81, _7|_iw|_16_bit|_modnot1, _rm16, _imm16 }, 801 { 0x81, _7|_id|_32_bit|_modnot1, _rm32, _imm32 }, 802 { 0x38, _r|_modnot1, _rm8, _r8 }, 803 { 0x39, _r|_16_bit|_modnot1, _rm16, _r16 }, 804 { 0x39, _r|_32_bit|_modnot1, _rm32, _r32 }, 805 { 0x3a, _r|_modnot1, _r8, _rm8 }, 806 { 0x3b, _r|_16_bit|_modnot1, _r16, _rm16 }, 807 { 0x3b, _r|_32_bit|_modnot1, _r32, _rm32 }, 485 { 0x0fba, _5|_ib|_64_bit, _rm64, _imm8 }, 808 486 { ASM_END, 0, 0, 0 } 809 487 }; 810 488 PTRNTAB2 aptb2CMPS[] = /* CMPS */ { 811 489 { 0xa6, _modsidi, _m8, _m8 }, 812 490 { 0xa7, _modsidi, _m16, _m16 }, 813 491 { 0xa7, _modsidi, _m32, _m32 }, 814 492 { ASM_END, 0, 0, 0 } 815 493 }; 816 494 PTRNTAB2 aptb2CMPXCHG[] = /* CMPXCHG */ { 817 495 { 0xfb0, _I386 | _cb|_mod2, _rm8, _r8 }, 818 496 // This is really a 486 only 819 497 // instruction 820 498 { 0xfb1, _I386 | _cw | _16_bit|_mod2, _rm16, _r16 }, 821 499 { 0xfb1, _I386 | _cd | _32_bit|_mod2, _rm32, _r32 }, 822 500 { 0xfb1, _I386 | _cq | _64_bit|_mod2, _rm64, _r64 }, 823 501 { ASM_END, 0, 0, 0 } 824 502 }; 825 503 PTRNTAB2 aptb2DIV[] = /* DIV */ { 826 504 { 0xf6, _6, _al, _rm8 }, 827 505 { 0xf7, _6 | _16_bit | _moddx, _ax, _rm16 }, … … 913 591 { 0xa0, 0, _al, _moffs8 }, 914 592 { 0xa1, _16_bit, _ax, _moffs16 }, 915 593 { 0xa1, _32_bit, _eax, _moffs32 }, 916 594 { 0xa2, 0, _moffs8, _al }, 917 595 { 0xa3, _16_bit, _moffs16, _ax }, 918 596 { 0xa3, _32_bit, _moffs32, _eax }, 919 597 #endif 920 598 { 0x88, _r, _rm8, _r8 }, 921 599 { 0x89, _r|_16_bit, _rm16, _r16 }, 922 600 { 0x89, _r|_32_bit, _rm32, _r32 }, 923 601 { 0x89, _r|_64_bit, _rm64, _r64 }, 924 602 { 0x8a, _r, _r8, _rm8 }, 925 603 { 0x8b, _r|_16_bit, _r16, _rm16 }, 926 604 { 0x8b, _r|_32_bit, _r32, _rm32 }, 927 605 { 0x8b, _r|_64_bit, _r64, _rm64 }, 928 606 { 0x8c, _r, _rm16, _seg|_ds|_es| _ss | _fs | _gs | _cs }, 929 607 { 0x8e, _r, _seg|_ds|_es|_ss|_fs|_gs|_cs, _rm16 }, 930 608 { 0xb0, _rb, _r8 | _plus_r, _imm8 }, 931 609 { 0xb8, _rw | _16_bit, _r16 | _plus_r, _imm16 }, 932 610 { 0xb8, _rd|_32_bit, _r32 | _plus_r, _imm32 }, 611 { 0xb8, _rd|_64_bit, _r64 | _plus_r, _imm32 }, 933 612 { 0xc6, _cb, _rm8, _imm8 }, 934 613 { 0xc7, _cw|_16_bit, _rm16, _imm16 }, 935 614 { 0xc7, _cd|_32_bit, _rm32, _imm32 }, 936 615 #if 0 // Let pinholeopt() do this 937 616 { 0xc6, _cb, _moffs8, _imm8 }, 938 617 { 0xc7, _cw|_16_bit, _moffs16, _imm16 }, 939 618 { 0xc7, _cd|_32_bit, _moffs32, _imm32 }, 940 619 #endif 941 620 { 0x0f20, _r, _r32, _special | _crn }, 942 621 { 0x0f22, _r, _special|_crn, _r32 }, 943 622 { 0x0f21, _r, _r32, _special | _drn }, 944 623 { 0x0f23, _r, _special|_drn, _r32 }, 945 624 { 0x0f24, _r, _r32, _special | _trn }, 946 625 { 0x0f26, _r, _special|_trn, _r32 }, 947 626 { ASM_END, 0, 0, 0 } 948 627 }; 949 628 950 629 PTRNTAB2 aptb2MOVS[] = { 951 630 { 0xa4, _modsidi , _m8, _m8 }, 952 631 { 0xa5, _modsidi | _16_bit, _m16, _m16 }, … … 969 648 { 0x0fb6, _r|_32_bit, _r32, _rm8 }, 970 649 #if 1 971 650 { 0x0fb7, _r|_16_bit, _r16, _rm16 }, 972 651 { 0x0fb7, _r|_32_bit, _r32, _rm16 }, 973 652 #else 974 653 { 0x0fb7, _r, _r32, _rm16 }, 975 654 #endif 976 655 { ASM_END, 0, 0, 0 } 977 656 }; 978 657 PTRNTAB2 aptb2MUL[] = /* MUL */ { 979 658 { 0xf6, _4, _al, _rm8 }, 980 659 { 0xf7, _4|_16_bit|_moddx, _ax, _rm16 }, 981 660 { 0xf7, _4|_32_bit|_moddx, _eax, _rm32 }, 982 661 { 0xf7, _4|_64_bit|_moddx, _rax, _rm64 }, 983 662 { 0xf6, _4|_modax, _rm8, 0 }, 984 663 { 0xf7, _4|_16_bit|_modaxdx, _rm16, 0 }, 985 664 { 0xf7, _4|_32_bit|_modaxdx, _rm32, 0 }, 986 665 { 0xf7, _4|_64_bit|_modaxdx, _rm64, 0 }, 987 666 { ASM_END, 0, 0, 0 } 988 667 }; 989 PTRNTAB2 aptb2OR[] = /* OR */ {990 { 0x0c, _ib, _al, _imm8 },991 { 0x83, _1|_ib|_16_bit, _rm16, _imm8 },992 { 0x0d, _iw|_16_bit, _ax, _imm16 },993 { 0x83, _1|_ib|_32_bit, _rm32, _imm8 },994 { 0x0d, _id|_32_bit, _eax, _imm32 },995 { 0x80, _1|_ib, _rm8, _imm8 },996 { 0x81, _1|_iw|_16_bit, _rm16, _imm16 },997 { 0x81, _1|_id|_32_bit, _rm32, _imm32 },998 { 0x08, _r, _rm8, _r8 },999 { 0x09, _r|_16_bit, _rm16, _r16 },1000 { 0x09, _r|_32_bit, _rm32, _r32 },1001 { 0x0a, _r, _r8, _rm8 },1002 { 0x0b, _r|_16_bit, _r16, _rm16 },1003 { 0x0b, _r|_32_bit, _r32, _rm32 },1004 { ASM_END, 0, 0, 0 }1005 };1006 668 PTRNTAB2 aptb2OUT[] = { 1007 669 { 0xe6, _ib, _imm8, _al }, 1008 670 { 0xe7, _ib|_16_bit, _imm8, _ax }, 1009 671 { 0xe7, _ib|_32_bit, _imm8, _eax }, 1010 672 { 0xee, _modnot1, _dx, _al }, 1011 673 { 0xef, _16_bit|_modnot1, _dx, _ax }, 1012 674 { 0xef, _32_bit|_modnot1, _dx, _eax }, 1013 675 { ASM_END, 0, 0, 0 } 1014 676 }; 1015 677 PTRNTAB2 aptb2OUTS[] = /* OUTS */ { 1016 678 { 0x6e, _modsinot1, _dx, _rm8 }, 1017 679 { 0x6f, _16_bit | _I386 |_modsinot1, _dx, _rm16 }, 1018 680 { 0x6f, _32_bit | _I386| _modsinot1, _dx, _rm32 }, 1019 681 { ASM_END, 0, 0, 0 } 1020 682 }; 1021 PTRNTAB2 aptb2RCL[] = /* RCL */{ 1022 // { 0xd0, _2, _rm8, 0 }, 1023 { 0xd2, _2, _rm8, _cl }, 1024 { 0xc0, _2|_ib, _rm8, _imm8 }, 1025 // { 0xd1, _2|_16_bit, _rm16, 0 }, 1026 { 0xd3, _2|_16_bit, _rm16, _cl }, 1027 { 0xc1, _2|_ib|_16_bit, _rm16, _imm8 }, 1028 // { 0xd1, _2|_32_bit, _rm32, 0 }, 1029 { 0xd3, _2|_32_bit, _rm32, _cl }, 1030 { 0xc1, _2|_ib|_32_bit, _rm32, _imm8, }, 1031 { ASM_END, 0, 0, 0 } 1032 }; 1033 PTRNTAB2 aptb2RCR[] = /* RCR */ { 1034 // { 0xd0, _3, _rm8, 0 }, 1035 { 0xd2, _3, _rm8, _cl }, 1036 { 0xc0, _3|_ib, _rm8, _imm8 }, 1037 // { 0xd1, _3|_16_bit, _rm16, 0 }, 1038 { 0xd3, _3|_16_bit, _rm16, _cl }, 1039 { 0xc1, _3|_ib|_16_bit, _rm16, _imm8 }, 1040 // { 0xd1, _3|_32_bit, _rm32, 0 }, 1041 { 0xd3, _3|_32_bit, _rm32, _cl }, 1042 { 0xc1, _3|_ib|_32_bit, _rm32, _imm8 }, 1043 { ASM_END, 0, 0, 0 } 1044 }; 1045 PTRNTAB2 aptb2ROL[] = /* ROL */ { 1046 // { 0xd0, _0, _rm8, 0 }, 1047 { 0xd2, _0, _rm8, _cl }, 1048 { 0xc0, _0, _rm8, _imm8 }, 1049 // { 0xd1, _0|_16_bit, _rm16, 0 }, 1050 { 0xd3, _0|_16_bit, _rm16, _cl }, 1051 { 0xc1, _0|_16_bit, _rm16, _imm8 }, 1052 // { 0xd1, _0|_32_bit, _rm32, 0 }, 1053 { 0xd3, _0|_32_bit, _rm32, _cl }, 1054 { 0xc1, _0|_32_bit, _rm32, _imm8 }, 1055 { ASM_END, 0, 0, 0 } 1056 }; 1057 PTRNTAB2 aptb2ROR[] = /* ROR */ { 1058 // { 0xd0, _1, _rm8, 0 }, 1059 { 0xd2, _1, _rm8, _cl }, 1060 { 0xc0, _1, _rm8, _imm8 }, 1061 // { 0xd1, _1|_16_bit, _rm16, 0 }, 1062 { 0xd3, _1|_16_bit, _rm16, _cl }, 1063 { 0xc1, _1|_16_bit, _rm16, _imm8 }, 1064 // { 0xd1, _1|_32_bit, _rm32, 0 }, 1065 { 0xd3, _1|_32_bit, _rm32, _cl }, 1066 { 0xc1, _1|_32_bit, _rm32, _imm8 }, 1067 { ASM_END, 0, 0, 0 } 1068 }; 1069 PTRNTAB2 aptb2SAL[] = /* SAL */ { 1070 // { 0xd0, _4, _rm8, 0 }, 1071 { 0xd2, _4, _rm8, _cl }, 1072 { 0xc0, _4, _rm8, _imm8 }, 1073 // { 0xd1, _4|_16_bit, _rm16, 0 }, 1074 { 0xd3, _4|_16_bit, _rm16, _cl }, 1075 { 0xc1, _4|_16_bit, _rm16, _imm8 }, 1076 // { 0xd1, _4|_32_bit, _rm32, 0 }, 1077 { 0xd3, _4|_32_bit, _rm32, _cl }, 1078 { 0xc1, _4|_32_bit, _rm32, _imm8 }, 1079 { ASM_END, 0, 0, 0 } 1080 }; 1081 PTRNTAB2 aptb2SBB[] = /* SBB */ { 1082 { 0x1c, _ib, _al, _imm8 }, 1083 { 0x83, _3|_16_bit, _rm16, _imm8 }, 1084 { 0x1d, _iw|_16_bit, _ax, _imm16 }, 1085 { 0x83, _3|_32_bit, _rm32, _imm8 }, 1086 { 0x1d, _id|_32_bit, _eax, _imm32 }, 1087 { 0x80, _3 | _ib, _rm8, _imm8 }, 1088 { 0x81, _3 | _iw|_16_bit, _rm16, _imm16 }, 1089 { 0x81, _3 | _id|_32_bit, _rm32, _imm32 }, 1090 { 0x18, _r, _rm8, _r8 }, 1091 { 0x19, _r|_16_bit, _rm16, _r16 }, 1092 { 0x19, _r|_32_bit, _rm32, _r32 }, 1093 { 0x1A, _r, _r8, _rm8 }, 1094 { 0x1B, _r|_16_bit, _r16, _rm16 }, 1095 { 0x1B, _r|_32_bit, _r32, _rm32 }, 1096 { ASM_END, 0, 0, 0 } 1097 }; 1098 1099 1100 PTRNTAB2 aptb2SAR[] = /* SAR */ { 1101 // { 0xd0, _7, _rm8, 0 }, 1102 { 0xd2, _7, _rm8, _cl }, 1103 { 0xc0, _7, _rm8, _imm8 }, 1104 // { 0xd1, _7|_16_bit, _rm16, 0 }, 1105 { 0xd3, _7|_16_bit, _rm16, _cl }, 1106 { 0xc1, _7|_16_bit, _rm16, _imm8 }, 1107 // { 0xd1, _7|_32_bit, _rm32, 0 }, 1108 { 0xd3, _7|_32_bit, _rm32, _cl }, 1109 { 0xc1, _7|_32_bit, _rm32, _imm8 }, 1110 { ASM_END, 0, 0, 0 } 1111 }; 1112 PTRNTAB2 aptb2SHL[] = /* SHL */ { 1113 // { 0xd0, _4, _rm8, 0 }, 1114 { 0xd2, _4, _rm8, _cl }, 1115 { 0xc0, _4, _rm8, _imm8 }, 1116 // { 0xd1, _4|_16_bit, _rm16, 0 }, 1117 { 0xd3, _4|_16_bit, _rm16, _cl }, 1118 { 0xc1, _4|_16_bit, _rm16, _imm8 }, 1119 // { 0xd1, _4|_32_bit, _rm32, 0 }, 1120 { 0xd3, _4|_32_bit, _rm32, _cl }, 1121 { 0xc1, _4|_32_bit, _rm32, _imm8 }, 1122 { ASM_END, 0, 0, 0 } 1123 }; 1124 PTRNTAB2 aptb2SHR[] = /* SHR */ { 1125 // { 0xd0, _5, _rm8, 0 }, 1126 { 0xd2, _5, _rm8, _cl }, 1127 { 0xc0, _5, _rm8, _imm8 }, 1128 // { 0xd1, _5|_16_bit, _rm16, 0 }, 1129 { 0xd3, _5|_16_bit, _rm16, _cl }, 1130 { 0xc1, _5|_16_bit, _rm16, _imm8 }, 1131 // { 0xd1, _5|_32_bit, _rm32, 0 }, 1132 { 0xd3, _5|_32_bit, _rm32, _cl }, 1133 { 0xc1, _5|_32_bit, _rm32, _imm8 }, 1134 { ASM_END, 0, 0, 0 } 1135 }; 1136 PTRNTAB2 aptb2SUB[] = /* SUB */ { 1137 { 0x2c, _ib, _al, _imm8 }, 1138 { 0x83, _5|_16_bit, _rm16, _imm8 }, 1139 { 0x2d, _iw|_16_bit, _ax, _imm16 }, 1140 { 0x83, _5|_32_bit, _rm32, _imm8 }, 1141 { 0x2d, _id|_32_bit, _eax, _imm32 }, 1142 { 0x80, _5 | _ib, _rm8, _imm8 }, 1143 { 0x81, _5 | _iw|_16_bit, _rm16, _imm16 }, 1144 { 0x81, _5 | _id|_32_bit, _rm32, _imm32 }, 1145 { 0x28, _r, _rm8, _r8 }, 1146 { 0x29, _r|_16_bit, _rm16, _r16 }, 1147 { 0x29, _r|_32_bit, _rm32, _r32 }, 1148 { 0x2A, _r, _r8, _rm8 }, 1149 { 0x2B, _r|_16_bit, _r16, _rm16 }, 1150 { 0x2B, _r|_32_bit, _r32, _rm32 }, 1151 { ASM_END, 0, 0, 0 } 1152 }; 683 684 #define OPTABLE(str,op) \ 685 PTRNTAB2 aptb2##str[] = { \ 686 { 0xd2, op, _rm8, _cl }, \ 687 { 0xc0, op|_ib, _rm8, _imm8 }, \ 688 { 0xd3, op|_16_bit, _rm16, _cl }, \ 689 { 0xc1, op|_ib|_16_bit, _rm16, _imm8 }, \ 690 { 0xd3, op|_32_bit, _rm32, _cl }, \ 691 { 0xc1, op|_ib|_32_bit, _rm32, _imm8, }, \ 692 { 0xd3, op|_64_bit, _rm64, _cl }, \ 693 { 0xc1, op|_ib|_64_bit, _rm64, _imm8, }, \ 694 { ASM_END, 0, 0, 0 } \ 695 } 696 697 OPTABLE(ROL,_0); 698 OPTABLE(ROR,_1); 699 OPTABLE(RCL,_2); 700 OPTABLE(RCR,_3); 701 OPTABLE(SHL,_4); 702 OPTABLE(SHR,_5); 703 OPTABLE(SAR,_7); 704 705 #undef OPTABLE 706 1153 707 PTRNTAB2 aptb2TEST[] = /* TEST */ { 1154 708 { 0xa8, _ib|_modnot1, _al, _imm8 }, 1155 709 { 0xa9, _iw|_16_bit|_modnot1, _ax, _imm16 }, 1156 710 { 0xa9, _id|_32_bit|_modnot1, _eax, _imm32 }, 1157 711 { 0xf6, _0|_modnot1, _rm8, _imm8 }, 1158 712 { 0xf7, _0|_16_bit|_modnot1, _rm16, _imm16 }, 1159 713 { 0xf7, _0|_32_bit|_modnot1, _rm32, _imm32 }, 1160 714 { 0x84, _r|_modnot1, _rm8, _r8 }, 1161 715 { 0x85, _r|_16_bit|_modnot1, _rm16, _r16 }, 1162 716 { 0x85, _r|_32_bit|_modnot1, _rm32, _r32 }, 1163 717 { ASM_END, 0, 0, 0 } 1164 718 }; 1165 719 PTRNTAB2 aptb2XADD[] = /* XADD */ { // 486 only instruction 1166 720 // { 0x0fc0, _ib | _I386|_mod2, _rm8, _r8 }, 1167 721 // { 0x0fc1, _iw | _I386|_16_bit|_mod2, _rm16, _r16 }, 1168 722 // { 0x0fc1, _id | _I386|_32_bit|_mod2, _rm32, _r32 }, 1169 723 { 0x0fc0, _r | _I386|_mod2, _rm8, _r8 }, 1170 724 { 0x0fc1, _r | _I386|_16_bit|_mod2, _rm16, _r16 }, 1171 725 { 0x0fc1, _r | _I386|_32_bit|_mod2, _rm32, _r32 }, 1172 726 { ASM_END, 0, 0, 0 } 1173 727 }; 1174 728 PTRNTAB2 aptb2XCHG[] = /* XCHG */ { 1175 729 { 0x90, _r|_16_bit|_mod2, _ax , _r16 | _plus_r }, 1176 730 { 0x90, _r|_16_bit|_mod2, _r16 | _plus_r, _ax }, 1177 731 { 0x90, _r|_32_bit|_mod2, _eax, _r32 | _plus_r }, 1178 732 { 0x90, _r|_32_bit|_mod2, _r32 | _plus_r, _eax }, 1179 733 { 0x86, _r|_mod2, _rm8, _r8 }, 1180 734 { 0x86, _r|_mod2, _r8, _rm8 }, 1181 735 { 0x87, _r|_16_bit|_mod2, _rm16, _r16 }, 1182 736 { 0x87, _r|_16_bit|_mod2, _r16, _rm16 }, 1183 737 { 0x87, _r|_32_bit|_mod2, _rm32, _r32 }, 1184 738 { 0x87, _r|_32_bit|_mod2, _r32, _rm32 }, 1185 739 { ASM_END, 0, 0, 0 } 1186 740 }; 1187 PTRNTAB2 aptb2XOR[] = { 1188 { 0x34, _ib, _al, _imm8 }, 1189 { 0x83, _6|_16_bit, _rm16, _imm8 }, 1190 { 0x35, _iw|_16_bit, _ax, _imm16 }, 1191 { 0x83, _6|_32_bit, _rm32, _imm8 }, 1192 { 0x35, _id|_32_bit, _eax, _imm32 }, 1193 { 0x80, _6, _rm8, _imm8 }, 1194 { 0x81, _6|_16_bit, _rm16, _imm16 }, 1195 { 0x81, _6|_32_bit, _rm32, _imm32 }, 1196 { 0x30, _r, _rm8, _r8 }, 1197 { 0x31, _r|_16_bit, _rm16, _r16 }, 1198 { 0x31, _r|_32_bit, _rm32, _r32 }, 1199 { 0x32, _r, _r8, _rm8 }, 1200 { 0x33, _r|_16_bit, _r16, _rm16 }, 1201 { 0x33, _r|_32_bit, _r32, _rm32 }, 1202 { ASM_END, 0, 0, 0 } 1203 }; 1204 1205 PTRNTAB2 aptb2CMOVO[] = { 1206 { 0x0F40, _r|_16_bit, _r16, _rm16 }, 1207 { 0x0F40, _r|_32_bit, _r32, _rm32 }, 1208 { ASM_END, 0, 0, 0 } 1209 }; 1210 PTRNTAB2 aptb2CMOVNO[] = { 1211 { 0x0F41, _r|_16_bit, _r16, _rm16 }, 1212 { 0x0F41, _r|_32_bit, _r32, _rm32 }, 1213 { ASM_END, 0, 0, 0 } 1214 }; 1215 PTRNTAB2 aptb2CMOVB[] = { 1216 { 0x0F42, _r|_16_bit, _r16, _rm16 }, 1217 { 0x0F42, _r|_32_bit, _r32, _rm32 }, 1218 { ASM_END, 0, 0, 0 } 1219 }; 1220 PTRNTAB2 aptb2CMOVNB[] = { 1221 { 0x0F43, _r|_16_bit, _r16, _rm16 }, 1222 { 0x0F43, _r|_32_bit, _r32, _rm32 }, 1223 { ASM_END, 0, 0, 0 } 1224 }; 1225 PTRNTAB2 aptb2CMOVZ[] = { 1226 { 0x0F44, _r|_16_bit, _r16, _rm16 }, 1227 { 0x0F44, _r|_32_bit, _r32, _rm32 }, 1228 { ASM_END, 0, 0, 0 } 1229 }; 1230 PTRNTAB2 aptb2CMOVNZ[] = { 1231 { 0x0F45, _r|_16_bit, _r16, _rm16 }, 1232 { 0x0F45, _r|_32_bit, _r32, _rm32 }, 1233 { ASM_END, 0, 0, 0 } 1234 }; 1235 PTRNTAB2 aptb2CMOVBE[] = { 1236 { 0x0F46, _r|_16_bit, _r16, _rm16 }, 1237 { 0x0F46, _r|_32_bit, _r32, _rm32 }, 1238 { ASM_END, 0, 0, 0 } 1239 }; 1240 PTRNTAB2 aptb2CMOVNBE[] = { 1241 { 0x0F47, _r|_16_bit, _r16, _rm16 }, 1242 { 0x0F47, _r|_32_bit, _r32, _rm32 }, 1243 { ASM_END, 0, 0, 0 } 1244 }; 1245 PTRNTAB2 aptb2CMOVS[] = { 1246 { 0x0F48, _r|_16_bit, _r16, _rm16 }, 1247 { 0x0F48, _r|_32_bit, _r32, _rm32 }, 1248 { ASM_END, 0, 0, 0 } 1249 }; 1250 PTRNTAB2 aptb2CMOVNS[] = { 1251 { 0x0F49, _r|_16_bit, _r16, _rm16 }, 1252 { 0x0F49, _r|_32_bit, _r32, _rm32 }, 1253 { ASM_END, 0, 0, 0 } 1254 }; 1255 PTRNTAB2 aptb2CMOVP[] = { 1256 { 0x0F4A, _r|_16_bit, _r16, _rm16 }, 1257 { 0x0F4A, _r|_32_bit, _r32, _rm32 }, 1258 { ASM_END, 0, 0, 0 } 1259 }; 1260 PTRNTAB2 aptb2CMOVNP[] = { 1261 { 0x0F4B, _r|_16_bit, _r16, _rm16 }, 1262 { 0x0F4B, _r|_32_bit, _r32, _rm32 }, 1263 { ASM_END, 0, 0, 0 } 1264 }; 1265 PTRNTAB2 aptb2CMOVL[] = { 1266 { 0x0F4C, _r|_16_bit, _r16, _rm16 }, 1267 { 0x0F4C, _r|_32_bit, _r32, _rm32 }, 1268 { ASM_END, 0, 0, 0 } 1269 }; 1270 PTRNTAB2 aptb2CMOVNL[] = { 1271 { 0x0F4D, _r|_16_bit, _r16, _rm16 }, 1272 { 0x0F4D, _r|_32_bit, _r32, _rm32 }, 1273 { ASM_END, 0, 0, 0 } 1274 }; 1275 PTRNTAB2 aptb2CMOVLE[] = { 1276 { 0x0F4E, _r|_16_bit, _r16, _rm16 }, 1277 { 0x0F4E, _r|_32_bit, _r32, _rm32 }, 1278 { ASM_END, 0, 0, 0 } 1279 }; 1280 PTRNTAB2 aptb2CMOVNLE[] = { 1281 { 0x0F4F, _r|_16_bit, _r16, _rm16 }, 1282 { 0x0F4F, _r|_32_bit, _r32, _rm32 }, 1283 { ASM_END, 0, 0, 0 } 1284 }; 741 742 #define OPTABLE(str,op) \ 743 PTRNTAB2 aptb2##str[] = { \ 744 { 0x0F40|op, _r|_16_bit, _r16, _rm16 }, \ 745 { 0x0F40|op, _r|_32_bit, _r32, _rm32 }, \ 746 { 0x0F40|op, _r|_64_bit, _r64, _rm64 }, \ 747 { ASM_END, 0, 0, 0 } \ 748 } 749 750 OPTABLE(CMOVO,0); 751 OPTABLE(CMOVNO,1); 752 OPTABLE(CMOVB,2); 753 OPTABLE(CMOVNB,3); 754 OPTABLE(CMOVZ,4); 755 OPTABLE(CMOVNZ,5); 756 OPTABLE(CMOVBE,6); 757 OPTABLE(CMOVNBE,7); 758 OPTABLE(CMOVS,8); 759 OPTABLE(CMOVNS,9); 760 OPTABLE(CMOVP,0xA); 761 OPTABLE(CMOVNP,0xB); 762 OPTABLE(CMOVL,0xC); 763 OPTABLE(CMOVNL,0xD); 764 OPTABLE(CMOVLE,0xE); 765 OPTABLE(CMOVNLE,0xF); 766 767 #undef OPTABLE 1285 768 1286 769 PTRNTAB3 aptb3IMUL[] = /* IMUL */ { 1287 770 { 0x0faf, _r|_16_bit, _r16, _rm16, 0 }, 1288 771 { 0x0faf, _r|_32_bit, _r32, _rm32, 0 }, 1289 772 { 0x0faf, _r|_64_bit, _r64, _rm64, 0 }, 1290 773 { 0xf6, _5|_modax, _rm8, 0, 0 }, 1291 774 { 0xf7, _5|_16_bit|_modaxdx, _rm16, 0, 0 }, 1292 775 { 0xf7, _5|_32_bit|_modaxdx, _rm32, 0, 0 }, 1293 776 { 0xf7, _5|_64_bit|_modaxdx, _rm64, 0, 0 }, 1294 777 { 0x6b, _r|_ib|_16_bit, _r16, _imm8, 0 }, 1295 778 { 0x6b, _r|_ib|_32_bit, _r32, _imm8, 0 }, 1296 779 { 0x69, _r|_iw|_16_bit, _r16, _imm16, 0 }, 1297 780 { 0x69, _r|_id|_32_bit, _r32, _imm32, 0 }, 1298 781 { 0x69, _r|_id|_64_bit, _r64, _imm32, 0 }, 1299 782 { 0x6b, _r|_ib|_16_bit, _r16, _rm16, _imm8 }, 1300 783 { 0x6b, _r|_ib|_32_bit, _r32, _rm32, _imm8 }, 1301 784 { 0x6b, _r|_ib|_64_bit, _r64, _rm64, _imm8 }, 1302 785 { 0x69, _r|_iw|_16_bit, _r16, _rm16, _imm16 }, 1303 786 { 0x69, _r|_id|_32_bit, _r32, _rm32, _imm32 }, 1304 787 { 0x69, _r|_id|_64_bit, _r64, _rm64, _imm32 }, 1305 788 { ASM_END, 0, 0, 0 } 1306 789 }; 1307 790 PTRNTAB3 aptb3SHLD[] = /* SHLD */ { 1308 791 { 0x0fa4, _cw|_16_bit, _rm16, _r16, _imm8 }, 1309 792 { 0x0fa4, _cd|_32_bit, _rm32, _r32, _imm8 }, 1310 793 { 0x0fa5, _cw|_16_bit, _rm16, _r16, _cl }, 1311 794 { 0x0fa5, _cd|_32_bit, _rm32, _r32, _cl }, 1312 795 { ASM_END, 0, 0, 0 } 1313 796 }; 1314 797 PTRNTAB3 aptb3SHRD[] = /* SHRD */ { 1315 798 { 0x0fac, _cw|_16_bit, _rm16, _r16, _imm8 }, 1316 799 { 0x0fac, _cd|_32_bit, _rm32, _r32, _imm8 }, 1317 800 { 0x0fad, _cw|_16_bit, _rm16, _r16, _cl }, 1318 801 { 0x0fad, _cd|_32_bit, _rm32, _r32, _cl }, 1319 802 { ASM_END, 0, 0, 0 } 1320 803 }; 1321 804 // 1322 805 // Floating point instructions which have entirely different flag 1323 806 // interpretations 1324 807 // 1325 PTRNTAB0 aptb0F2XM1[] = /* F2XM1 */ { 1326 { 0xd9f0, 0 } 1327 }; 1328 PTRNTAB0 aptb0FABS[] = /* FABS */ { 1329 { 0xd9e1, 0 } 1330 }; 1331 PTRNTAB0 aptb0FCHS[] = /* FCHS */ { 1332 { 0xd9e0, 0 } 1333 }; 1334 PTRNTAB0 aptb0FCLEX[] = /* FCLEX */ { 1335 { 0xdbe2, _fwait } 1336 }; 1337 PTRNTAB0 aptb0FNCLEX[] = /* FNCLEX */ { 1338 { 0xdbe2, _nfwait } 1339 }; 1340 PTRNTAB0 aptb0FCOMPP[] = /* FCOMPP */ { 1341 { 0xded9, 0 } 1342 }; 1343 PTRNTAB0 aptb0FCOS[] = /* FCOS */ { 1344 { 0xd9ff, 0 } 1345 }; 1346 PTRNTAB0 aptb0FUCOMPP[] = /* FUCOMPP */ { 1347 { 0xdae9, 0 } 1348 }; 1349 PTRNTAB0 aptb0FDECSTP[] = /* FDECSTP */ { 1350 { 0xd9f6, 0 } 1351 }; 1352 PTRNTAB0 aptb0FINCSTP[] = /* FINCSTP */ { 1353 { 0xd9f7, 0 } 1354 }; 1355 PTRNTAB0 aptb0FINIT[] = /* FINIT */ { 1356 { 0xdbe3, _fwait } 1357 }; 1358 PTRNTAB0 aptb0FNINIT[] = /* FNINIT */ { 1359 { 0xdbe3, _nfwait } 1360 }; 1361 PTRNTAB0 aptb0FENI[] = /* FENI */ { 1362 { 0xdbe0, _fwait } 1363 }; 1364 PTRNTAB0 aptb0FNENI[] = /* FNENI */ { 1365 { 0xdbe0, _nfwait } 1366 }; 1367 PTRNTAB0 aptb0FDISI[] = /* FDISI */ { 1368 { 0xdbe1, _fwait } 1369 }; 1370 PTRNTAB0 aptb0FNDISI[] = /* FNDISI */ { 1371 { 0xdbe1, _nfwait } 1372 }; 1373 PTRNTAB0 aptb0FLD1[] = /* FLD1 */ { 1374 { 0xd9e8, 0 } 1375 }; 1376 PTRNTAB0 aptb0FLDL2T[] = /* FLDL2T */ { 1377 { 0xd9e9, 0 } 1378 }; 1379 PTRNTAB0 aptb0FLDL2E[] = /* FLDL2E */ { 1380 { 0xd9ea, 0 } 1381 }; 1382 PTRNTAB0 aptb0FLDPI[] = /* FLDPI */ { 1383 { 0xd9eb, 0 } 1384 }; 1385 PTRNTAB0 aptb0FLDLG2[] = /* FLDLG2 */ { 1386 { 0xd9ec, 0 } 1387 }; 1388 PTRNTAB0 aptb0FLDLN2[] = /* FLDLN2 */ { 1389 { 0xd9ed, 0 } 1390 }; 1391 PTRNTAB0 aptb0FLDZ[] = /* FLDZ */ { 1392 { 0xd9ee, 0 } 1393 }; 1394 PTRNTAB0 aptb0FNOP[] = /* FNOP */ { 1395 { 0xd9d0, 0 } 1396 }; 1397 PTRNTAB0 aptb0FPATAN[] = /* FPATAN */ { 1398 { 0xd9f3, 0 } 1399 }; 1400 PTRNTAB0 aptb0FPREM[] = /* FPREM */ { 1401 { 0xd9f8, 0 } 1402 }; 1403 PTRNTAB0 aptb0FPREM1[] = /* FPREM1 */ { 1404 { 0xd9f5, 0 } 1405 }; 1406 PTRNTAB0 aptb0FPTAN[] = /* FPTAN */ { 1407 { 0xd9f2, 0 } 1408 }; 1409 PTRNTAB0 aptb0FRNDINT[] = /* FRNDINT */ { 1410 { 0xd9fc, 0 } 1411 }; 1412 PTRNTAB0 aptb0FSCALE[] = /* FSCALE */ { 1413 { 0xd9fd, 0 } 1414 }; 1415 PTRNTAB0 aptb0FSETPM[] = /* FSETPM */ { 1416 { 0xdbe4, 0 } 1417 }; 1418 PTRNTAB0 aptb0FSIN[] = /* FSIN */ { 1419 { 0xd9fe, 0 } 1420 }; 1421 PTRNTAB0 aptb0FSINCOS[] = /* FSINCOS */ { 1422 { 0xd9fb, 0 } 1423 }; 1424 PTRNTAB0 aptb0FSQRT[] = /* FSQRT */ { 1425 { 0xd9fa, 0 } 1426 }; 1427 PTRNTAB0 aptb0FTST[] = /* FTST */ { 1428 { 0xd9e4, 0 } 1429 }; 1430 PTRNTAB0 aptb0FWAIT[] = /* FWAIT */ { 1431 { 0x9b, 0 } 1432 }; 1433 PTRNTAB0 aptb0FXAM[] = /* FXAM */ { 1434 { 0xd9e5, 0 } 1435 }; 1436 PTRNTAB0 aptb0FXTRACT[] = /* FXTRACT */ { 1437 { 0xd9f4, 0 } 1438 }; 1439 PTRNTAB0 aptb0FYL2X[] = /* FYL2X */ { 1440 { 0xd9f1, 0 } 1441 }; 1442 PTRNTAB0 aptb0FYL2XP1[] = /* FYL2XP1 */ { 1443 { 0xd9f9, 0 } 1444 }; 808 809 OPTABLE0(F2XM1, 0xd9f0,0); 810 OPTABLE0(FABS, 0xd9e1,0); 811 OPTABLE0(FCHS, 0xd9e0,0); 812 OPTABLE0(FCLEX, 0xdbe2,_fwait); 813 OPTABLE0(FNCLEX, 0xdbe2, _nfwait); 814 OPTABLE0(FCOMPP, 0xded9, 0); 815 OPTABLE0(FCOS, 0xd9ff, 0); 816 OPTABLE0(FUCOMPP, 0xdae9, 0); 817 OPTABLE0(FDECSTP, 0xd9f6, 0); 818 OPTABLE0(FINCSTP, 0xd9f7, 0); 819 OPTABLE0(FINIT, 0xdbe3, _fwait); 820 OPTABLE0(FNINIT, 0xdbe3, _nfwait); 821 OPTABLE0(FENI, 0xdbe0, _fwait); 822 OPTABLE0(FNENI, 0xdbe0, _nfwait); 823 OPTABLE0(FDISI, 0xdbe1, _fwait); 824 OPTABLE0(FNDISI, 0xdbe1, _nfwait); 825 OPTABLE0(FLD1, 0xd9e8, 0); 826 OPTABLE0(FLDL2T, 0xd9e9, 0); 827 OPTABLE0(FLDL2E, 0xd9ea, 0); 828 OPTABLE0(FLDPI, 0xd9eb, 0); 829 OPTABLE0(FLDLG2, 0xd9ec, 0); 830 OPTABLE0(FLDLN2, 0xd9ed, 0); 831 OPTABLE0(FLDZ, 0xd9ee, 0); 832 OPTABLE0(FNOP, 0xd9d0, 0); 833 OPTABLE0(FPATAN, 0xd9f3, 0); 834 OPTABLE0(FPREM, 0xd9f8, 0); 835 OPTABLE0(FPREM1, 0xd9f5, 0); 836 OPTABLE0(FPTAN, 0xd9f2, 0); 837 OPTABLE0(FRNDINT, 0xd9fc, 0); 838 OPTABLE0(FSCALE, 0xd9fd, 0); 839 OPTABLE0(FSETPM, 0xdbe4, 0); 840 OPTABLE0(FSIN, 0xd9fe, 0); 841 OPTABLE0(FSINCOS, 0xd9fb, 0); 842 OPTABLE0(FSQRT, 0xd9fa, 0); 843 OPTABLE0(FTST, 0xd9e4, 0); 844 OPTABLE0(FWAIT, 0x9b, 0); 845 OPTABLE0(FXAM, 0xd9e5, 0); 846 OPTABLE0(FXTRACT, 0xd9f4, 0); 847 OPTABLE0(FYL2X, 0xd9f1, 0); 848 OPTABLE0(FYL2XP1, 0xd9f9, 0); 1445 849 // 1446 850 // Floating point instructions which have entirely different flag 1447 851 // interpretations but they overlap, only asm_determine_operator 1448 852 // flags needs to know the difference 1449 853 // 1 operand floating point instructions follow 1450 854 // 1451 855 PTRNTAB1 aptb1FBLD[] = /* FBLD */ { 1452 856 { 0xdf, _4, _fm80 }, 1453 857 { ASM_END, 0, 0 } 1454 858 }; 1455 859 1456 860 PTRNTAB1 aptb1FBSTP[] = /* FBSTP */ { 1457 861 { 0xdf, _6, _fm80 }, 1458 862 { ASM_END, 0, 0 } 1459 863 }; 1460 864 PTRNTAB2 aptb2FCMOVB[] = /* FCMOVB */ { 1461 865 { 0xdac0, 0, _st, _sti | _plus_r }, 1462 866 { 0xdac1, 0, 0 }, 1463 867 { ASM_END, 0, 0 } 1464 868 }; … … 3203 2607 X("cmovnge", 2, (P) aptb2CMOVL ) \ 3204 2608 X("cmovnl", 2, (P) aptb2CMOVNL ) \ 3205 2609 X("cmovnle", 2, (P) aptb2CMOVNLE ) \ 3206 2610 X("cmovno", 2, (P) aptb2CMOVNO ) \ 3207 2611 X("cmovnp", 2, (P) aptb2CMOVNP ) \ 3208 2612 X("cmovns", 2, (P) aptb2CMOVNS ) \ 3209 2613 X("cmovnz", 2, (P) aptb2CMOVNZ ) \ 3210 2614 X("cmovo", 2, (P) aptb2CMOVO ) \ 3211 2615 X("cmovp", 2, (P) aptb2CMOVP ) \ 3212 2616 X("cmovpe", 2, (P) aptb2CMOVP ) \ 3213 2617 X("cmovpo", 2, (P) aptb2CMOVNP ) \ 3214 2618 X("cmovs", 2, (P) aptb2CMOVS ) \ 3215 2619 X("cmovz", 2, (P) aptb2CMOVZ ) \ 3216 2620 X("cmp", 2, (P) aptb2CMP ) \ 3217 2621 X("cmppd", 3, (P) aptb3CMPPD ) \ 3218 2622 X("cmpps", 3, (P) aptb3CMPPS ) \ 3219 2623 X("cmps", 2, (P) aptb2CMPS ) \ 3220 2624 X("cmpsb", 0, aptb0CMPSB ) \ 3221 2625 /*X("cmpsd", 0, aptb0CMPSD )*/ \ 3222 2626 X("cmpsd", ITopt|3, (P) aptb3CMPSD ) \ 2627 X("cmpsq", 0, aptb0CMPSQ ) \ 3223 2628 X("cmpss", 3, (P) aptb3CMPSS ) \ 3224 2629 X("cmpsw", 0, aptb0CMPSW ) \ 3225 2630 X("cmpxch8b", 1, (P) aptb1CMPXCH8B ) \ 3226 2631 X("cmpxchg", 2, (P) aptb2CMPXCHG ) \ 3227 2632 X("comisd", 2, (P) aptb2COMISD ) \ 3228 2633 X("comiss", 2, (P) aptb2COMISS ) \ 3229 2634 X("cpuid", 0, aptb0CPUID ) \ 3230 2635 X("cqo", 0, aptb0CQO ) \ 3231 2636 X("cvtdq2pd", 2, (P) aptb2CVTDQ2PD ) \ 3232 2637 X("cvtdq2ps", 2, (P) aptb2CVTDQ2PS ) \ 3233 2638 X("cvtpd2dq", 2, (P) aptb2CVTPD2DQ ) \ 3234 2639 X("cvtpd2pi", 2, (P) aptb2CVTPD2PI ) \ 3235 2640 X("cvtpd2ps", 2, (P) aptb2CVTPD2PS ) \ 3236 2641 X("cvtpi2pd", 2, (P) aptb2CVTPI2PD ) \ 3237 2642 X("cvtpi2ps", 2, (P) aptb2CVTPI2PS ) \ 3238 2643 X("cvtps2dq", 2, (P) aptb2CVTPS2DQ ) \ 3239 2644 X("cvtps2pd", 2, (P) aptb2CVTPS2PD ) \ 3240 2645 X("cvtps2pi", 2, (P) aptb2CVTPS2PI ) \ 3241 2646 X("cvtsd2si", 2, (P) aptb2CVTSD2SI ) \ 3242 2647 X("cvtsd2ss", 2, (P) aptb2CVTSD2SS ) \ … … 3432 2837 #define OPCODETABLE2 \ 3433 2838 X("lahf", 0, aptb0LAHF ) \ 3434 2839 X("lar", 2, (P) aptb2LAR ) \ 3435 2840 X("lddqu", 2, (P) aptb2LDDQU ) \ 3436 2841 X("ldmxcsr", 1, (P) aptb1LDMXCSR ) \ 3437 2842 X("lds", 2, (P) aptb2LDS ) \ 3438 2843 X("lea", 2, (P) aptb2LEA ) \ 3439 2844 X("leave", 0, aptb0LEAVE ) \ 3440 2845 X("les", 2, (P) aptb2LES ) \ 3441 2846 X("lfence", 0, aptb0LFENCE) \ 3442 2847 X("lfs", 2, (P) aptb2LFS ) \ 3443 2848 X("lgdt", 1, (P) aptb1LGDT ) \ 3444 2849 X("lgs", 2, (P) aptb2LGS ) \ 3445 2850 X("lidt", 1, (P) aptb1LIDT ) \ 3446 2851 X("lldt", 1, (P) aptb1LLDT ) \ 3447 2852 X("lmsw", 1, (P) aptb1LMSW ) \ 3448 2853 X("lock", ITprefix | 0, aptb0LOCK ) \ 3449 2854 X("lods", 1, (P) aptb1LODS ) \ 3450 2855 X("lodsb", 0, aptb0LODSB ) \ 3451 2856 X("lodsd", 0, aptb0LODSD ) \ 2857 X("lodsq", 0, aptb0LODSQ ) \ 3452 2858 X("lodsw", 0, aptb0LODSW ) \ 3453 2859 X("loop", ITjump | 1, (P) aptb1LOOP ) \ 3454 2860 X("loope", ITjump | 1, (P) aptb1LOOPE ) \ 3455 2861 X("loopne", ITjump | 1, (P) aptb1LOOPNE ) \ 3456 X("loopnz", ITjump | 1, (P) aptb1LOOPN Z) \3457 X("loopz", ITjump | 1, (P) aptb1LOOP Z) \2862 X("loopnz", ITjump | 1, (P) aptb1LOOPNE ) \ 2863 X("loopz", ITjump | 1, (P) aptb1LOOPE ) \ 3458 2864 X("lsl", 2, (P) aptb2LSL ) \ 3459 2865 X("lss", 2, (P) aptb2LSS ) \ 3460 2866 X("ltr", 1, (P) aptb1LTR ) \ 3461 2867 X("maskmovdqu", 2, (P) aptb2MASKMOVDQU ) \ 3462 2868 X("maskmovq", 2, (P) aptb2MASKMOVQ ) \ 3463 2869 X("maxpd", 2, (P) aptb2MAXPD ) \ 3464 2870 X("maxps", 2, (P) aptb2MAXPS ) \ 3465 2871 X("maxsd", 2, (P) aptb2MAXSD ) \ 3466 2872 X("maxss", 2, (P) aptb2MAXSS ) \ 3467 2873 X("mfence", 0, aptb0MFENCE) \ 3468 2874 X("minpd", 2, (P) aptb2MINPD ) \ 3469 2875 X("minps", 2, (P) aptb2MINPS ) \ 3470 2876 X("minsd", 2, (P) aptb2MINSD ) \ 3471 2877 X("minss", 2, (P) aptb2MINSS ) \ 3472 2878 X("monitor", 0, (P) aptb0MONITOR ) \ 3473 2879 X("mov", 2, (P) aptb2MOV ) \ 3474 2880 X("movapd", 2, (P) aptb2MOVAPD ) \ 3475 2881 X("movaps", 2, (P) aptb2MOVAPS ) \ 3476 2882 X("movd", 2, (P) aptb2MOVD ) \ 3477 2883 X("movddup", 2, (P) aptb2MOVDDUP ) \ … … 3481 2887 X("movhlps", 2, (P) aptb2MOVHLPS ) \ 3482 2888 X("movhpd", 2, (P) aptb2MOVHPD ) \ 3483 2889 X("movhps", 2, (P) aptb2MOVHPS ) \ 3484 2890 X("movlhps", 2, (P) aptb2MOVLHPS ) \ 3485 2891 X("movlpd", 2, (P) aptb2MOVLPD ) \ 3486 2892 X("movlps", 2, (P) aptb2MOVLPS ) \ 3487 2893 X("movmskpd", 2, (P) aptb2MOVMSKPD ) \ 3488 2894 X("movmskps", 2, (P) aptb2MOVMSKPS ) \ 3489 2895 X("movntdq", 2, (P) aptb2MOVNTDQ ) \ 3490 2896 X("movnti", 2, (P) aptb2MOVNTI ) \ 3491 2897 X("movntpd", 2, (P) aptb2MOVNTPD ) \ 3492 2898 X("movntps", 2, (P) aptb2MOVNTPS ) \ 3493 2899 X("movntq", 2, (P) aptb2MOVNTQ ) \ 3494 2900 X("movq", 2, (P) aptb2MOVQ ) \ 3495 2901 X("movq2dq", 2, (P) aptb2MOVQ2DQ ) \ 3496 2902 X("movs", 2, (P) aptb2MOVS ) \ 3497 2903 X("movsb", 0, aptb0MOVSB ) \ 3498 2904 X("movsd", ITopt | 2, (P) aptb2MOVSD ) \ 3499 2905 X("movshdup", 2, (P) aptb2MOVSHDUP ) \ 3500 2906 X("movsldup", 2, (P) aptb2MOVSLDUP ) \ 2907 X("movsq", 0, aptb0MOVSQ ) \ 3501 2908 X("movss", 2, (P) aptb2MOVSS ) \ 3502 2909 X("movsw", 0, aptb0MOVSW ) \ 3503 2910 X("movsx", 2, (P) aptb2MOVSX ) \ 3504 2911 X("movupd", 2, (P) aptb2MOVUPD ) \ 3505 2912 X("movups", 2, (P) aptb2MOVUPS ) \ 3506 2913 X("movzx", 2, (P) aptb2MOVZX ) \ 3507 2914 X("mul", ITopt | 2, (P) aptb2MUL ) \ 3508 2915 X("mulpd", 2, (P) aptb2MULPD ) \ 3509 2916 X("mulps", 2, (P) aptb2MULPS ) \ 3510 2917 X("mulsd", 2, (P) aptb2MULSD ) \ 3511 2918 X("mulss", 2, (P) aptb2MULSS ) \ 3512 2919 X("mwait", 0, (P) aptb0MWAIT ) \ 3513 2920 X("neg", 1, (P) aptb1NEG ) \ 3514 2921 X("nop", 0, aptb0NOP ) \ 3515 2922 X("not", 1, (P) aptb1NOT ) \ 3516 2923 X("or", 2, (P) aptb2OR ) \ 3517 2924 X("orpd", 2, (P) aptb2ORPD ) \ 3518 2925 X("orps", 2, (P) aptb2ORPS ) \ 3519 2926 X("out", 2, (P) aptb2OUT ) \ 3520 2927 X("outs", 2, (P) aptb2OUTS ) \ … … 3627 3034 X("rcl", ITshift | 2, (P) aptb2RCL ) \ 3628 3035 X("rcpps", 2, (P) aptb2RCPPS ) \ 3629 3036 X("rcpss", 2, (P) aptb2RCPSS ) \ 3630 3037 X("rcr", ITshift | 2, (P) aptb2RCR ) \ 3631 3038 X("rdmsr", 0, aptb0RDMSR ) \ 3632 3039 X("rdpmc", 0, aptb0RDPMC ) \ 3633 3040 X("rdtsc", 0, aptb0RDTSC ) \ 3634 3041 X("rep", ITprefix | 0, aptb0REP ) \ 3635 3042 X("repe", ITprefix | 0, aptb0REP ) \ 3636 3043 X("repne", ITprefix | 0, aptb0REPNE ) \ 3637 3044 X("repnz", ITprefix | 0, aptb0REPNE ) \ 3638 3045 X("repz", ITprefix | 0, aptb0REP ) \ 3639 3046 X("ret", ITopt | 1, (P) aptb1RET ) \ 3640 3047 X("retf", ITopt | 1, (P) aptb1RETF ) \ 3641 3048 X("rol", ITshift | 2, (P) aptb2ROL ) \ 3642 3049 X("ror", ITshift | 2, (P) aptb2ROR ) \ 3643 3050 X("rsm", 0, aptb0RSM ) \ 3644 3051 X("rsqrtps", 2, (P) aptb2RSQRTPS ) \ 3645 3052 X("rsqrtss", 2, (P) aptb2RSQRTSS ) \ 3646 3053 X("sahf", 0, aptb0SAHF ) \ 3647 X("sal", ITshift | 2, (P) aptb2S AL ) \3054 X("sal", ITshift | 2, (P) aptb2SHL ) \ 3648 3055 X("sar", ITshift | 2, (P) aptb2SAR ) \ 3649 3056 X("sbb", 2, (P) aptb2SBB ) \ 3650 3057 X("scas", 1, (P) aptb1SCAS ) \ 3651 3058 X("scasb", 0, aptb0SCASB ) \ 3652 3059 X("scasd", 0, aptb0SCASD ) \ 3060 X("scasq", 0, aptb0SCASQ ) \ 3653 3061 X("scasw", 0, aptb0SCASW ) \ 3654 3062 X("seta", 1, (P) aptb1SETNBE ) \ 3655 3063 X("setae", 1, (P) aptb1SETNB ) \ 3656 3064 X("setb", 1, (P) aptb1SETB ) \ 3657 3065 X("setbe", 1, (P) aptb1SETBE ) \ 3658 3066 X("setc", 1, (P) aptb1SETB ) \ 3659 3067 X("sete", 1, (P) aptb1SETZ ) \ 3660 3068 X("setg", 1, (P) aptb1SETNLE ) \ 3661 3069 X("setge", 1, (P) aptb1SETNL ) \ 3662 3070 X("setl", 1, (P) aptb1SETL ) \ 3663 3071 X("setle", 1, (P) aptb1SETLE ) \ 3664 3072 X("setna", 1, (P) aptb1SETBE ) \ 3665 3073 X("setnae", 1, (P) aptb1SETB ) \ 3666 3074 X("setnb", 1, (P) aptb1SETNB ) \ 3667 3075 X("setnbe", 1, (P) aptb1SETNBE ) \ 3668 3076 X("setnc", 1, (P) aptb1SETNB ) \ 3669 3077 X("setne", 1, (P) aptb1SETNZ ) \ 3670 3078 X("setng", 1, (P) aptb1SETLE ) \ 3671 3079 X("setnge", 1, (P) aptb1SETL ) \ 3672 3080 X("setnl", 1, (P) aptb1SETNL ) \ … … 3686 3094 X("shl", ITshift | 2, (P) aptb2SHL ) \ 3687 3095 X("shld", 3, (P) aptb3SHLD ) \ 3688 3096 X("shr", ITshift | 2, (P) aptb2SHR ) \ 3689 3097 X("shrd", 3, (P) aptb3SHRD ) \ 3690 3098 X("shufpd", 3, (P) aptb3SHUFPD ) \ 3691 3099 X("shufps", 3, (P) aptb3SHUFPS ) \ 3692 3100 X("sidt", 1, (P) aptb1SIDT ) \ 3693 3101 X("sldt", 1, (P) aptb1SLDT ) \ 3694 3102 X("smsw", 1, (P) aptb1SMSW ) \ 3695 3103 X("sqrtpd", 2, (P) aptb2SQRTPD ) \ 3696 3104 X("sqrtps", 2, (P) aptb2SQRTPS ) \ 3697 3105 X("sqrtsd", 2, (P) aptb2SQRTSD ) \ 3698 3106 X("sqrtss", 2, (P) aptb2SQRTSS ) \ 3699 3107 X("stc", 0, aptb0STC ) \ 3700 3108 X("std", 0, aptb0STD ) \ 3701 3109 X("sti", 0, aptb0STI ) \ 3702 3110 X("stmxcsr", 1, (P) aptb1STMXCSR ) \ 3703 3111 X("stos", 1, (P) aptb1STOS ) \ 3704 3112 X("stosb", 0, aptb0STOSB ) \ 3705 3113 X("stosd", 0, aptb0STOSD ) \ 3114 X("stosq", 0, aptb0STOSQ ) \ 3706 3115 X("stosw", 0, aptb0STOSW ) \ 3707 3116 X("str", 1, (P) aptb1STR ) \ 3708 3117 X("sub", 2, (P) aptb2SUB ) \ 3709 3118 X("subpd", 2, (P) aptb2SUBPD ) \ 3710 3119 X("subps", 2, (P) aptb2SUBPS ) \ 3711 3120 X("subsd", 2, (P) aptb2SUBSD ) \ 3712 3121 X("subss", 2, (P) aptb2SUBSS ) \ 3713 3122 X("sysenter", 0, aptb0SYSENTER ) \ 3714 3123 X("sysexit", 0, aptb0SYSEXIT ) \ 3715 3124 X("test", 2, (P) aptb2TEST ) \ 3716 3125 X("ucomisd", 2, (P) aptb2UCOMISD ) \ 3717 3126 X("ucomiss", 2, (P) aptb2UCOMISS ) \ 3718 3127 X("ud2", 0, aptb0UD2 ) \ 3719 3128 X("unpckhpd", 2, (P) aptb2UNPCKHPD ) \ 3720 3129 X("unpckhps", 2, (P) aptb2UNPCKHPS ) \ 3721 3130 X("unpcklpd", 2, (P) aptb2UNPCKLPD ) \ 3722 3131 X("unpcklps", 2, (P) aptb2UNPCKLPS ) \ 3723 3132 X("verr", 1, (P) aptb1VERR ) \ 3724 3133 X("verw", 1, (P) aptb1VERW ) \ 3725 3134 X("wait", 0, aptb0WAIT ) \ trunk/src/e2ir.c
r618 r621 4474 4474 elength = n1; 4475 4475 n1 = el_same(&elength); 4476 4476 elength = el_una(OP64_32, TYuint, elength); 4477 4477 L1: 4478 4478 n2x = n2; 4479 4479 n2 = el_same(&n2x); 4480 4480 n2x = el_bin(OPlt, TYint, n2x, elength); 4481 4481 4482 4482 // Construct: (n2x || ModuleAssert(line)) 4483 4483 Symbol *sassert; 4484 4484 4485 4485 sassert = irs->blx->module->toModuleArray(); 4486 4486 ea = el_bin(OPcall,TYvoid,el_var(sassert), 4487 4487 el_long(TYint, loc.linnum)); 4488 4488 eb = el_bin(OPoror,TYvoid,n2x,ea); 4489 4489 } 4490 4490 } 4491 4491 4492 4492 n1 = array_toPtr(t1, n1); 4493 4493 4494 { elem *escale; 4495 4496 escale = el_long(TYint, t1->nextOf()->size()); 4494 { 4495 elem *escale = el_long(TYsize_t, t1->nextOf()->size()); 4497 4496 n2 = el_bin(OPmul, TYint, n2, escale); 4498 4497 e = el_bin(OPadd, TYnptr, n1, n2); 4499 4498 e = el_una(OPind, type->totym(), e); 4500 4499 if (tybasic(e->Ety) == TYstruct || tybasic(e->Ety) == TYarray) 4501 4500 { e->Ety = TYstruct; 4502 4501 e->Enumbytes = type->size(); 4503 4502 } 4504 4503 } 4505 4504 4506 4505 eb = el_combine(einit, eb); 4507 4506 e = el_combine(eb, e); 4508 4507 } 4509 4508 el_setLoc(e,loc); 4510 4509 return e; 4511 4510 } 4512 4511 4513 4512 4514 4513 elem *TupleExp::toElem(IRState *irs) 4515 4514 { elem *e = NULL; 4516 4515 trunk/src/impcnvgen.c
r428 r621 369 369 Y(Tint64, Tuns16) 370 370 Y(Tuns64, Tuns16) 371 371 372 372 Y(Tint16, Twchar) 373 373 Y(Tint32, Twchar) 374 374 Y(Tuns32, Twchar) 375 375 Y(Tint64, Twchar) 376 376 Y(Tuns64, Twchar) 377 377 378 378 // Y(Tuns32, Tint32) 379 379 Y(Tint64, Tint32) 380 380 Y(Tuns64, Tint32) 381 381 382 382 // Y(Tint32, Tuns32) 383 383 Y(Tint64, Tuns32) 384 384 Y(Tuns64, Tuns32) 385 385 386 386 Y(Tint64, Tdchar) 387 387 Y(Tuns64, Tdchar) 388 388 389 Y(Tint64, Tuns64)390 Y(Tuns64, Tint64)389 // Y(Tint64, Tuns64) 390 // Y(Tuns64, Tint64) 391 391 392 392 for (i = 0; i < TMAX; i++) 393 393 for (j = 0; j < TMAX; j++) 394 394 { 395 395 if (impcnvResult[i][j] == Terror) 396 396 { 397 397 impcnvResult[i][j] = impcnvResult[j][i]; 398 398 impcnvType1[i][j] = impcnvType2[j][i]; 399 399 impcnvType2[i][j] = impcnvType1[j][i]; 400 400 } 401 401 } 402 402 } 403 403 404 404 int main() 405 405 { FILE *fp; 406 406 int i; 407 407 int j; 408 408 409 409 init(); 410 410
