LEFT | RIGHT |
(no file at all) | |
1 // Inferno utils/8l/span.c | 1 // Inferno utils/8l/span.c |
2 // http://code.google.com/p/inferno-os/source/browse/utils/8l/span.c | 2 // http://code.google.com/p/inferno-os/source/browse/utils/8l/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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 Ynone, Ybr, Zloop, 1, | 411 Ynone, Ybr, Zloop, 1, |
412 0 | 412 0 |
413 }; | 413 }; |
414 static uchar ycall[] = | 414 static uchar ycall[] = |
415 { | 415 { |
416 Ynone, Yml, Zo_m, 0, | 416 Ynone, Yml, Zo_m, 0, |
417 Yrx, Yrx, Zo_m, 2, | 417 Yrx, Yrx, Zo_m, 2, |
418 Ynone, Ycol, Zcallind, 2, | 418 Ynone, Ycol, Zcallind, 2, |
419 Ynone, Ybr, Zcall, 0, | 419 Ynone, Ybr, Zcall, 0, |
420 Ynone, Yi32, Zcallcon, 1, | 420 Ynone, Yi32, Zcallcon, 1, |
| 421 0 |
| 422 }; |
| 423 static uchar yduff[] = |
| 424 { |
| 425 Ynone, Yi32, Zcall, 1, |
421 0 | 426 0 |
422 }; | 427 }; |
423 static uchar yjmp[] = | 428 static uchar yjmp[] = |
424 { | 429 { |
425 Ynone, Yml, Zo_m, 2, | 430 Ynone, Yml, Zo_m, 2, |
426 Ynone, Ybr, Zjmp, 0, | 431 Ynone, Ybr, Zjmp, 0, |
427 Ynone, Yi32, Zjmpcon, 1, | 432 Ynone, Yi32, Zjmpcon, 1, |
428 0 | 433 0 |
429 }; | 434 }; |
430 | 435 |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1140 { AAESENC, yaes, Pq, 0x38,0xdc,(0) }, | 1145 { AAESENC, yaes, Pq, 0x38,0xdc,(0) }, |
1141 { APINSRD, yinsrd, Pq, 0x3a, 0x22, (00) }, | 1146 { APINSRD, yinsrd, Pq, 0x3a, 0x22, (00) }, |
1142 { APSHUFB, ymshufb,Pq, 0x38, 0x00 }, | 1147 { APSHUFB, ymshufb,Pq, 0x38, 0x00 }, |
1143 | 1148 |
1144 { AUSEFIELD, ynop, Px, 0,0 }, | 1149 { AUSEFIELD, ynop, Px, 0,0 }, |
1145 { ATYPE }, | 1150 { ATYPE }, |
1146 { AFUNCDATA, yfuncdata, Px, 0,0 }, | 1151 { AFUNCDATA, yfuncdata, Px, 0,0 }, |
1147 { APCDATA, ypcdata, Px, 0,0 }, | 1152 { APCDATA, ypcdata, Px, 0,0 }, |
1148 { ACHECKNIL }, | 1153 { ACHECKNIL }, |
1149 { AVARDEF }, | 1154 { AVARDEF }, |
| 1155 { AVARKILL }, |
| 1156 { ADUFFCOPY, yduff, Px, 0xe8 }, |
| 1157 { ADUFFZERO, yduff, Px, 0xe8 }, |
1150 | 1158 |
1151 0 | 1159 0 |
1152 }; | 1160 }; |
1153 | 1161 |
1154 static int32 vaddr(Link*, Addr*, Reloc*); | 1162 static int32 vaddr(Link*, Addr*, Reloc*); |
1155 | 1163 |
1156 // single-instruction no-ops of various lengths. | 1164 // single-instruction no-ops of various lengths. |
1157 // constructed by hand and disassembled with gdb to verify. | 1165 // constructed by hand and disassembled with gdb to verify. |
1158 // see http://www.agner.org/optimize/optimizing_assembly.pdf for discussion. | 1166 // see http://www.agner.org/optimize/optimizing_assembly.pdf for discussion. |
1159 static uchar nop[][16] = { | 1167 static uchar nop[][16] = { |
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2370 if(p->to.sym == nil) { | 2378 if(p->to.sym == nil) { |
2371 ctxt->diag("call without target"); | 2379 ctxt->diag("call without target"); |
2372 sysfatal("bad code"); | 2380 sysfatal("bad code"); |
2373 } | 2381 } |
2374 *ctxt->andptr++ = op; | 2382 *ctxt->andptr++ = op; |
2375 r = addrel(ctxt->cursym); | 2383 r = addrel(ctxt->cursym); |
2376 r->off = p->pc + ctxt->andptr - ctxt->and; | 2384 r->off = p->pc + ctxt->andptr - ctxt->and; |
2377 r->type = D_PCREL; | 2385 r->type = D_PCREL; |
2378 r->siz = 4; | 2386 r->siz = 4; |
2379 r->sym = p->to.sym; | 2387 r->sym = p->to.sym; |
| 2388 r->add = p->to.offset; |
2380 put4(ctxt, 0); | 2389 put4(ctxt, 0); |
2381 break; | 2390 break; |
2382 | 2391 |
2383 case Zbr: | 2392 case Zbr: |
2384 case Zjmp: | 2393 case Zjmp: |
2385 case Zloop: | 2394 case Zloop: |
2386 if(p->to.sym != nil) { | 2395 if(p->to.sym != nil) { |
2387 if(t[2] != Zjmp) { | 2396 if(t[2] != Zjmp) { |
2388 ctxt->diag("branch to ATEXT"); | 2397 ctxt->diag("branch to ATEXT"); |
2389 sysfatal("bad code"); | 2398 sysfatal("bad code"); |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2675 return; | 2684 return; |
2676 } | 2685 } |
2677 } | 2686 } |
2678 | 2687 |
2679 doasm(ctxt, p); | 2688 doasm(ctxt, p); |
2680 if(ctxt->andptr > ctxt->and+sizeof ctxt->and) { | 2689 if(ctxt->andptr > ctxt->and+sizeof ctxt->and) { |
2681 print("and[] is too short - %ld byte instruction\n", ctxt->andpt
r - ctxt->and); | 2690 print("and[] is too short - %ld byte instruction\n", ctxt->andpt
r - ctxt->and); |
2682 sysfatal("bad code"); | 2691 sysfatal("bad code"); |
2683 } | 2692 } |
2684 } | 2693 } |
LEFT | RIGHT |