|
|
1.1 root 1: static char ID[] = "@(#) maps.c: 1.4 3/2/83";
2:
3: #include "system.h"
4: #include <stdio.h>
5: #include "structs.h"
6: #include "attributes.h"
7: #include "extrns.h"
8: #include "sgsmacros.h"
9:
10:
11: /*
12: * This version of maps.c, for m80ld, does NOT have:
13: * 1. REGION directives
14: * 2. physical addresses
15: */
16: /*eject*/
17: ldmap()
18: {
19:
20: /*
21: * Generate the output map requested through the "-m" flag
22: */
23:
24: register ANODE *a;
25:
26: /*
27: * Step 1: Output any non-default description of memory
28: */
29:
30: if (memlist.head != memlist.tail) {
31: register MEMTYPE *p;
32: printf("\n\n\n\t\t\tMEMORY CONFIGURATION\n");
33: printf("\nname\t\torigin\t\tlength\t\tattributes\n\n");
34: for( p = (MEMTYPE *) memlist.head; p; p = p->mtnext ) {
35: printf("%-8.8s\t%08.2lx\t%08.2lx\t ",
36: p->mtname, p->mtorig, p->mtlength);
37: if (p->mtattr & att_R) printf("R");
38: if (p->mtattr & att_W) printf("W");
39: if (p->mtattr & att_I) printf("I");
40: if (p->mtattr & att_X) printf("X");
41: printf("\n");
42: }
43: printf("\n\n");
44: }
45:
46: /*
47: * Step 2: Output the virtual memory map
48: */
49:
50: printf("\t\tLINK EDITOR MEMORY MAP\n\n");
51: printf("\noutput\t\tinput\t\tvirtual");
52: printf("\nsection\t\tsection\t\taddress\t\tsize\n");
53:
54: for (a = (ANODE *) avlist.head; a; a = a->adnext) {
55: long disp, ndx, vaddr;
56: unsigned fill;
57: register INSECT *isp;
58: register OUTSECT *osp;
59:
60: if (a->adtype == ADPAD)
61: continue;
62:
63: vaddr = a->adpaddr;
64:
65: if (a->adtype == ADAVAIL) {
66: printf("\n*avail*\t\t\t\t%08.2lx\t%08.2lx\n",
67: vaddr, a->adsize);
68: continue;
69: }
70:
71: osp = a->adscnptr;
72: printf("\n%-8.8s\t\t\t%08.2lx\t%08.2lx",
73: osp->oshdr.s_name, vaddr, a->adsize);
74: if (osp->oshdr.s_flags & STYP_DSECT)
75: printf("\tDSECT");
76: else if (osp->oshdr.s_flags & STYP_NOLOAD)
77: printf("\tNOLOAD");
78: else if (osp->oshdr.s_scnptr == 0L)
79: printf("\tuninitialized");
80: printf("\n");
81:
82: ndx = 0;
83: isp = osp->osinclhd;
84: if( (osp->oshdr.s_scnptr != 0L || isp) &&
85: (! equal(_TV,osp->oshdr.s_name,8)) )
86: while (ndx < osp->oshdr.s_size) {
87: if (isp)
88: disp = isp->isdispl;
89: else
90: disp = osp->oshdr.s_size;
91: if (ndx < disp) {
92: if (osp->osflags & FILL)
93: fill = osp->osfill;
94: else
95: fill = globfill;
96: printf("\t\t*fill*\t\t%08.2lx\t%08.2lx\t%06.2x\n",
97: vaddr + ndx,
98: disp - ndx, fill);
99: ndx = disp;
100: }
101: if (isp) {
102: if (isp->ishdr.s_size > 0) {
103: printf( "\t\t%-8.8s\t%08.2lx\t%08.2lx %s",
104: isp->ishdr.s_name,
105: vaddr + ndx,
106: isp->ishdr.s_size,
107: sname(isp->isfilptr->flname));
108: if( isp->isfilptr->flfilndx != -1 )
109: printf( " (%d)", isp->isfilptr->flfilndx);
110: printf( "\n" );
111: ndx += isp->ishdr.s_size;
112: }
113: isp = isp->isincnxt;
114: }
115: }
116: }
117: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.