LEFT | RIGHT |
1 // Inferno utils/6l/optab.c | 1 // Inferno utils/6l/optab.c |
2 // http://code.google.com/p/inferno-os/source/browse/utils/6l/optab.c | 2 // http://code.google.com/p/inferno-os/source/browse/utils/6l/optab.c |
3 // | 3 // |
4 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. | 4 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. |
5 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) | 5 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) |
6 // Portions Copyright © 1997-1999 Vita Nuova Limited | 6 // Portions Copyright © 1997-1999 Vita Nuova Limited |
7 // Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuov
a.com) | 7 // Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuov
a.com) |
8 // Portions Copyright © 2004,2006 Bruce Ellis | 8 // Portions Copyright © 2004,2006 Bruce Ellis |
9 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) | 9 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) |
10 // Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others | 10 // Revisions Copyright © 2000-2007 Lucent Technologies Inc. and others |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 { | 527 { |
528 Yxr, Yrl, Zm_r_xm, 2, | 528 Yxr, Yrl, Zm_r_xm, 2, |
529 Ymr, Yrl, Zm_r_xm, 1, | 529 Ymr, Yrl, Zm_r_xm, 1, |
530 0 | 530 0 |
531 }; | 531 }; |
532 uchar ycrc32l[] = | 532 uchar ycrc32l[] = |
533 { | 533 { |
534 Yml, Yrl, Zlitm_r, 0, | 534 Yml, Yrl, Zlitm_r, 0, |
535 }; | 535 }; |
536 | 536 |
537 /* You are doasm, holding in your hand a Prog* with p->as set to, say, ACRC32, | 537 /* |
| 538 * You are doasm, holding in your hand a Prog* with p->as set to, say, ACRC32, |
538 * and p->from and p->to as operands (Adr*). The linker scans optab to find | 539 * and p->from and p->to as operands (Adr*). The linker scans optab to find |
539 * the entry with the given p->as and then looks through the ytable for that | 540 * the entry with the given p->as and then looks through the ytable for that |
540 * instruction (the second field in the optab struct) for a line whose first | 541 * instruction (the second field in the optab struct) for a line whose first |
541 * two values match the Ytypes of the p->from and p->to operands. The function | 542 * two values match the Ytypes of the p->from and p->to operands. The function |
542 * oclass in span.c computes the specific Ytype of an operand and then the set | 543 * oclass in span.c computes the specific Ytype of an operand and then the set |
543 * of more general Ytypes that it satisfies is implied by the ycover table, set | 544 * of more general Ytypes that it satisfies is implied by the ycover table, set |
544 * up in instinit. For example, oclass distinguishes the constants 0 and 1 | 545 * up in instinit. For example, oclass distinguishes the constants 0 and 1 |
545 * from the more general 8-bit constants, but instinit says | 546 * from the more general 8-bit constants, but instinit says |
546 * | 547 * |
547 * ycover[Yi0*Ymax + Ys32] = 1; | 548 * ycover[Yi0*Ymax + Ys32] = 1; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 * Yi32, Yml -> Zilo_m, z+2+1 (0x81, 0x00) | 583 * Yi32, Yml -> Zilo_m, z+2+1 (0x81, 0x00) |
583 * Yrl, Yml -> Zr_m, z+2+1+2 (0x01) | 584 * Yrl, Yml -> Zr_m, z+2+1+2 (0x01) |
584 * Yml, Yrl -> Zm_r, z+2+1+2+1 (0x03) | 585 * Yml, Yrl -> Zm_r, z+2+1+2+1 (0x03) |
585 * | 586 * |
586 * The Pconstant in the optab line controls the prefix bytes to emit. That's | 587 * The Pconstant in the optab line controls the prefix bytes to emit. That's |
587 * relatively straightforward as this program goes. | 588 * relatively straightforward as this program goes. |
588 * | 589 * |
589 * The switch on t[2] in doasm implements the various Z cases. Zibo_m, for | 590 * The switch on t[2] in doasm implements the various Z cases. Zibo_m, for |
590 * example, is an opcode byte (z[0]) then an asmando (which is some kind of | 591 * example, is an opcode byte (z[0]) then an asmando (which is some kind of |
591 * encoded addressing mode for the Yml arg), and then a single immediate byte. | 592 * encoded addressing mode for the Yml arg), and then a single immediate byte. |
592 * Zilo_m is the same but a long (32-bit) immediate. */ | 593 * Zilo_m is the same but a long (32-bit) immediate. |
| 594 */ |
593 Optab optab[] = | 595 Optab optab[] = |
594 /* as, ytab, andproto, opcode */ | 596 /* as, ytab, andproto, opcode */ |
595 { | 597 { |
596 { AXXX }, | 598 { AXXX }, |
597 { AAAA, ynone, P32, 0x37 }, | 599 { AAAA, ynone, P32, 0x37 }, |
598 { AAAD, ynone, P32, 0xd5,0x0a }, | 600 { AAAD, ynone, P32, 0xd5,0x0a }, |
599 { AAAM, ynone, P32, 0xd4,0x0a }, | 601 { AAAM, ynone, P32, 0xd4,0x0a }, |
600 { AAAS, ynone, P32, 0x3f }, | 602 { AAAS, ynone, P32, 0x3f }, |
601 { AADCB, yxorb, Pb, 0x14,0x80,(02),0x10,0x10 }, | 603 { AADCB, yxorb, Pb, 0x14,0x80,(02),0x10,0x10 }, |
602 { AADCL, yxorl, Px, 0x83,(02),0x15,0x81,(02),0x11,0x13 }, | 604 { AADCL, yxorl, Px, 0x83,(02),0x15,0x81,(02),0x11,0x13 }, |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1253 { ASYSRET, ynone, Pm, 0x07 }, | 1255 { ASYSRET, ynone, Pm, 0x07 }, |
1254 { AWBINVD, ynone, Pm, 0x09 }, | 1256 { AWBINVD, ynone, Pm, 0x09 }, |
1255 { AWRMSR, ynone, Pm, 0x30 }, | 1257 { AWRMSR, ynone, Pm, 0x30 }, |
1256 | 1258 |
1257 { AXADDB, yrb_mb, Pb, 0x0f,0xc0 }, | 1259 { AXADDB, yrb_mb, Pb, 0x0f,0xc0 }, |
1258 { AXADDL, yrl_ml, Px, 0x0f,0xc1 }, | 1260 { AXADDL, yrl_ml, Px, 0x0f,0xc1 }, |
1259 { AXADDQ, yrl_ml, Pw, 0x0f,0xc1 }, | 1261 { AXADDQ, yrl_ml, Pw, 0x0f,0xc1 }, |
1260 { AXADDW, yrl_ml, Pe, 0x0f,0xc1 }, | 1262 { AXADDW, yrl_ml, Pe, 0x0f,0xc1 }, |
1261 | 1263 |
1262 { ACRC32B, ycrc32l,Px, 0xf2,0x0f,0x38,0xf0,0}, | 1264 { ACRC32B, ycrc32l,Px, 0xf2,0x0f,0x38,0xf0,0}, |
1263 » /* Note that the REX.W prefix encoded in the next line limits | 1265 » { ACRC32Q, ycrc32l,Pw, 0xf2,0x0f,0x38,0xf1,0}, |
1264 » * the registers that this instruction can use. */ | |
1265 » { ACRC32Q, ycrc32l,Px, 0xf2,0x48,0x0f,0x38,0xf1,0}, | |
1266 | 1266 |
1267 { AEND }, | 1267 { AEND }, |
1268 0 | 1268 0 |
1269 }; | 1269 }; |
1270 | 1270 |
1271 Optab* opindex[ALAST+1]; | 1271 Optab* opindex[ALAST+1]; |
1272 | 1272 |
1273 /* | 1273 /* |
1274 AMOVD 0f 6e/r mmx,reg/mem32[mem64-rex?] | 1274 AMOVD 0f 6e/r mmx,reg/mem32[mem64-rex?] |
1275 AMOVD 0f 7e/r reg/mem32[64],mmx STORE | 1275 AMOVD 0f 7e/r reg/mem32[64],mmx STORE |
1276 AMOVQ 0f 6f/r mmx1,mmx2/mem64 | 1276 AMOVQ 0f 6f/r mmx1,mmx2/mem64 |
1277 AMOVQ 0f 7f/r mmx1/mem64,mmx2 | 1277 AMOVQ 0f 7f/r mmx1/mem64,mmx2 |
1278 */ | 1278 */ |
LEFT | RIGHT |