LEFT | RIGHT |
1 // Inferno utils/6l/obj.c | 1 // Inferno utils/6l/obj.c |
2 // http://code.google.com/p/inferno-os/source/browse/utils/6l/obj.c | 2 // http://code.google.com/p/inferno-os/source/browse/utils/6l/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 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 case ATYPE: | 613 case ATYPE: |
614 if(skip) | 614 if(skip) |
615 goto casdef; | 615 goto casdef; |
616 pc++; | 616 pc++; |
617 goto loop; | 617 goto loop; |
618 | 618 |
619 case ANPTRS: | 619 case ANPTRS: |
620 if(skip) | 620 if(skip) |
621 goto casdef; | 621 goto casdef; |
622 if(cursym->nptrs != -1) { | 622 if(cursym->nptrs != -1) { |
623 » » » diag("ldobj1: multiple pointer maps defined for %s", s->
name); | 623 » » » diag("ldobj1: multiple pointer maps defined for %s", cur
sym->name); |
624 errorexit(); | 624 errorexit(); |
625 } | 625 } |
626 if(p->to.offset > cursym->args/PtrSize) { | 626 if(p->to.offset > cursym->args/PtrSize) { |
627 » » » diag("ldobj1: pointer map definition for %s exceeds its
argument size", s->name); | 627 » » » diag("ldobj1: pointer map definition for %s exceeds its
argument size", cursym->name); |
628 errorexit(); | 628 errorexit(); |
629 } | 629 } |
630 cursym->nptrs = p->to.offset; | 630 cursym->nptrs = p->to.offset; |
631 if(cursym->nptrs != 0) | 631 if(cursym->nptrs != 0) |
632 cursym->ptrs = mal((rnd(cursym->nptrs, 32) / 32) * sizeo
f(*cursym->ptrs)); | 632 cursym->ptrs = mal((rnd(cursym->nptrs, 32) / 32) * sizeo
f(*cursym->ptrs)); |
633 pc++; | 633 pc++; |
634 goto loop; | 634 goto loop; |
635 | 635 |
636 case APTRS: | 636 case APTRS: |
637 if(skip) | 637 if(skip) |
638 goto casdef; | 638 goto casdef; |
639 if(cursym->nptrs == -1 || cursym->ptrs == NULL) { | 639 if(cursym->nptrs == -1 || cursym->ptrs == NULL) { |
640 » » » diag("ldobj1: pointer map data provided for %s without a
definition", s->name); | 640 » » » diag("ldobj1: pointer map data provided for %s without a
definition", cursym->name); |
641 errorexit(); | 641 errorexit(); |
642 } | 642 } |
643 if(p->from.offset*32 >= rnd(cursym->nptrs, 32)) { | 643 if(p->from.offset*32 >= rnd(cursym->nptrs, 32)) { |
644 » » » diag("ldobj1: excessive pointer map data provided for %s
", s->name); | 644 » » » diag("ldobj1: excessive pointer map data provided for %s
", cursym->name); |
645 errorexit(); | 645 errorexit(); |
646 } | 646 } |
647 cursym->ptrs[p->from.offset] = p->to.offset; | 647 cursym->ptrs[p->from.offset] = p->to.offset; |
648 pc++; | 648 pc++; |
649 goto loop; | 649 goto loop; |
650 | 650 |
651 case ATEXT: | 651 case ATEXT: |
652 s = p->from.sym; | 652 s = p->from.sym; |
653 if(s->text != nil) { | 653 if(s->text != nil) { |
654 if(p->from.scale & DUPOK) { | 654 if(p->from.scale & DUPOK) { |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
824 { | 824 { |
825 Prog *p; | 825 Prog *p; |
826 | 826 |
827 p = prg(); | 827 p = prg(); |
828 p->link = q->link; | 828 p->link = q->link; |
829 q->link = p; | 829 q->link = p; |
830 p->line = q->line; | 830 p->line = q->line; |
831 p->mode = q->mode; | 831 p->mode = q->mode; |
832 return p; | 832 return p; |
833 } | 833 } |
LEFT | RIGHT |