LEFT | RIGHT |
1 // Inferno utils/8l/obj.c | 1 // Inferno utils/8l/obj.c |
2 // http://code.google.com/p/inferno-os/source/browse/utils/8l/obj.c | 2 // http://code.google.com/p/inferno-os/source/browse/utils/8l/obj.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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 case ATYPE: | 623 case ATYPE: |
624 if(skip) | 624 if(skip) |
625 goto casdef; | 625 goto casdef; |
626 pc++; | 626 pc++; |
627 goto loop; | 627 goto loop; |
628 | 628 |
629 case ANPTRS: | 629 case ANPTRS: |
630 if(skip) | 630 if(skip) |
631 goto casdef; | 631 goto casdef; |
632 if(cursym->nptrs != -1) { | 632 if(cursym->nptrs != -1) { |
633 » » » diag("ldobj1: multiple pointer maps defined for %s", s->
name); | 633 » » » diag("ldobj1: multiple pointer maps defined for %s", cur
sym->name); |
634 errorexit(); | 634 errorexit(); |
635 } | 635 } |
636 if(p->to.offset > cursym->args/PtrSize) { | 636 if(p->to.offset > cursym->args/PtrSize) { |
637 » » » diag("ldobj1: pointer map definition for %s exceeds its
argument size", s->name); | 637 » » » diag("ldobj1: pointer map definition for %s exceeds its
argument size", cursym->name); |
638 errorexit(); | 638 errorexit(); |
639 } | 639 } |
640 cursym->nptrs = p->to.offset; | 640 cursym->nptrs = p->to.offset; |
641 if(cursym->nptrs != 0) | 641 if(cursym->nptrs != 0) |
642 cursym->ptrs = mal((rnd(cursym->nptrs, 32) / 32) * sizeo
f(*cursym->ptrs)); | 642 cursym->ptrs = mal((rnd(cursym->nptrs, 32) / 32) * sizeo
f(*cursym->ptrs)); |
643 pc++; | 643 pc++; |
644 goto loop; | 644 goto loop; |
645 | 645 |
646 case APTRS: | 646 case APTRS: |
647 if(skip) | 647 if(skip) |
648 goto casdef; | 648 goto casdef; |
649 if(cursym->nptrs == -1 || cursym->ptrs == NULL) { | 649 if(cursym->nptrs == -1 || cursym->ptrs == NULL) { |
650 » » » diag("ldobj1: pointer map data provided for %s without a
definition", s->name); | 650 » » » diag("ldobj1: pointer map data provided for %s without a
definition", cursym->name); |
651 errorexit(); | 651 errorexit(); |
652 } | 652 } |
653 if(p->from.offset*32 >= rnd(cursym->nptrs, 32)) { | 653 if(p->from.offset*32 >= rnd(cursym->nptrs, 32)) { |
654 » » » diag("ldobj1: excessive pointer map data provided for %s
", s->name); | 654 » » » diag("ldobj1: excessive pointer map data provided for %s
", cursym->name); |
655 errorexit(); | 655 errorexit(); |
656 } | 656 } |
657 cursym->ptrs[p->from.offset] = p->to.offset; | 657 cursym->ptrs[p->from.offset] = p->to.offset; |
658 pc++; | 658 pc++; |
659 goto loop; | 659 goto loop; |
660 | 660 |
661 case ATEXT: | 661 case ATEXT: |
662 s = p->from.sym; | 662 s = p->from.sym; |
663 if(s->text != nil) { | 663 if(s->text != nil) { |
664 if(p->from.scale & DUPOK) { | 664 if(p->from.scale & DUPOK) { |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 appendp(Prog *q) | 817 appendp(Prog *q) |
818 { | 818 { |
819 Prog *p; | 819 Prog *p; |
820 | 820 |
821 p = prg(); | 821 p = prg(); |
822 p->link = q->link; | 822 p->link = q->link; |
823 q->link = p; | 823 q->link = p; |
824 p->line = q->line; | 824 p->line = q->line; |
825 return p; | 825 return p; |
826 } | 826 } |
LEFT | RIGHT |