LEFT | RIGHT |
(no file at all) | |
1 // Inferno utils/6l/span.c | 1 // Inferno utils/6l/span.c |
2 // http://code.google.com/p/inferno-os/source/browse/utils/6l/span.c | 2 // http://code.google.com/p/inferno-os/source/browse/utils/6l/span.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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 static uchar yloop[] = | 498 static uchar yloop[] = |
499 { | 499 { |
500 Ynone, Ybr, Zloop, 1, | 500 Ynone, Ybr, Zloop, 1, |
501 0 | 501 0 |
502 }; | 502 }; |
503 static uchar ycall[] = | 503 static uchar ycall[] = |
504 { | 504 { |
505 Ynone, Yml, Zo_m64, 0, | 505 Ynone, Yml, Zo_m64, 0, |
506 Yrx, Yrx, Zo_m64, 2, | 506 Yrx, Yrx, Zo_m64, 2, |
507 Ynone, Ybr, Zcall, 1, | 507 Ynone, Ybr, Zcall, 1, |
| 508 0 |
| 509 }; |
| 510 static uchar yduff[] = |
| 511 { |
| 512 Ynone, Yi32, Zcall, 1, |
508 0 | 513 0 |
509 }; | 514 }; |
510 static uchar yjmp[] = | 515 static uchar yjmp[] = |
511 { | 516 { |
512 Ynone, Yml, Zo_m64, 2, | 517 Ynone, Yml, Zo_m64, 2, |
513 Ynone, Ybr, Zjmp, 1, | 518 Ynone, Ybr, Zjmp, 1, |
514 0 | 519 0 |
515 }; | 520 }; |
516 | 521 |
517 static uchar yfmvd[] = | 522 static uchar yfmvd[] = |
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1512 | 1517 |
1513 { APSHUFD, yaes2, Pq, 0x70,(0) }, | 1518 { APSHUFD, yaes2, Pq, 0x70,(0) }, |
1514 { APCLMULQDQ, yxshuf, Pq, 0x3a,0x44,0 }, | 1519 { APCLMULQDQ, yxshuf, Pq, 0x3a,0x44,0 }, |
1515 | 1520 |
1516 { AUSEFIELD, ynop, Px, 0,0 }, | 1521 { AUSEFIELD, ynop, Px, 0,0 }, |
1517 { ATYPE }, | 1522 { ATYPE }, |
1518 { AFUNCDATA, yfuncdata, Px, 0,0 }, | 1523 { AFUNCDATA, yfuncdata, Px, 0,0 }, |
1519 { APCDATA, ypcdata, Px, 0,0 }, | 1524 { APCDATA, ypcdata, Px, 0,0 }, |
1520 { ACHECKNIL }, | 1525 { ACHECKNIL }, |
1521 { AVARDEF }, | 1526 { AVARDEF }, |
| 1527 { AVARKILL }, |
| 1528 { ADUFFCOPY, yduff, Px, 0xe8 }, |
| 1529 { ADUFFZERO, yduff, Px, 0xe8 }, |
1522 | 1530 |
1523 { AEND }, | 1531 { AEND }, |
1524 0 | 1532 0 |
1525 }; | 1533 }; |
1526 | 1534 |
1527 static Optab* opindex[ALAST+1]; | 1535 static Optab* opindex[ALAST+1]; |
1528 static vlong vaddr(Link*, Addr*, Reloc*); | 1536 static vlong vaddr(Link*, Addr*, Reloc*); |
1529 | 1537 |
1530 // single-instruction no-ops of various lengths. | 1538 // single-instruction no-ops of various lengths. |
1531 // constructed by hand and disassembled with gdb to verify. | 1539 // constructed by hand and disassembled with gdb to verify. |
(...skipping 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3023 | 3031 |
3024 case Zcall: | 3032 case Zcall: |
3025 if(p->to.sym == nil) { | 3033 if(p->to.sym == nil) { |
3026 ctxt->diag("call without target"); | 3034 ctxt->diag("call without target"); |
3027 sysfatal("bad code"); | 3035 sysfatal("bad code"); |
3028 } | 3036 } |
3029 *ctxt->andptr++ = op; | 3037 *ctxt->andptr++ = op; |
3030 r = addrel(ctxt->cursym); | 3038 r = addrel(ctxt->cursym); |
3031 r->off = p->pc + ctxt->andptr - ctxt->and; | 3039 r->off = p->pc + ctxt->andptr - ctxt->and; |
3032 r->sym = p->to.sym; | 3040 r->sym = p->to.sym; |
| 3041 r->add = p->to.offset; |
3033 r->type = D_PCREL; | 3042 r->type = D_PCREL; |
3034 r->siz = 4; | 3043 r->siz = 4; |
3035 put4(ctxt, 0); | 3044 put4(ctxt, 0); |
3036 break; | 3045 break; |
3037 | 3046 |
3038 case Zbr: | 3047 case Zbr: |
3039 case Zjmp: | 3048 case Zjmp: |
3040 case Zloop: | 3049 case Zloop: |
3041 // TODO: jump across functions needs reloc | 3050 // TODO: jump across functions needs reloc |
3042 if(p->to.sym != nil) { | 3051 if(p->to.sym != nil) { |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3477 memmove(ctxt->andptr, naclspfix, sizeof naclspfix); | 3486 memmove(ctxt->andptr, naclspfix, sizeof naclspfix); |
3478 ctxt->andptr += sizeof naclspfix; | 3487 ctxt->andptr += sizeof naclspfix; |
3479 break; | 3488 break; |
3480 case D_BP: | 3489 case D_BP: |
3481 memmove(ctxt->andptr, naclbpfix, sizeof naclbpfix); | 3490 memmove(ctxt->andptr, naclbpfix, sizeof naclbpfix); |
3482 ctxt->andptr += sizeof naclbpfix; | 3491 ctxt->andptr += sizeof naclbpfix; |
3483 break; | 3492 break; |
3484 } | 3493 } |
3485 } | 3494 } |
3486 } | 3495 } |
LEFT | RIGHT |