From 451260e7dd80df8fea9a21ede7422aa9086de40f Mon Sep 17 00:00:00 2001 From: "Robert R. Henry" Date: Sat, 16 Aug 1980 01:04:25 -0800 Subject: [PATCH] use struct nlist; change field names; vgrind format fixes SCCS-vsn: old/as.vax/ascode.c 4.2 SCCS-vsn: old/as.vax/asexpr.c 4.2 SCCS-vsn: old/as.vax/asio.c 4.2 SCCS-vsn: old/as.vax/asjxxx.c 4.2 SCCS-vsn: old/as.vax/asmain.c 4.2 SCCS-vsn: old/as.vax/asparse.c 4.2 SCCS-vsn: old/as.vax/aspseudo.c 4.2 SCCS-vsn: old/as.vax/asscan.c 4.3 SCCS-vsn: old/as.vax/assyms.c 4.2 SCCS-vsn: old/as.vax/as.h 4.3 SCCS-vsn: old/as.vax/asexpr.h 4.2 SCCS-vsn: old/as.vax/asscan.h 4.3 SCCS-vsn: old/as.vax/assyms.h 4.2 --- usr/src/old/as.vax/as.h | 156 +++++++++++++------ usr/src/old/as.vax/ascode.c | 170 ++++++++++----------- usr/src/old/as.vax/asexpr.c | 89 ++++++----- usr/src/old/as.vax/asexpr.h | 10 +- usr/src/old/as.vax/asio.c | 3 +- usr/src/old/as.vax/asjxxx.c | 155 ++++++++++--------- usr/src/old/as.vax/asmain.c | 30 ++-- usr/src/old/as.vax/asparse.c | 274 ++++++++++++++++++---------------- usr/src/old/as.vax/aspseudo.c | 16 +- usr/src/old/as.vax/asscan.c | 40 ++--- usr/src/old/as.vax/asscan.h | 2 +- usr/src/old/as.vax/assyms.c | 205 ++++++++++++------------- usr/src/old/as.vax/assyms.h | 5 +- 13 files changed, 597 insertions(+), 558 deletions(-) diff --git a/usr/src/old/as.vax/as.h b/usr/src/old/as.vax/as.h index d3808711fc..1d9a55187b 100644 --- a/usr/src/old/as.vax/as.h +++ b/usr/src/old/as.vax/as.h @@ -1,12 +1,33 @@ /* Copyright (c) 1980 Regents of the University of California */ -/* "@(#)as.h 4.2 %G%" */ +/* "@(#)as.h 4.3 %G%" */ #ifdef VMS # define vax 1 # define VAX 1 #endif VMS -#define readonly +#include +#ifdef UNIX + +#ifdef FLEXNAMES +# include +# include +#else not FLEXNAMES +# include +# include +#endif FLEXNAMES + +#endif UNIX +#ifdef VMS + +#ifdef UNIXDEVEL +# include +#else not UNIXDEVEL +# include +#endif not UNIXDEVEL + +#endif VMS +#define readonly #define NINST 300 #define NEXP 20 /* max number of expr. terms per instruction */ @@ -171,61 +192,100 @@ * Symbol table entries are used for both user defined symbols, * and symbol slots generated to create the jxxx jump from * slots. + * Caution: the instructions are stored in a shorter version + * of the struct symtab, using all fields in sym_nm and + * tag. The fields used in sym_nm are carefully redeclared + * in struct Instab and struct instab (see below). + * If struct nlist gets changed, then Instab and instab may + * have to be changed. */ -#define symfirstfields char *name; unsigned char tag, type - struct symtab{ - symfirstfields; - short ___hole; - char ptype; /*tag == NAME*/ - -#define jxbump ptype /*tag == JX..., how far to expand*/ - - char other; /*for stab info*/ - - short desc; /*tag == NAME*/ - -#define jxfear desc /*how far needs to be bumped*/ - - long value; /*address in the segment*/ - char jxoveralign; /*if a JXXX, jumped over an align*/ - short index; /*which segment*/ - struct symtab *dest; /*if JXXX, where going to*/ + struct nlist s_nm; + u_char s_tag; /* assembler tag */ + u_char s_ptype; /* if tag == NAME */ + u_char s_jxoveralign; /* if a JXXX, jumped over align */ + short s_index; /* which segment */ + struct symtab *s_dest; /* if JXXX, where going to */ #ifdef DJXXX - short jxline; /*source line of the jump from*/ + short s_jxline; /* source line of the jump from */ #endif }; - -struct instab{ - symfirstfields; - -#define opcode type /*use the same field as symtab.type*/ - - char nargs; /*how many arguments*/ - char argtype[6]; /*argument type info*/ +/* + * Redefinitions of the fields in symtab for + * use when the symbol table entry marks a jxxx instruction. + */ +#define s_jxbump s_ptype /* tag == JX..., how far to expand */ +#define s_jxfear s_desc /* how far needs to be bumped */ +/* + * Redefinitions of fields in the struct nlist for symbols so that + * one saves typing, and so that they conform + * with the old naming conventions. + */ +#ifdef FLEXNAMES +#define s_name s_nm.n_un.n_name /* name pointer */ +#define s_nmx s_nm.n_un.n_strx /* string table index */ +#else not FLEXNAMES +#define s_name s_nm.n_name +#endif +#define s_type s_nm.n_type /* type of the symbol */ +#define s_other s_nm.n_other /* other information for sdb */ +#define s_desc s_nm.n_desc /* type descriptor */ +#define s_value s_nm.n_value /* value of the symbol, or sdb delta */ + +struct instab{ + struct nlist s_nm; /* instruction name, type (opcode) */ + u_char s_tag; }; +/* + * The fields nm.n_desc and nm.n_value total 6 bytes; this is + * just enough for the 6 bytes describing the argument types. + * We use a macro to define access to these 6 bytes, assuming that + * they are allocated adjacently. + * IF THE FORMAT OF STRUCT nlist CHANGES, THESE MAY HAVE TO BE CHANGED. + * + * Instab is cleverly declared to look very much the combination of + * a struct symtab and a struct nlist. + */ +struct Instab{ +#ifdef FLEXNAMES + char *I_name; +#else not FLEXNAMES + char I_name[NCPS]; +#endif + u_char I_opcode; + char I_nargs; + char I_args[6]; + u_char I_s_tag; +}; +/* + * Redefinitions of fields in the struct nlist for instructions so that + * one saves typing, and conforms to the old naming conventions + */ +#define i_opcode s_nm.n_type /* use the same field as symtab.type */ +#define i_nargs s_nm.n_other /* number of arguments */ +#define fetcharg(ptr, n) ((struct Instab *)ptr)->I_args[n] struct arg { /*one argument to an instruction*/ - char atype; - char areg1; - char areg2; - char dispsize; /*usually d124, unless have B^, etc*/ - struct exp *xp; + char a_atype; + char a_areg1; + char a_areg2; + char a_dispsize; /*usually d124, unless have B^, etc*/ + struct exp *a_xp; }; struct exp { - long xvalue; /* MUST be the first field (look at union Double) */ - long yvalue; /* MUST be second field; least sig word of a double */ - char xtype; - char xloc; - struct symtab *xname; + long e_xvalue; /* MUST be the first field (look at union Double) */ + long e_yvalue; /* MUST be second field; least sig word of a double */ + char e_xtype; + char e_xloc; + struct symtab *e_xname; }; -#define doub_MSW xvalue -#define doub_LSW yvalue +#define doub_MSW e_xvalue +#define doub_LSW e_yvalue -union Double { +union Double { struct{ long doub_MSW; long doub_LSW; @@ -233,7 +293,7 @@ union Double { double dvalue; }; -struct Quad { +struct Quad { long quad_low_long; long quad_high_long; }; @@ -274,8 +334,8 @@ struct Quad { extern struct symtab *lastjxxx; #ifdef VMS - extern char *vms_obj_ptr; /* object buffer pointer */ - extern char sobuf[]; /* object buffer */ + extern char *vms_obj_ptr; /* object buffer pointer */ + extern char sobuf[]; /* object buffer */ extern int objfil; /* VMS object file descriptor */ #endif VMS @@ -336,7 +396,7 @@ struct Quad { * Information about the instructions */ extern struct instab *itab[NINST]; /*maps opcodes to instructions*/ - extern readonly struct instab instab[]; + extern readonly struct Instab instab[]; extern int curlen; /*current literal storage size*/ extern int d124; /*current pointer storage size*/ @@ -344,9 +404,9 @@ struct Quad { struct symtab **lookup(); /*argument in yytext*/ struct symtab *symalloc(); -#define outb(val) {dotp->xvalue++; if (passno==2) bputc((val), (txtfil));} +#define outb(val) {dotp->e_xvalue++; if (passno==2) bputc((val), (txtfil));} -#define outs(cp, lg) dotp->xvalue += (lg); if (passno == 2) bwrite((cp), (lg), (txtfil)) +#define outs(cp, lg) dotp->e_xvalue += (lg); if (passno == 2) bwrite((cp), (lg), (txtfil)) /* * Most of the time, the argument to flushfield is a power of two constant, diff --git a/usr/src/old/as.vax/ascode.c b/usr/src/old/as.vax/ascode.c index e5d9c50490..ba0001f9f2 100644 --- a/usr/src/old/as.vax/ascode.c +++ b/usr/src/old/as.vax/ascode.c @@ -1,8 +1,6 @@ /* Copyright (c) 1980 Regents of the University of California */ -static char sccsid[] = "@(#)ascode.c 4.1 %G%"; +static char sccsid[] = "@(#)ascode.c 4.2 %G%"; #include -#include -#include #include "as.h" #include "assyms.h" @@ -20,7 +18,7 @@ insout(op, ap, nact) register struct instab *ip; int i,nexp; ip = itab[op]; - nexp = ip->nargs; + nexp = ip->i_nargs; if (nact < nexp) yyerror("Too few arguments"); if (nact > nexp) { @@ -31,7 +29,7 @@ insout(op, ap, nact) * Check argument compatability with instruction template */ for (ap2 = ap+nact, i = nact; --i >= 0;) - argcompat(--ap2, ip->argtype[i], i+1); + argcompat(--ap2, fetcharg(ip, i), i+1); } if (jxxflg < 0) ijxout(op, ap, nact); @@ -44,7 +42,7 @@ argcompat(act, exp, i) { register at,atm; - at = act->atype; + at = act->a_atype; atm = at & AMASK; if ( (exp & ACCB) && (!((atm == AEXP) || (atm == AIMM))) ){ @@ -60,7 +58,7 @@ argcompat(act, exp, i) return; } if (at & AINDX) { - if (act->areg2==017) { + if (act->a_areg2==017) { yyerror("arg %d, PC used as index",i); return; } @@ -72,7 +70,7 @@ argcompat(act, exp, i) yyerror("arg %d, indexing a constant",i); return; } - if (((atm==ADECR) || (atm==AINCR)) && (act->areg1==act->areg2)) { + if (((atm==ADECR) || (atm==AINCR)) && (act->a_areg1==act->a_areg2)) { yyerror("arg %d, indexing with modified register",i); return; } @@ -99,57 +97,55 @@ putins(op, ap, n) if (passno == 2) goto PASS2; - dotp->xvalue += n+1; /* 1 for the opcode, at least 1 per arg */ - for (i=0; iatype; + dotp->e_xvalue += n+1; /* 1 for the opcode, at least 1 per arg */ + for (i=0; ia_atype; if (a & AINDX) - dotp->xvalue++; + dotp->e_xvalue++; switch (a&~(AINDX|ASTAR)) { case AEXP: - a = itab[op]->argtype[i]; + a = fetcharg(itab[op], i); if (a == ACCB+TYPB) break; if (a==ACCB+TYPW){ - dotp->xvalue++; + dotp->e_xvalue++; break; } /* * Reduces to PC relative */ - xtrab++; - dotp->xvalue += ap->dispsize; + dotp->e_xvalue += ap->a_dispsize; break; case ADISP: - xp=ap->xp; - if ((xp->xtype&XTYPE)!=XABS || xp->xtype&XFORW){ - dotp->xvalue += ap->dispsize; + xp=ap->a_xp; + if ((xp->e_xtype&XTYPE)!=XABS || xp->e_xtype&XFORW){ + dotp->e_xvalue += ap->a_dispsize; break; } - if (xp->xvalue==0 && !(a&ASTAR)) + if (xp->e_xvalue==0 && !(a&ASTAR)) break; - dotp->xvalue++; - if ((xp->xvaluexvalue>MAXBYTE)) - dotp->xvalue++; - if ((xp->xvaluexvalue>MAXWORD)) - dotp->xvalue += 2; + dotp->e_xvalue++; + if ((xp->e_xvaluee_xvalue>MAXBYTE)) + dotp->e_xvalue++; + if ((xp->e_xvaluee_xvalue>MAXWORD)) + dotp->e_xvalue += 2; break; case AIMM: - if (ap->atype&ASTAR) a=TYPL; + if (ap->a_atype&ASTAR) a=TYPL; else { - a = itab[op]->argtype[i]; + a = fetcharg(itab[op], i); if (a&ACCA) a = TYPL; else a &= TYPMASK; - xp = ap->xp; - if ( ((xp->xtype&XTYPE)==XABS) - && (!(xp->xtype&XFORW)) - && (xp->xvalue>=0) - && (xp->xvalue<=63) - && (xp->yvalue == 0) + xp = ap->a_xp; + if ( ((xp->e_xtype&XTYPE)==XABS) + && (!(xp->e_xtype&XFORW)) + && (xp->e_xvalue>=0) + && (xp->e_xvalue<=63) + && (xp->e_yvalue == 0) && (a != TYPD) && (a != TYPF) ) @@ -158,23 +154,23 @@ putins(op, ap, n) switch (a) { case TYPD: case TYPF: - if ( !(((xp->xtype&XTYPE)==XABS) - && (!(xp->xtype&XFORW)) + if ( !(((xp->e_xtype&XTYPE)==XABS) + && (!(xp->e_xtype&XFORW)) && (slitflt(xp))) ){ /* it is NOT short */ - dotp->xvalue += ((a==TYPF)? + dotp->e_xvalue += ((a==TYPF)? 4 : 8); } break; case TYPQ: - dotp->xvalue += 8;break; + dotp->e_xvalue += 8;break; case TYPL: - dotp->xvalue += 4;break; + dotp->e_xvalue += 4;break; case TYPW: - dotp->xvalue += 2;break; + dotp->e_xvalue += 2;break; case TYPB: - dotp->xvalue += 1;break; + dotp->e_xvalue += 1;break; } /*end of the switch on a*/ } /*end of the switch on the type*/ } /*end of looping for all arguments*/ @@ -187,115 +183,115 @@ PASS2: #endif UNIX #ifdef VMS *vms_obj_ptr++ = -1; *vms_obj_ptr++ = (char)op; - dotp->xvalue += 1; + dotp->e_xvalue += 1; #endif VMS for (i=0; iatype; - xp=ap->xp; + a=ap->a_atype; + xp=ap->a_xp; xtrab=0; if (a&AINDX) { #ifdef UNIX - { outb(0x40 | ap->areg2); } + { outb(0x40 | ap->a_areg2); } #endif UNIX #ifdef VMS { *vms_obj_ptr++ = -1; - *vms_obj_ptr++ = (0x40 | ap->areg2); - dotp->xvalue += 1; } + *vms_obj_ptr++ = (0x40 | ap->a_areg2); + dotp->e_xvalue += 1; } #endif VMS a &= ~AINDX; } if (a&ASTAR) { - ap->areg1 |= 0x10; + ap->a_areg1 |= 0x10; a &= ~ASTAR; } switch (a) { case AREG: /* %r */ - ap->areg1 |= 0x50; + ap->a_areg1 |= 0x50; break; case ABASE: /* (%r) */ - ap->areg1 |= 0x60; + ap->a_areg1 |= 0x60; break; case ADECR: /* -(%r) */ - ap->areg1 |= 0x70; + ap->a_areg1 |= 0x70; break; case AINCR: /* (%r) */ - ap->areg1 |= 0x80; + ap->a_areg1 |= 0x80; break; case AEXP: /* expr */ - a = itab[op]->argtype[i]; + a = fetcharg(itab[op], i); if (a == ACCB+TYPB) { - ap->areg1 = a = - xp->xvalue - (dotp->xvalue + 1); + ap->a_areg1 = a = + xp->e_xvalue - (dotp->e_xvalue + 1); if (aMAXBYTE) yyerror("Branch too far"); break; } if (a == ACCB+TYPW) { - ap->areg1 = a = xp->xvalue - -= dotp->xvalue + 2; - xp->xtype = XABS; + ap->a_areg1 = a = xp->e_xvalue + -= dotp->e_xvalue + 2; + xp->e_xtype = XABS; if (aMAXWORD) yyerror("Branch too far"); - xp->xvalue = a>>8; + xp->e_xvalue = a>>8; xtrab = LEN1; break; } /* reduces to expr(pc) mode */ - ap->areg1 |= (0xAF + mod124[ap->dispsize]); - xtrab = len124[ap->dispsize]+PCREL; + ap->a_areg1 |= (0xAF + mod124[ap->a_dispsize]); + xtrab = len124[ap->a_dispsize]+PCREL; break; case ADISP: /* expr(%r) */ - ap->areg1 |= 0xA0; - if ((xp->xtype&XTYPE)!=XABS || xp->xtype&XFORW){ - ap->areg1 += mod124[ap->dispsize]; - xtrab=len124[ap->dispsize]; + ap->a_areg1 |= 0xA0; + if ((xp->e_xtype&XTYPE)!=XABS || xp->e_xtype&XFORW){ + ap->a_areg1 += mod124[ap->a_dispsize]; + xtrab=len124[ap->a_dispsize]; break; } - if (xp->xvalue==0 && !(ap->areg1&0x10)) { - ap->areg1 ^= 0xC0; + if (xp->e_xvalue==0 && !(ap->a_areg1&0x10)) { + ap->a_areg1 ^= 0xC0; break; } xtrab=LEN1; - if ((xp->xvaluexvalue>MAXBYTE)){ - ap->areg1 += 0x20; + if ((xp->e_xvaluee_xvalue>MAXBYTE)){ + ap->a_areg1 += 0x20; xtrab=LEN2; } - if ((xp->xvaluexvalue>MAXWORD)){ - ap->areg1 += 0x20; + if ((xp->e_xvaluee_xvalue>MAXWORD)){ + ap->a_areg1 += 0x20; xtrab=LEN4; } break; case AIMM: /* $expr */ - if (ap->atype&ASTAR) + if (ap->a_atype&ASTAR) a=TYPL; else { - a = itab[op]->argtype[i]; + a = fetcharg(itab[op], i); if (a&ACCA) a=TYPL; else a &= TYPMASK; - if ( ( (xp->xtype&XTYPE) == XABS) - && !(xp->xtype&XFORW) - && (xp->xvalue >= 0) - && (xp->xvalue <= 63) - && (xp->yvalue == 0) + if ( ( (xp->e_xtype&XTYPE) == XABS) + && !(xp->e_xtype&XFORW) + && (xp->e_xvalue >= 0) + && (xp->e_xvalue <= 63) + && (xp->e_yvalue == 0) && (a != TYPF) && (a != TYPD) ) { - ap->areg1 = xp->xvalue; + ap->a_areg1 = xp->e_xvalue; break; } } - ap->areg1 |= 0x8F; + ap->a_areg1 |= 0x8F; switch (a) { case TYPD: case TYPF: - if ( ((xp->xtype&XTYPE)==XABS) - && (!(xp->xtype&XFORW)) + if ( ((xp->e_xtype&XTYPE)==XABS) + && (!(xp->e_xtype&XFORW)) && (slitflt(xp)) ){ - ap->areg1=extlitflt(xp); + ap->a_areg1=extlitflt(xp); } else { xtrab = (a==TYPF) ? LEN4: LEN8; } @@ -312,11 +308,11 @@ PASS2: * use the first byte to describe the argument */ #ifdef UNIX - outb(ap->areg1); + outb(ap->a_areg1); #endif UNIX #ifdef VMS - *vms_obj_ptr++ = -1; *vms_obj_ptr++ = (char)(ap->areg1); - dotp->xvalue += 1; + *vms_obj_ptr++ = -1; *vms_obj_ptr++ = (char)(ap->a_areg1); + dotp->e_xvalue += 1; if ((vms_obj_ptr-sobuf) > 400) { write(objfil,sobuf,vms_obj_ptr-sobuf); vms_obj_ptr=sobuf+1; @@ -330,6 +326,6 @@ PASS2: * immediately follow the field xvalue, which * they do. */ - outrel(&xp->xvalue, xtrab, xp->xtype, xp->xname); + outrel(&xp->e_xvalue, xtrab, xp->e_xtype, xp->e_xname); } /*end of the for to pick up all arguments*/ } diff --git a/usr/src/old/as.vax/asexpr.c b/usr/src/old/as.vax/asexpr.c index 9a249644bb..fa07f44f53 100644 --- a/usr/src/old/as.vax/asexpr.c +++ b/usr/src/old/as.vax/asexpr.c @@ -1,7 +1,6 @@ /* Copyright (c) 1980 Regents of the University of California */ -static char sccsid[] = "@(#)asexpr.c 4.1 %G%"; +static char sccsid[] = "@(#)asexpr.c 4.2 %G%"; #include -#include #include "as.h" #include "asexpr.h" @@ -57,81 +56,81 @@ combine(op, exp1, exp2) register struct exp *exp1, *exp2; { register e1_type, e2_type; - register type; + register back_type; lastnam=0; /* kludge for jxxx instructions */ - e1_type = exp1->xtype&XTYPE; - e2_type = exp2->xtype&XTYPE; + e1_type = exp1->e_xtype&XTYPE; + e2_type = exp2->e_xtype&XTYPE; - if (exp1->xtype==XXTRN+XUNDEF) + if (exp1->e_xtype==XXTRN+XUNDEF) e1_type = XTXRN; - if (exp2->xtype==XXTRN+XUNDEF) + if (exp2->e_xtype==XXTRN+XUNDEF) e2_type = XTXRN; if (passno==1) - if (exp1->xloc!=exp2->xloc && e1_type==e2_type) + if (exp1->e_xloc!=exp2->e_xloc && e1_type==e2_type) e1_type = e2_type = XTXRN; /* error on != loc ctrs */ e1_type >>= 1; /*dispose of the external (XXTRN) bit*/ e2_type >>= 1; switch (op) { case PLUS: - exp1->xvalue += exp2->xvalue; - type = pltab[e1_type][e2_type]; + exp1->e_xvalue += exp2->e_xvalue; + back_type = pltab[e1_type][e2_type]; break; case MINUS: - exp1->xvalue -= exp2->xvalue; - type = mintab[e1_type][e2_type]; + exp1->e_xvalue -= exp2->e_xvalue; + back_type = mintab[e1_type][e2_type]; break; case IOR: - exp1->xvalue |= exp2->xvalue; + exp1->e_xvalue |= exp2->e_xvalue; goto comm; case XOR: - exp1->xvalue ^= exp2->xvalue; + exp1->e_xvalue ^= exp2->e_xvalue; goto comm; case AND: - exp1->xvalue &= exp2->xvalue; + exp1->e_xvalue &= exp2->e_xvalue; goto comm; case ORNOT: - exp1->xvalue |= ~exp2->xvalue; + exp1->e_xvalue |= ~exp2->e_xvalue; goto comm; case LSH: - exp1->xvalue <<= exp2->xvalue; + exp1->e_xvalue <<= exp2->e_xvalue; goto comm; case RSH: - exp1->xvalue >>= exp2->xvalue; + exp1->e_xvalue >>= exp2->e_xvalue; goto comm; case TILDE: - exp1->xvalue |= ~ exp2->xvalue; + exp1->e_xvalue |= ~ exp2->e_xvalue; goto comm; case MUL: - exp1->xvalue *= exp2->xvalue; + exp1->e_xvalue *= exp2->e_xvalue; goto comm; case DIV: - if (exp2->xvalue == 0) + if (exp2->e_xvalue == 0) yyerror("Divide check"); else - exp1->xvalue /= exp2->xvalue; + exp1->e_xvalue /= exp2->e_xvalue; goto comm; case REGOP: - if (exp2->xvalue == 0) + if (exp2->e_xvalue == 0) yyerror("Divide check (modulo)"); else - exp1->xvalue %= exp2->xvalue; + exp1->e_xvalue %= exp2->e_xvalue; goto comm; comm: - type = othtab[e1_type][e2_type]; + back_type = othtab[e1_type][e2_type]; break; default: yyerror("Internal error: unknown operator"); } if (e2_type==(XTXRN>>1)) - exp1->xname = exp2->xname; - exp1->xtype = type | ( - (exp1->xtype|exp2->xtype) & (XFORW|XXTRN) ); - if (type==ERR) + exp1->e_xname = exp2->e_xname; + exp1->e_xtype = back_type | ( + (exp1->e_xtype|exp2->e_xtype) & (XFORW|XXTRN) ); + if (back_type==ERR) yyerror("Relocation error"); return(exp1); } @@ -257,15 +256,15 @@ struct exp *factor() op = val; shift; lexpr = xp++; - lexpr->xtype = XABS; - lexpr->xvalue = 0; + lexpr->e_xtype = XABS; + lexpr->e_xvalue = 0; lexpr = combine(op, lexpr, factor()); } else { yyerror("Bad expression syntax"); lexpr = xp++; - lexpr->xtype = XABS; - lexpr->xvalue = 0; + lexpr->e_xtype = XABS; + lexpr->e_xvalue = 0; } return(lexpr); } @@ -282,7 +281,7 @@ struct exp *yukkyexpr(val, np) if (val == NAME || val == BFINT){ if (val == BFINT) { int off = 0; - yylval = ((struct exp *)np)->xvalue; + yylval = ((struct exp *)np)->e_xvalue; if (yylval < 0) { yylval = -yylval; yylval--; @@ -298,21 +297,21 @@ struct exp *yukkyexpr(val, np) lastnam = (struct symtab *)np; } exprisname++; - locxp->xtype = ((struct symtab *)np)->type; - if (( ((struct symtab *)np)->type&XTYPE)==XUNDEF) { /*forward*/ - locxp->xname = (struct symtab *)np; - locxp->xvalue = 0; + locxp->e_xtype = ((struct symtab *)np)->s_type; + if (( ((struct symtab *)np)->s_type&XTYPE)==XUNDEF) { /*forward*/ + locxp->e_xname = (struct symtab *)np; + locxp->e_xvalue = 0; if (passno==1) - ((struct symtab *)np)->type |= XFORW; + ((struct symtab *)np)->s_type |= XFORW; } else { /*otherwise, just get the value*/ - locxp->xvalue = ((struct symtab *)np)->value; - locxp->xname = NULL; + locxp->e_xvalue = ((struct symtab *)np)->s_value; + locxp->e_xname = NULL; } } else { /*INSTn or INST0 or REG*/ - locxp->xtype = XABS; - locxp->xvalue = ( (int)np) & 0xFF; - locxp->xloc = 0; - locxp->xname = NULL; + locxp->e_xtype = XABS; + locxp->e_xvalue = ( (int)np) & 0xFF; + locxp->e_xloc = 0; + locxp->e_xname = NULL; } return(locxp); diff --git a/usr/src/old/as.vax/asexpr.h b/usr/src/old/as.vax/asexpr.h index c3ebd6b943..2246ffaaf1 100644 --- a/usr/src/old/as.vax/asexpr.h +++ b/usr/src/old/as.vax/asexpr.h @@ -1,5 +1,5 @@ /* Copyright (c) 1980 Regents of the University of California */ -/* "@(#)asexpr.h 4.1 %G%" */ +/* "@(#)asexpr.h 4.2 %G%" */ /* * Definitions to parse tokens */ @@ -45,13 +45,13 @@ struct exp *yukkyexpr(); extern char tokensets[(LASTTOKEN) - (FIRSTTOKEN) + 1]; -#define LINSTBEGIN 01 /*SEMI, NL, NAME*/ +#define LINSTBEGIN 01 /*SEMI, NL, NAME*/ #define EBEGOPS 02 /*LP, MINUS, TILDE*/ -#define YUKKYEXPRBEG 04 /*NAME, INSTn, INST0, REG, DOT*/ +#define YUKKYEXPRBEG 04 /*NAME, INSTn, INST0, REG, BFINT*/ #define SAFEEXPRBEG 010 /*INT, FLTNUM*/ -#define ADDOPS 020 /*PLUS, MINUS*/ +#define ADDOPS 020 /*PLUS, MINUS*/ #define BOOLOPS 040 /*IOR, XOR, AND*/ -#define MULOPS 0100 /*LSH, RSH, MUL, DIV, TILDE*/ +#define MULOPS 0100 /*LSH, RSH, MUL, DIV, TILDE*/ #define INTOKSET(val, set) (tokensets[(val)] & (set) ) diff --git a/usr/src/old/as.vax/asio.c b/usr/src/old/as.vax/asio.c index d9f1a31300..873b92ac10 100644 --- a/usr/src/old/as.vax/asio.c +++ b/usr/src/old/as.vax/asio.c @@ -1,7 +1,6 @@ /* Coypright (c) 1980 Regents of the University of California */ -static char sccsid[] = "@(#)asio.c 4.1 %G%"; +static char sccsid[] = "@(#)asio.c 4.2 %G%"; #include -#include #include "as.h" /* * Block I/O routines for logical I/O concurrently in diff --git a/usr/src/old/as.vax/asjxxx.c b/usr/src/old/as.vax/asjxxx.c index a4164263c5..a3d4a452de 100644 --- a/usr/src/old/as.vax/asjxxx.c +++ b/usr/src/old/as.vax/asjxxx.c @@ -1,7 +1,6 @@ /* Copyright (c) 1980 Regents of the University of California */ -static char sccsid[] = "@(#)asjxxx.c 4.1 %G%"; +static char sccsid[] = "@(#)asjxxx.c 4.2 %G%"; #include -#include #include "as.h" #include "assyms.h" @@ -42,23 +41,23 @@ ijxout(op,ap,nact) */ putins(op,ap,nact); jumpfrom = lastjxxx; - jumpfrom->tag = JXACTIVE; - jumpfrom->jxbump = 0; + jumpfrom->s_tag = JXACTIVE; + jumpfrom->s_jxbump = 0; if (op == JBR) - jumpfrom->jxfear = JBRFSIZE; + jumpfrom->s_jxfear = JBRFSIZE; else - jumpfrom->jxfear = JXXXFSIZE; + jumpfrom->s_jxfear = JXXXFSIZE; if (lastnam == 0) yyerror("jxxx destination not a label"); - jumpfrom->dest = lastnam; - jumpfrom->type = dotp->xtype; /*only TEXT or DATA*/ - jumpfrom->index = dotp-usedot; + jumpfrom->s_dest = lastnam; + jumpfrom->s_type = dotp->e_xtype; /*only TEXT or DATA*/ + jumpfrom->s_index = dotp-usedot; /* * value ALWAYS (ALWAYS!!!) indexes the next instruction * after the jump, even in the jump must be exploded * (bumped) */ - jumpfrom->value = dotp->xvalue; + jumpfrom->s_value = dotp->e_xvalue; njxxx++; } else {/* pass2, resolve */ /* @@ -70,25 +69,25 @@ ijxout(op,ap,nact) register struct arg *aplast; aplast = ap + nact - 1; - xp = aplast->xp; - if (lastjxxx->tag == JXTUNNEL){ - lastjxxx->tag = JXINACTIVE; - tunnel = lastjxxx->dest; - xp->xvalue = tunnel->value /*index of instruction following*/ + xp = aplast->a_xp; + if (lastjxxx->s_tag == JXTUNNEL){ + lastjxxx->s_tag = JXINACTIVE; + tunnel = lastjxxx->s_dest; + xp->e_xvalue = tunnel->s_value /*index of instruction following*/ - 3 /* size of brw + word*/ - + ( ( (tunnel->jxfear == JBRFSIZE) && - (tunnel->jxbump == 0))?1:0); + + ( ( (tunnel->s_jxfear == JBRFSIZE) && + (tunnel->s_jxbump == 0))?1:0); /*non bumped branch byteis only 2 back*/ } - if (lastjxxx->jxbump == 0){ /*wasn't bumped, so is short form*/ + if (lastjxxx->s_jxbump == 0){ /*wasn't bumped, so is short form*/ putins(op, ap, nact); } else { if (op != JBR){ /*branch reverse conditional byte over branch unconditional word*/ - oxvalue = xp->xvalue; - xp->xvalue = lastjxxx->value; + oxvalue = xp->e_xvalue; + xp->e_xvalue = lastjxxx->s_value; putins(op^1, ap, nact); - xp->xvalue = oxvalue; + xp->e_xvalue = oxvalue; } putins(BRW, aplast, 1); } @@ -100,16 +99,16 @@ jalign(xp, sp) register struct symtab *sp; { register int mask; - if (xp->xtype != XABS || xp->xvalue < 0 || xp->xvalue > 16) { + if (xp->e_xtype != XABS || xp->e_xvalue < 0 || xp->e_xvalue > 16) { yyerror("Illegal `align' argument"); return; } flushfield(NBPW/4); if (passno == 1) { - sp->tag = JXALIGN; - sp->jxfear = (1 << xp->xvalue) - 1; - sp->type = dotp->xtype; - sp->index = dotp-usedot; + sp->s_tag = JXALIGN; + sp->s_jxfear = (1 << xp->e_xvalue) - 1; + sp->s_type = dotp->e_xtype; + sp->s_index = dotp-usedot; /* * We guess that the align will take up at least one * byte in the code output. We will correct for this @@ -123,19 +122,19 @@ jalign(xp, sp) * the code stream point to the next byte following * the logical entry in the symbol table */ - dotp->xvalue += 1; - sp->value = dotp->xvalue; + dotp->e_xvalue += 1; + sp->s_value = dotp->e_xvalue; njxxx++; } else { - mask = (1 << xp->xvalue) - 1; - while (dotp->xvalue & mask){ + mask = (1 << xp->e_xvalue) - 1; + while (dotp->e_xvalue & mask){ #ifdef UNIX outb(0); #endif UNIX #ifdef VMS *vms_obj_ptr++ = -1; *vms_obj_ptr++ = 0; - dotp->xvalue += 1; + dotp->e_xvalue += 1; #endif VMS } } @@ -189,26 +188,26 @@ jxxxfix() */ tunnel = 0; /*initially, no tunnel*/ SEGITERATE(segno, 0, 0, cojumpfrom, jumpfrom, ubjumpfrom, ++){ - tag = jumpfrom->tag; + tag = jumpfrom->s_tag; if (tag <= IGNOREBOUND) continue; /*just an ordinary symbol*/ if (tag == JXALIGN){ tunnel = 0; /*avoid tunneling across a flex alocation*/ continue; /*we take care of these later*/ } - if ( jumpfrom->jxfear == JBRFSIZE /*unconditional*/ + if ( jumpfrom->s_jxfear == JBRFSIZE /*unconditional*/ || ( tag == JXINACTIVE /*inactive bumped*/ - && (jumpfrom->jxbump != 0) + && (jumpfrom->s_jxbump != 0) ) ) tunnel = jumpfrom; if (tag != JXACTIVE) continue; - dest = jumpfrom->dest; - if (jumpfrom->index != dest->index){ + dest = jumpfrom->s_dest; + if (jumpfrom->s_index != dest->s_index){ yyerror("Intersegment jxxx"); continue; } - displ = dest->value - jumpfrom->value; + displ = dest->s_value - jumpfrom->s_value; if (displ < MINBYTE || displ > MAXBYTE) { /* * This is an immediate lose! @@ -222,27 +221,27 @@ jxxxfix() * its relative position will be unaffected * by future jxxx expansions. */ - if ( (jumpfrom->jxfear > JBRFSIZE) + if ( (jumpfrom->s_jxfear > JBRFSIZE) && (tunnel) - && (tunnel->dest == jumpfrom->dest) - && (tunnel->index == jumpfrom->index) - && (tunnel->value - jumpfrom->value >= + && (tunnel->s_dest == jumpfrom->s_dest) + && (tunnel->s_index == jumpfrom->s_index) + && (tunnel->s_value - jumpfrom->s_value >= MINBYTE + JXXXFSIZE) ) { /* * tunnelling is OK */ - jumpfrom->dest = tunnel; + jumpfrom->s_dest = tunnel; /* * no bumping needed, this * is now effectively inactive * but must be remembered */ - jumpfrom->tag = JXTUNNEL; + jumpfrom->s_tag = JXTUNNEL; #ifdef DEBUG if(debug) printf("Tunnel from %s from line %d\n", - jumpfrom->name, lineno); + jumpfrom->s_name, lineno); #endif continue; } else { /*tunneling not possible*/ @@ -253,7 +252,7 @@ jxxxfix() * as a tunnel */ tunnel = jumpfrom; - jumpfrom->tag = JXNOTYET; + jumpfrom->s_tag = JXNOTYET; ++nchange; continue; } @@ -264,19 +263,19 @@ jxxxfix() if (displ >= 0) { SEGITERATE(segno, cojumpfrom + 1,0,cointdest, intdest, ubintdest, ++){ - if (intdest->value > dest->value) + if (intdest->s_value > dest->s_value) break; /* beyond destination */ - if (intdest->tag <= JXQUESTIONABLE) + if (intdest->s_tag <= JXQUESTIONABLE) continue; /*frozen solid*/ - if (intdest->tag == JXALIGN){ - jumpfrom->jxoveralign = 1; + if (intdest->s_tag == JXALIGN){ + jumpfrom->s_jxoveralign = 1; badjxalign++; } /* * we assume the worst case * for unfrozen jxxxxes */ - displ += intdest->jxfear; + displ += intdest->s_jxfear; } if (displ <= MAXBYTE){ /* @@ -284,7 +283,7 @@ jxxxfix() * can't hurt us, so forget about * this jump */ - jumpfrom->tag = JXINACTIVE; + jumpfrom->s_tag = JXINACTIVE; } else { stillactives++; } @@ -294,18 +293,18 @@ jxxxfix() */ SEGITERATE(segno, cojumpfrom - 1,1,cointdest, intdest, ubintdest, --){ - if (intdest->value <= dest->value) + if (intdest->s_value <= dest->s_value) break; /* beyond destination */ - if (intdest->tag <= JXQUESTIONABLE) + if (intdest->s_tag <= JXQUESTIONABLE) continue; /*frozen solid*/ - if (intdest->tag == JXALIGN){ - jumpfrom->jxoveralign = 1; + if (intdest->s_tag == JXALIGN){ + jumpfrom->s_jxoveralign = 1; badjxalign++; } - displ -= intdest->jxfear; + displ -= intdest->s_jxfear; } if (displ >= MINBYTE) { - jumpfrom->tag = JXINACTIVE; + jumpfrom->s_tag = JXINACTIVE; } else { stillactives++; } @@ -334,8 +333,8 @@ jxxxfix() if (stillactives){ SEGITERATE(segno, 0, 0, cojumpfrom, jumpfrom, ubjumpfrom, ++){ - if (jumpfrom->tag == JXACTIVE){ - jumpfrom->tag = + if (jumpfrom->s_tag == JXACTIVE){ + jumpfrom->s_tag = badjxalign?JXNOTYET:JXINACTIVE; } } @@ -348,35 +347,35 @@ jxxxfix() */ SEGITERATE(segno, 0, 0, cojumpfrom, jumpfrom, ubjumpfrom, ++){ - if (jumpfrom->tag == JXALIGN){ + if (jumpfrom->s_tag == JXALIGN){ /* * Predict the true displacement * needed, irregardless of the * fact that we guessed 1 */ - displ = (jumpfrom->value - 1) & (unsigned)jumpfrom->jxfear; + displ = (jumpfrom->s_value - 1) & (unsigned)jumpfrom->s_jxfear; if (displ == 0){ /*no virtual displacement*/ - jumpfrom->jxfear = -1; + jumpfrom->s_jxfear = -1; } else { - jumpfrom->jxfear = (jumpfrom->jxfear + 1) - displ; + jumpfrom->s_jxfear = (jumpfrom->s_jxfear + 1) - displ; /* - * assert jumpfrom->jxfear > 0 + * assert jumpfrom->s_jxfear > 0 */ - if (jumpfrom->jxfear == 1){ + if (jumpfrom->s_jxfear == 1){ /*our prediction was correct*/ continue; } /* - * assert jumpfrom->jxfear > 1 + * assert jumpfrom->s_jxfear > 1 */ - jumpfrom->jxfear -= 1; /*correct guess*/ + jumpfrom->s_jxfear -= 1; /*correct guess*/ } /* - * assert jumpfrom->jxfear = -1, +1...2**n-1 + * assert jumpfrom->s_jxfear = -1, +1...2**n-1 */ - jumpfrom->tag = JXNOTYET; /*signal*/ + jumpfrom->s_tag = JXNOTYET; /*signal*/ jxxxbump(segno, cojumpfrom); - jumpfrom->tag = JXINACTIVE; + jumpfrom->s_tag = JXINACTIVE; /* * Assert jxfrom->jxvalue indexes the first * code byte after the added bytes, and @@ -411,20 +410,20 @@ jxxxbump(segno, starthint) cum_bump = 0; SEGITERATE(segno, starthint, 0, cosp, sp, ub, ++){ - tag = sp->tag; + tag = sp->s_tag; if (tag == JXNOTYET){ #ifdef DEBUG if (debug){ - if (sp->dest != 0) + if (sp->s_dest != 0) printf("Explode jump to %s on line %d\n", - sp->dest->name, lineno); + sp->s_dest->s_name, lineno); else printf("Explode an align!\n"); } #endif - sp->tag = JXINACTIVE; - sp->jxbump = 1; - cum_bump += sp->jxfear; + sp->s_tag = JXINACTIVE; + sp->s_jxbump = 1; + cum_bump += sp->s_jxfear; } /* * Only bump labels and jxxxes. Ignored entries can @@ -433,7 +432,7 @@ jxxxbump(segno, starthint) * pass. */ if (tag >= OKTOBUMP) /*only bump labels and jxxxes and floating stabs*/ - sp->value += cum_bump; + sp->s_value += cum_bump; } - usedot[segno].xvalue += cum_bump; + usedot[segno].e_xvalue += cum_bump; } diff --git a/usr/src/old/as.vax/asmain.c b/usr/src/old/as.vax/asmain.c index d22a9c553c..f1a04acaff 100644 --- a/usr/src/old/as.vax/asmain.c +++ b/usr/src/old/as.vax/asmain.c @@ -1,10 +1,8 @@ /* Copyright (c) 1980 Regents of the University of California */ -static char sccsid[] = "@(#)asmain.c 4.1 %G%"; +static char sccsid[] = "@(#)asmain.c 4.2 %G%"; #include #include -#include #include -#include #include "as.h" #include "assyms.h" @@ -12,11 +10,11 @@ static char sccsid[] = "@(#)asmain.c 4.1 %G%"; #include "asscan.h" #ifdef UNIX -#define unix_lang_name "VAX/UNIX Assembler V3.0" +#define unix_lang_name "VAX/UNIX Assembler Vasmain.c" #endif #ifdef VMS -#define vms_lang_name "VAX/VMS C assembler V1.00" +#define vms_lang_name "VAX/VMS C Assembler V1.00" #endif VMS /* @@ -317,12 +315,12 @@ zeroorigins() * the next for named data segments. */ for (locindex = 0; locindex < NLOC; locindex++){ - usedot[locindex].xtype = XTEXT; - usedot[NLOC + locindex].xtype = XDATA; - usedot[locindex].xvalue = 0; - usedot[NLOC + locindex].xvalue = 0; - usedot[locindex].yvalue = 0; - usedot[NLOC + locindex].yvalue = 0; + usedot[locindex].e_xtype = XTEXT; + usedot[NLOC + locindex].e_xtype = XDATA; + usedot[locindex].e_xvalue = 0; + usedot[NLOC + locindex].e_xvalue = 0; + usedot[locindex].e_yvalue = 0; + usedot[NLOC + locindex].e_yvalue = 0; } } @@ -432,8 +430,8 @@ roundsegments() */ tsize = 0; for (locindex=0; locindex -#include -#ifdef UNIX -# include -#endif UNIX - -#ifdef VMS -# ifdef UNIXDEVEL -# include -# else VMSDEVEL -# include -# endif -#endif VMS #include "as.h" #include "asexpr.h" #include "asscan.h" @@ -98,7 +86,7 @@ int yyparse() while (INTOKSET(val, LINSTBEGIN)){ if (val == INT) { - int i = ((struct exp *)yylval)->xvalue; + int i = ((struct exp *)yylval)->e_xvalue; shift; if (val != COLON) goto nocolon; @@ -128,43 +116,59 @@ int yyparse() shiftover(NAME); nocolon: if (val != COLON) { +#ifdef FLEXNAMES yyerror("\"%s\" is not followed by a ':' for a label definition", - np->name); +#else not FLEXNAMES + yyerror("\"%.*s\" is not followed by a ':' for a label definition", + NCPS, +#endif not FLEXNAMES + np->s_name); goto errorfix; } restlab: shift; flushfield(NBPW/4); - if ((np->type&XTYPE)!=XUNDEF) { - if( (np->type&XTYPE)!=dotp->xtype - || np->value!=dotp->xvalue + if ((np->s_type&XTYPE)!=XUNDEF) { + if( (np->s_type&XTYPE)!=dotp->e_xtype + || np->s_value!=dotp->e_xvalue || ( (passno==1) - &&(np->index != dotp->xloc) + &&(np->s_index != dotp->e_xloc) ) ){ #ifndef DEBUG - if (np->name[0] != 'L') + if (np->s_name[0] != 'L') #endif not DEBUG { if (passno == 1) - yyerror("%.8s redefined", np->name); +#ifdef FLEXNAMES + yyerror("%s redefined", +#else not FLEXNAMES + yyerror("%.*s redefined", + NCPS, +#endif not FLEXNAMES + np->s_name); else - yyerror("%.8s redefined: PHASE ERROR, 1st: %d, 2nd: %d", - np->name, - np->value, - dotp->xvalue); +#ifdef FLEXNAMES + yyerror("%s redefined: PHASE ERROR, 1st: %d, 2nd: %d", +#else not FLEXNAMES + yyerror("%.*s redefined: PHASE ERROR, 1st: %d, 2nd: %d", + NCPS, +#endif not FLEXNAMES + np->s_name, + np->s_value, + dotp->e_xvalue); } } } - np->type &= ~(XTYPE|XFORW); - np->type |= dotp->xtype; - np->value = dotp->xvalue; + np->s_type &= ~(XTYPE|XFORW); + np->s_type |= dotp->e_xtype; + np->s_value = dotp->e_xvalue; if (passno == 1){ - np->index = dotp-usedot; - if (np->name[0] == 'L'){ + np->s_index = dotp-usedot; + if (np->s_name[0] == 'L'){ nlabels++; } - np->tag = LABELID; + np->s_tag = LABELID; } } /*end of this being a label*/ } /*end of to consuming all labels, NLs and SEMIS */ @@ -206,7 +210,7 @@ restlab: case ILINENO: shift; /*over the ILINENO*/ expr(locxp, val); - lineno = locxp->xvalue; + lineno = locxp->e_xvalue; break; case ISET: /* .set , */ @@ -215,12 +219,12 @@ restlab: shiftover(NAME); shiftover(CM); expr(locxp, val); - np->type &= (XXTRN|XFORW); - np->type |= locxp->xtype&(XTYPE|XFORW); - np->value = locxp->xvalue; + np->s_type &= (XXTRN|XFORW); + np->s_type |= locxp->e_xtype&(XTYPE|XFORW); + np->s_value = locxp->e_xvalue; if (passno==1) - np->index = locxp->xloc; - if ((locxp->xtype&XTYPE) == XUNDEF) + np->s_index = locxp->e_xloc; + if ((locxp->e_xtype&XTYPE) == XUNDEF) yyerror("Illegal set?"); break; @@ -240,18 +244,18 @@ restlab: if (passno == 1){ stpt = (struct symtab *)symalloc(); #ifdef FLEXNAMES - stpt->name = np->name; + stpt->s_name = np->s_name; #else - movestr(stpt->name, np->name, NCPS); + movestr(stpt->s_name, np->s_name, NCPS); #endif - np->tag = OBSOLETE; /*invalidate original */ + np->s_tag = OBSOLETE; /*invalidate original */ nforgotten++; np = stpt; - if (locxp->xtype != XABS) + if (locxp->e_xtype != XABS) ("Illegal lsym"); - np->value=locxp->xvalue; - np->type=XABS; - np->tag = ILSYM; + np->s_value=locxp->e_xvalue; + np->s_type=XABS; + np->s_tag = ILSYM; } break; @@ -259,7 +263,7 @@ restlab: shift; np = (struct symtab *)yylval; shiftover(NAME); - np->type |= XXTRN; + np->s_type |= XXTRN; break; case IDATA: /*.data [ ] */ @@ -275,7 +279,7 @@ restlab: seg_number = 0; seg_type = -seg_type; } else { - if (locxp->xtype != XABS || (seg_number=locxp->xvalue) >= NLOC) { + if (locxp->e_xtype != XABS || (seg_number=locxp->e_xvalue) >= NLOC) { yyerror("illegal location counter"); seg_number = 0; } @@ -294,7 +298,7 @@ restlab: if (passno==2) { puchar(vms_obj_ptr,6); /* setpl */ puchar(vms_obj_ptr,seg_number); /* psect # */ - plong(vms_obj_ptr,dotp->xvalue);/* offset */ + plong(vms_obj_ptr,dotp->e_xvalue);/* offset */ puchar(vms_obj_ptr,80); /* setrb */ if((vms_obj_ptr-sobuf) > 400){ write(objfil,sobuf,vms_obj_ptr-sobuf); @@ -341,9 +345,9 @@ restlab: if (val == COLON){ shiftover(COLON); expr(pval, val); - if (locxp->xtype != XABS) + if (locxp->e_xtype != XABS) yyerror("Width not absolute"); - field_width = locxp->xvalue; + field_width = locxp->e_xvalue; locxp = pval; if (bitoff + field_width > curlen) @@ -355,7 +359,7 @@ restlab: flushfield(curlen); } - if ((locxp->xtype&XTYPE)!=XABS) { + if ((locxp->e_xtype&XTYPE)!=XABS) { if (bitoff) yyerror("Illegal relocation in field"); field_width=LEN1; @@ -364,15 +368,15 @@ restlab: if (curlen==NBPW/2) field_width = LEN2; if (passno == 1){ - dotp->xvalue += reflen[field_width]; + dotp->e_xvalue += reflen[field_width]; } else { - outrel(&locxp->xvalue, + outrel(&locxp->e_xvalue, field_width, - locxp->xtype, - locxp->xname); + locxp->e_xtype, + locxp->e_xname); } } else { - field_value = locxp->xvalue & ( (1L << field_width)-1); + field_value = locxp->e_xvalue & ( (1L << field_width)-1); bitfield |= field_value << bitoff; bitoff += field_width; } @@ -383,16 +387,16 @@ restlab: flushfield(curlen); if ( ( curlen == NBPW/4) && bitoff) - dotp->xvalue ++; + dotp->e_xvalue ++; break; /*end of case IBYTE, IWORD, ILONG, IINT*/ case ISPACE: /* .space */ shift; expr(locxp, val); - if (locxp->xtype != XABS) + if (locxp->e_xtype != XABS) yyerror("Space size not absolute"); - space_value = locxp->xvalue; + space_value = locxp->e_xvalue; ospace: flushfield(NBPW/4); #ifdef UNIX @@ -403,7 +407,7 @@ restlab: outs(strbuf[2].str, space_value); #endif UNIX #ifdef VMS - dotp->xvalue += space_value; /*bump pc*/ + dotp->e_xvalue += space_value; /*bump pc*/ if (passno==2){ if(*(strbuf[2].str)==0) { puchar(vms_obj_ptr,81); /* AUGR */ @@ -422,16 +426,16 @@ restlab: /* fill count bytes with value */ shift; expr(locxp, val); - if (locxp->xtype != XABS) + if (locxp->e_xtype != XABS) yyerror("Fill repetition count not absolute"); - space_value = locxp->xvalue; + space_value = locxp->e_xvalue; shiftover(CM); expr(locxp, val); - if (locxp->xtype != XABS) + if (locxp->e_xtype != XABS) yyerror("Fill value not absolute"); flushfield(NBPW/4); while(space_value-- > 0) - outb(locxp->xvalue & 0xFF); + outb(locxp->e_xvalue & 0xFF); break; #endif UNIX @@ -448,7 +452,7 @@ restlab: while (val == STRING){ flushfield(NBPW/4); if (bitoff) - dotp->xvalue++; + dotp->e_xvalue++; stringp = (struct strdesc *)yylval; #ifdef UNIX outs(stringp->str, stringp->str_lg); @@ -457,7 +461,7 @@ restlab: { register int i; for (i=0; i < stringp->str_lg; i++){ - dotp->xvalue += 1; + dotp->e_xvalue += 1; if (passno==2){ puchar(vms_obj_ptr,-1); puchar(vms_obj_ptr,stringp->str[i]); @@ -484,7 +488,7 @@ restlab: puchar(vms_obj_ptr,-1); puchar(vms_obj_ptr,0); } - dotp->xvalue += 1; + dotp->e_xvalue += 1; #endif VMS } break; @@ -493,11 +497,11 @@ restlab: shift; expr(locxp, val); - if (locxp->xtype==XABS) + if (locxp->e_xtype==XABS) orgwarn++; - else if ((locxp->xtype & ~XXTRN) != dotp->xtype) + else if ((locxp->e_xtype & ~XXTRN) != dotp->e_xtype) yyerror("Illegal expression to set origin"); - space_value = locxp->xvalue - dotp->xvalue; + space_value = locxp->e_xvalue - dotp->e_xvalue; if (space_value < 0) yyerror("Backwards 'org'"); goto ospace; @@ -548,7 +552,7 @@ restlab: shift; for (argcnt = 0; argcnt < 8; argcnt++){ expr(locxp, val); - stpt->name[argcnt] = locxp->xvalue; + stpt->s_name[argcnt] = locxp->e_xvalue; xp = explist; shiftover(CM); } @@ -560,26 +564,26 @@ restlab: tailstab: expr(locxp, val); - if (! (locxp->xvalue & STABTYPS)){ + if (! (locxp->e_xvalue & STABTYPS)){ yyerror("Invalid type in %s",stabname); goto errorfix; } - stpt->ptype = locxp->xvalue; + stpt->s_ptype = locxp->e_xvalue; shiftover(CM); expr(locxp, val); - stpt->other = locxp->xvalue; + stpt->s_other = locxp->e_xvalue; shiftover(CM); expr(locxp, val); - stpt->desc = locxp->xvalue; + stpt->s_desc = locxp->e_xvalue; shiftover(CM); exprisname = 0; expr(locxp, val); - p = locxp->xname; + p = locxp->e_xname; if (p == NULL) { /*absolute expr to begin with*/ - stpt->value = locxp->xvalue; - stpt->index = dotp - usedot; + stpt->s_value = locxp->e_xvalue; + stpt->s_index = dotp - usedot; if (exprisname){ - switch(stpt->ptype){ + switch(stpt->s_ptype){ case N_GSYM: case N_FNAME: case N_RSYM: @@ -589,19 +593,19 @@ restlab: case N_BCOMM: case N_ECOMM: case N_LENG: - stpt->tag = STABFIXED; + stpt->s_tag = STABFIXED; break; default: - stpt->tag = STABFLOATING; + stpt->s_tag = STABFLOATING; break; } } else - stpt->tag = STABFIXED; + stpt->s_tag = STABFIXED; } else { /*really have a name*/ - stpt->dest = locxp->xname; - stpt->index = p->index; - stpt->type = p->type | STABFLAG; + stpt->s_dest = locxp->e_xname; + stpt->s_index = p->s_index; + stpt->s_type = p->s_type | STABFLAG; /* * We will assign a more accruate * guess of locxp's location when @@ -609,7 +613,7 @@ restlab: * The final value of value is * given by stabfix() */ - stpt->tag = STABFLOATING; + stpt->s_tag = STABFLOATING; } /* * tokptr now points at one token beyond @@ -636,17 +640,17 @@ restlab: shift; /*over the ISTABDOT*/ if (passno == 1){ expr(locxp, val); - if (! (locxp->xvalue & STABTYPS)){ + if (! (locxp->e_xvalue & STABTYPS)){ yyerror("Invalid type in .stabd"); goto errorfix; } - stpt->ptype = locxp->xvalue; + stpt->s_ptype = locxp->e_xvalue; shiftover(CM); expr(locxp, val); - stpt->other = locxp->xvalue; + stpt->s_other = locxp->e_xvalue; shiftover(CM); expr(locxp, val); - stpt->desc = locxp->xvalue; + stpt->s_desc = locxp->e_xvalue; /* * * Now, clobber everything but the @@ -662,9 +666,9 @@ restlab: * (ensures they are sorted into right place)/ * pass 2: Fix the actual value */ - stpt->value = dotp->xvalue; - stpt->index = dotp - usedot; - stpt->tag = STABFLOATING; /*although it has no effect in pass 2*/ + stpt->s_value = dotp->e_xvalue; + stpt->s_index = dotp - usedot; + stpt->s_tag = STABFLOATING; /*although it has no effect in pass 2*/ break; case ISTABNONE: stabname = ".stabn"; goto shortstab; @@ -694,9 +698,9 @@ restlab: #endif } #ifndef FLEXNAMES - movestr(stpt->name, stringp->str, auxval); + movestr(stpt->s_name, stringp->str, auxval); #else - stpt->name = savestr(stringp->str); + stpt->s_name = savestr(stringp->str); #endif goto tailstab; break; @@ -710,17 +714,23 @@ restlab: shiftover(CM); expr(locxp, val); - if (locxp->xtype != XABS) + if (locxp->e_xtype != XABS) yyerror("comm size not absolute"); - if (passno==1 && (np->type&XTYPE)!=XUNDEF) - yyerror("Redefinition of %.8s", np->name); + if (passno==1 && (np->s_type&XTYPE)!=XUNDEF) +#ifdef FLEXNAMES + yyerror("Redefinition of %s", +#else not FLEXNAMES + yyerror("Redefinition of %.*s", + NCPS, +#endif not FLEXNAMES + np->s_name); if (passno==1) { - np->value = locxp->xvalue; + np->s_value = locxp->e_xvalue; if (auxval == ICOMM) - np->type |= XXTRN; + np->s_type |= XXTRN; else { - np->type &= ~XTYPE; - np->type |= XBSS; + np->s_type &= ~XTYPE; + np->s_type |= XBSS; } } break; @@ -765,17 +775,17 @@ restlab: +SAFEEXPRBEG)) ) { ERROR("expression expected"); } - expr(ap->xp,val); + expr(ap->a_xp,val); overdisp: if ( val == LP || sawsize){ shiftover(LP); findreg(regno); shiftover(RP); - ap->atype = ADISP; - ap->areg1 = regno; + ap->a_atype = ADISP; + ap->a_areg1 = regno; } else { - ap->atype = AEXP; - ap->areg1 = 0; + ap->a_atype = AEXP; + ap->a_areg1 = 0; } goto index; @@ -788,8 +798,8 @@ restlab: case REG: case REGOP: findreg(regno); - ap->atype = AREG; - ap->areg1 = regno; + ap->a_atype = AREG; + ap->a_areg1 = regno; break; case MUL: @@ -819,7 +829,7 @@ restlab: */ if (val != REG && val != REGOP){ droppedLP = 1; - val = exprparse(val, &(ap->xp)); + val = exprparse(val, &(ap->a_xp)); droppedLP = 0; goto overdisp; } @@ -827,34 +837,34 @@ restlab: shiftover(RP); if (val == PLUS){ shift; - ap->atype = AINCR; + ap->a_atype = AINCR; } else - ap->atype = ABASE; - ap->areg1 = regno; + ap->a_atype = ABASE; + ap->a_areg1 = regno; goto index; case LITOP: imm: shift; expr(locxp, val); - ap->atype = AIMM; - ap->areg1 = 0; - ap->xp = locxp; + ap->a_atype = AIMM; + ap->a_areg1 = 0; + ap->a_xp = locxp; goto index; case MP: shift; /* -(reg) */ findreg(regno); shiftover(RP); - ap->atype = ADECR; - ap->areg1 = regno; + ap->a_atype = ADECR; + ap->a_areg1 = regno; index: /*look for [reg] */ if (val == LB){ shift; findreg(regno); shiftover(RB); sawindex = 1; - ap->areg2 = regno; + ap->a_areg2 = regno; } break; @@ -866,21 +876,21 @@ restlab: * Make a concession for *(%r) * meaning *0(%r) */ - if (ap->atype == ABASE) { - ap->atype = ADISP; - xp->xtype = XABS; - xp->xvalue = 0; - xp->xloc = 0; - ap->xp = xp++; + if (ap->a_atype == ABASE) { + ap->a_atype = ADISP; + xp->e_xtype = XABS; + xp->e_xvalue = 0; + xp->e_xloc = 0; + ap->a_xp = xp++; } - ap->atype |= ASTAR; + ap->a_atype |= ASTAR; sawmul = 0; } if (sawindex){ - ap->atype |= AINDX; + ap->a_atype |= AINDX; sawindex = 0; } - ap->dispsize = sawsize == 0 ? d124 : sawsize; + ap->a_dispsize = sawsize == 0 ? d124 : sawsize; if (val != CM) break; shiftover(CM); } /*processing all the arguments*/ @@ -910,7 +920,7 @@ restlab: if (val != FLTNUM) { ERROR("floating number expected"); } - dotp->xvalue += curlen; + dotp->e_xvalue += curlen; #ifdef UNIX if (passno == 2) { if(curlen == 8) @@ -991,15 +1001,15 @@ int funnyreg(val, regnoback) /*what the read head will sit on*/ expr(locxp, val); /*and leave the current read head with value*/ if ( (passno == 2) && - ( locxp->xtype & XTYPE != XABS - || locxp->xvalue < 0 - || locxp->xvalue >= 16 + ( locxp->e_xtype & XTYPE != XABS + || locxp->e_xvalue < 0 + || locxp->e_xvalue >= 16 ) ){ yyerror("Illegal register"); return(0); } - *regnoback = locxp->xvalue; + *regnoback = locxp->e_xvalue; return(val); } diff --git a/usr/src/old/as.vax/aspseudo.c b/usr/src/old/as.vax/aspseudo.c index 28ffb4185a..f6b0d44773 100644 --- a/usr/src/old/as.vax/aspseudo.c +++ b/usr/src/old/as.vax/aspseudo.c @@ -1,20 +1,20 @@ /* Copyright (c) 1980 Regents of the University of California */ -static char sccsid[] = "@(#)aspseudo.c 4.1 %G%"; +static char sccsid[] = "@(#)aspseudo.c 4.2 %G%"; #include -#include #include "as.h" -#define OP(name,opcode,nargs,arg1,arg2,arg3,arg4,arg5,arg6) \ +#define OP(name, opcode, nargs, arg1, arg2, arg3, arg4, arg5, arg6) \ { \ - name,(nargs==0 ? INST0:INSTn), opcode,nargs, \ - arg1,arg2,arg3,arg4,arg5,arg6 \ + name, opcode, nargs, arg1, arg2, arg3, arg4, arg5, arg6, \ + (nargs == 0 ? INST0:INSTn) \ } -#define PSEUDO(name, type, tag) \ +#define PSEUDO(name, type, tag) \ { \ - name, tag, type \ + name, type, 0, 0, 0, 0, 0, 0, 0, \ + tag \ } -readonly struct instab instab[] = { +readonly struct Instab instab[] = { PSEUDO(".space", 0, ISPACE), PSEUDO(".fill", 0, IFILL), PSEUDO(".byte", 0, IBYTE), diff --git a/usr/src/old/as.vax/asscan.c b/usr/src/old/as.vax/asscan.c index 53a3189dfe..eea081b9f0 100644 --- a/usr/src/old/as.vax/asscan.c +++ b/usr/src/old/as.vax/asscan.c @@ -1,7 +1,6 @@ /* Copyright (c) 1980 Regents of the University of California */ -static char sccsid[] = "@(#)asscan.c 4.2 %G%"; +static char sccsid[] = "@(#)asscan.c 4.3 %G%"; #include -#include #include "as.h" #include "asscan.h" @@ -129,6 +128,7 @@ closetmpfile() #endif DEBUG extern int yylval; /*global communication with parser*/ +static int Lastjxxx; /*this ONLY shuts up cc; see below*/ toktype yylex() { @@ -150,12 +150,12 @@ toktype yylex() yyerror("Too many expressions; try simplyfing"); else locxp = xp++; - glong(locxp->xvalue, bufptr); - locxp->yvalue = 0; + glong(locxp->e_xvalue, bufptr); + locxp->e_yvalue = 0; makevalue: - locxp->xtype = XABS; - locxp->xloc = 0; - locxp->xname = NULL; + locxp->e_xtype = XABS; + locxp->e_xloc = 0; + locxp->e_xname = NULL; yylval = (int)locxp; break; case FLTNUM: @@ -170,8 +170,8 @@ toktype yylex() yyerror("Too many expressions; try simplyfing"); else locxp = xp++; - glong(locxp->xvalue, bufptr); - glong(locxp->yvalue, bufptr); + glong(locxp->e_xvalue, bufptr); + glong(locxp->e_yvalue, bufptr); yylval = val = INT; goto makevalue; case NAME: @@ -186,7 +186,9 @@ toktype yylex() break; case IJXXX: gchar(yylval, bufptr); - gptr(lastjxxx, bufptr); + /* We can't cast Lastjxxx into (int *) here.. */ + gptr(Lastjxxx, bufptr); + lastjxxx = (struct symtab *)Lastjxxx; break; case ILINESKIP: gint(yylval, bufptr); @@ -221,20 +223,20 @@ toktype yylex() passno, bufptr - firsttoken, tok_to_name(val)); switch(val){ case INT: printf("val %d", - ((struct exp *)yylval)->xvalue); + ((struct exp *)yylval)->e_xvalue); break; case BFINT: printf("val %d", - ((struct exp *)yylval)->xvalue); + ((struct exp *)yylval)->e_xvalue); break; case QUAD: printf("val[msd] = 0x%x, val[lsd] = 0x%x.", - ((struct exp *)yylval)->xvalue, - ((struct exp *)yylval)->yvalue); + ((struct exp *)yylval)->e_xvalue, + ((struct exp *)yylval)->e_yvalue); break; case FLTNUM: printf("value %20.17f", ((union Double *)yylval)->dvalue); break; case NAME: printf("\"%.8s\"", - ((struct symtab *)yylval)->name); + ((struct symtab *)yylval)->s_name); break; case REG: printf(" r%d", yylval); @@ -242,7 +244,7 @@ toktype yylex() case IJXXX: case INST0: case INSTn: printf("%.8s", - itab[0xFF &yylval]->name); + itab[0xFF &yylval]->s_name); break; case STRING: printf("length %d ", ((struct strdesc *)yylval)->str_lg); @@ -773,10 +775,10 @@ scan_dot_s(bufferbox) val = getchar(); ungetc(val); doit: - tag = (op = *lookup(1))->tag; + tag = (op = *lookup(1))->s_tag; if (tag && tag != LABELID){ - yylval = ( (struct instab *)op)->opcode; - val = op->tag ; + yylval = ( (struct instab *)op)->i_opcode; + val = op->s_tag ; goto ret; } else { /* diff --git a/usr/src/old/as.vax/asscan.h b/usr/src/old/as.vax/asscan.h index 2425280d31..d2eaaf5deb 100644 --- a/usr/src/old/as.vax/asscan.h +++ b/usr/src/old/as.vax/asscan.h @@ -1,5 +1,5 @@ /* Copyright (c) 1980 Regents of the University of California */ -/* "@(#)asscan.h 4.2 %G%" */ +/* "@(#)asscan.h 4.3 %G%" */ /* * The character scanner is called to fill up one token buffer * diff --git a/usr/src/old/as.vax/assyms.c b/usr/src/old/as.vax/assyms.c index b9940815e6..a4cedb9259 100644 --- a/usr/src/old/as.vax/assyms.c +++ b/usr/src/old/as.vax/assyms.c @@ -1,9 +1,7 @@ /* Copyright (c) 1980 Regents of the University of California */ -static char sccsid[] = "@(#)assyms.c 4.1 %G%"; +static char sccsid[] = "@(#)assyms.c 4.2 %G%"; #include #include -#include -#include #include "as.h" #include "asscan.h" #include "assyms.h" @@ -47,9 +45,7 @@ int hshused; /* number of hash slots used */ */ #ifdef FLEXNAMES struct strpool *strplhead = 0; -#else -char *namebuffer; -#endif +#endif FLEXNAMES symtabinit() { @@ -73,18 +69,22 @@ syminstall() register struct symtab **hp; register char *p1, *p2; - for (ip=instab; ip->name!=0; ip++) { - p1 = ip->name; +#ifdef FLEXNAMES + for (ip = (struct instab *)instab; ip->s_name != 0; ip++) { +#else not FLEXNAMES + for (ip = (struct instab *)instab; ip->s_name[0] != '\0'; ip++){ +#endif not FLEXNAMES + p1 = ip->s_name; p2 = yytext; while (*p2++ = *p1++); hp = lookup(0); /* 0 => don't install this*/ if (*hp==NULL) { *hp = (struct symtab *)ip; - if ( (ip->tag!=INSTn) - && (ip->tag!=INST0) - && (ip->tag!=0)) + if ( (ip->s_tag!=INSTn) + && (ip->s_tag!=INST0) + && (ip->s_tag!=0)) continue; /* was pseudo-op */ - itab[ip->opcode & 0xFF] = ip; + itab[ip->i_opcode & 0xFF] = ip; } } } /*end of syminstall*/ @@ -107,30 +107,30 @@ freezesymtab() DECLITERATE(allocwalk, sp, ubsp) { - if (sp->tag >= IGNOREBOUND) + if (sp->s_tag >= IGNOREBOUND) continue; /*totally ignore jxxx entries */ /* * Ignore stabs, but give them a symbol table index */ - if (sp->type & STABFLAG) + if (sp->s_type & STABFLAG) goto assignindex; - if ((sp->type&XTYPE)==XUNDEF) - sp->type = XXTRN+XUNDEF; - else if ((sp->type&XTYPE)==XDATA) - sp->value += usedot[sp->index].xvalue; - else if ((sp->type&XTYPE)==XTEXT) - sp->value += usedot[sp->index].xvalue; - else if ((sp->type&XTYPE)==XBSS) { - bs = sp->value; - sp->value = hdr.a_bss + datbase; + if ((sp->s_type&XTYPE)==XUNDEF) + sp->s_type = XXTRN+XUNDEF; + else if ((sp->s_type&XTYPE)==XDATA) + sp->s_value += usedot[sp->s_index].e_xvalue; + else if ((sp->s_type&XTYPE)==XTEXT) + sp->s_value += usedot[sp->s_index].e_xvalue; + else if ((sp->s_type&XTYPE)==XBSS) { + bs = sp->s_value; + sp->s_value = hdr.a_bss + datbase; hdr.a_bss += bs; } assignindex: - if ( (sp->name[0] != 'L') - || (sp->tag != LABELID) + if ( (sp->s_name[0] != 'L') + || (sp->s_tag != LABELID) || savelabels ) /*then, we will write it later on*/ - sp->index = relpos++; + sp->s_index = relpos++; } } @@ -148,11 +148,11 @@ stabfix() { register struct symtab *p; SYMITERATE(cosp, sp){ - if(sp->ptype && (sp->type & STABFLAG)) { - p = sp->dest; - sp->value = p->value; - sp->index = p->index; - sp->type = p->type; + if(sp->s_ptype && (sp->s_type & STABFLAG)) { + p = sp->s_dest; + sp->s_value = p->s_value; + sp->s_index = p->s_index; + sp->s_type = p->s_type; } } } @@ -185,9 +185,6 @@ struct symtab *symalloc() newbox = (struct allocbox *)ClearCalloc(1,ALLOCQTY); symsleft = SYMDALLOP; nextsym = &newbox->symslots[0]; -#ifndef FLEXNAMES - namebuffer = &newbox->symnames[0]; -#endif not FLEXNAMES if (alloctail == 0){ allochead = alloctail = newbox; } else { @@ -197,10 +194,6 @@ struct symtab *symalloc() } --symsleft; ++nsyms; -#ifndef FLEXNAMES - nextsym->name = namebuffer; - namebuffer += NCPS; -#endif not FLEXNAMES return(nextsym++); } @@ -221,22 +214,22 @@ symcmp(Pptr, Qptr) { register struct symtab *p = *Pptr; register struct symtab *q = *Qptr; - if (p->index < q->index) + if (p->s_index < q->s_index) return(-1); - if (p->index > q->index) + if (p->s_index > q->s_index) return(1); - if (p->value < q->value) + if (p->s_value < q->s_value) return(-1); - if (p->value > q->value) + if (p->s_value > q->s_value) return(1); /* * Force jxxx entries to virtually preceed labels defined * to follow the jxxxx instruction, so that bumping the * jxxx instruction correctly fixes up the following labels */ - if (p->tag >= IGNOREBOUND) /*p points to a jxxx*/ + if (p->s_tag >= IGNOREBOUND) /*p points to a jxxx*/ return(-1); - if (q->tag >= IGNOREBOUND) + if (q->s_tag >= IGNOREBOUND) return(1); /* * both are now just plain labels; the relative order doesn't @@ -275,9 +268,9 @@ sortsymtab() cowalk = symptrs; symsin = 0; DECLITERATE(allocwalk, sp, ubsp) { - if (sp->ptype && (sp->type &STABFLAG)){ - sp->value = sp->dest->value; - sp->index = sp->dest->index; + if (sp->s_ptype && (sp->s_type &STABFLAG)){ + sp->s_value = sp->s_dest->s_value; + sp->s_index = sp->s_dest->s_index; } if (symsin >= nsyms) yyerror("INTERNAL ERROR: overfilled symbol table indirection table"); @@ -293,7 +286,7 @@ sortsymtab() for (cowalk = symptrs, sp = *cowalk, segno = 0, slotno = 1; segno < NLOC + NLOC; segno++, slotno++){ - for (; sp && sp->index == segno; sp = *++cowalk); + for (; sp && sp->s_index == segno; sp = *++cowalk); symdelim[slotno] = cowalk; /*forms the ub delimeter*/ } } /*end of sortsymtab*/ @@ -311,17 +304,17 @@ dumpsymtab() SEGITERATE(segno, 0, 0, cosp, sp, ub, ++){ #ifdef FLEXNAMES printf("\tSeg: %d \"%s\" value: %d index: %d tag %s\n", - segno, sp->name, - sp->value, sp->index, - tagstring(sp->tag)); + segno, sp->s_name, + sp->s_value, sp->s_index, + tagstring(sp->s_tag)); #else not FLEXNAMES printf("\tSeg: %d \"%*.*s\" value: %d index: %d tag %s\n", - segno, NCPS, NCPS, sp->name, - sp->value, sp->index, - tagstring(sp->tag)); + segno, NCPS, NCPS, sp->s_name, + sp->s_value, sp->s_index, + tagstring(sp->s_tag)); #endif not FLEXNAMES printf("\t\ttype: %d jxbump %d jxfear: %d\n", - sp->type, sp->jxbump, sp->jxfear); + sp->s_type, sp->s_jxbump, sp->s_jxfear); } printf("\n\n"); } @@ -413,7 +406,7 @@ struct symtab **lookup(instflg) nprobes += 2) { from = yytext; - to = (*hp)->name; + to = (*hp)->s_name; #ifndef FLEXNAMES for (len = 0; (lenh_nused++; #ifndef FLEXNAMES - for(len = 0, from = yytext, to = (*hp)->name; (lens_name; (len= (STRPOOLDALLOP - strplhead->str_nalloc)) strpoolalloc(); - for ( (*hp)->name = to = strplhead->str_names + strplhead->str_nalloc, from = yytext; + for ( (*hp)->s_name = to = strplhead->str_names + strplhead->str_nalloc, from = yytext; ( (*to++ = *from++) != '\0'); ) continue; strplhead->str_nalloc += len; @@ -513,11 +506,18 @@ struct relbufdesc{ extern struct relbufdesc *tok_free; #define rel_free tok_free static struct relbufdesc *rel_temp; -struct relocation_info r_can_1PC = {0,0,0,0,0,0}; -struct relocation_info r_can_0PC = {0,0,0,0,0,0}; +struct relocation_info r_can_1PC; +struct relocation_info r_can_0PC; initoutrel() { + r_can_0PC.r_address = 0; + r_can_0PC.r_symbolnum = 0; + r_can_0PC.r_pcrel = 0; + r_can_0PC.r_length = 0; + r_can_0PC.r_extern = 0; + + r_can_1PC = r_can_0PC; r_can_1PC.r_pcrel = 1; } @@ -543,12 +543,12 @@ outrel(pval,reftype,reltype,xsym) if (reltype != XABS || reftype & PCREL) { reloc = (reftype & PCREL)? r_can_1PC : r_can_0PC; - reloc.r_address = dotp->xvalue - + reloc.r_address = dotp->e_xvalue - ( (dotp < &usedot[NLOC]) ? 0 : datbase ); reloc.r_length = lgreflen[reftype]; switch(reltype){ case XXTRN | XUNDEF: - reloc.r_symbolnum = xsym->index; + reloc.r_symbolnum = xsym->s_index; reloc.r_extern = 1; break; default: @@ -572,9 +572,9 @@ outrel(pval,reftype,reltype,xsym) /* * write the unrelocated value to the text file */ - dotp->xvalue += this_reflen; + dotp->e_xvalue += this_reflen; if (reftype & PCREL) - *pval -= dotp->xvalue; + *pval -= dotp->e_xvalue; bwrite((char *)pval, this_reflen, txtfil); } /* @@ -613,26 +613,10 @@ u_long Closeoutrel(relfil, relocfile) return(tail + relfil->rel_count * sizeof (struct relocation_info)); } +#define NOUTSYMS (nsyms - njxxx - nforgotten - (savelabels ? 0 : nlabels)) int sizesymtab() { - struct symtab *sp; - -#define NOUTSYMS (nsyms - njxxx - nforgotten - (savelabels ? 0 : nlabels)) - - return ( - ( -#ifndef FLEXNAMES - NCPS -#else FLEXNAMES - sizeof (long) -#endif FLEXNAMES - + sizeof (sp->ptype) - + sizeof (sp->other) - + sizeof (sp->desc) - + sizeof (sp->value) - ) - * NOUTSYMS - ); + return (sizeof (struct nlist) * NOUTSYMS); } #ifdef FLEXNAMES @@ -663,8 +647,12 @@ int symwrite(symfile) int symsdesired = NOUTSYMS; register struct symtab *sp, *ub; #ifdef FLEXNAMES - register int len; + char *name; /* temp to save the name */ long stroff = sizeof (stroff); + /* + * We use sp->s_index to hold the length of the + * name; it isn't used for anything else + */ #endif FLEXNAMES register struct allocbox *allocwalk; @@ -672,35 +660,26 @@ int symwrite(symfile) symsout = 0; DECLITERATE(allocwalk, sp, ub) { - if (sp->tag >= IGNOREBOUND) + if (sp->s_tag >= IGNOREBOUND) continue; - if ((sp->name[0] == 'L') && (sp->tag == LABELID) && !savelabels) + if ((sp->s_name[0] == 'L') && (sp->s_tag == LABELID) && !savelabels) continue; symsout++; -#ifndef FLEXNAMES - bwrite(sp->name, NCPS, symfile); -#else FLEXNAMES - len = strlen(sp->name); - if (len != 0) { - bwrite(&stroff, sizeof (stroff), symfile); - stroff += len + 1; - } else - bwrite("\0\0\0\0", sizeof (stroff), symfile); + +#ifdef FLEXNAMES + name = sp->s_name; /* save pointer */ + if ( (sp->s_index = strlen(sp->s_name)) != 0){ + sp->s_nmx = stroff; /* clobber pointer */ + stroff += sp->s_index + 1; + } else { + sp->s_nmx = 0; /* clobber pointer */ + } +#endif + sp->s_type = (sp->s_ptype != 0) ? sp->s_ptype : (sp->s_type & (~XFORW)); + bwrite(&sp->s_nm, sizeof (struct nlist), symfile); +#ifdef FLEXNAMES + sp->s_name = name; /* restore pointer */ #endif FLEXNAMES - sp->type &= ~XFORW; - bputc( ( (sp->ptype != 0) ? sp->ptype : sp->type ), - symfile); - /* - * WATCH OUT. THIS DEPENDS THAT THE ALLOCATION OF - * the four fields ptype, other, desc and value are - * contiguous, which is compiler dependent. - */ - bwrite((char *)&(sp->other), - sizeof (sp->other) - + sizeof (sp->desc) - + sizeof (sp->value), - symfile - ); } if (symsout != symsdesired) yyerror("INTERNAL ERROR: Wrote %d symbols, wanted to write %d symbols\n", @@ -715,13 +694,13 @@ int symwrite(symfile) symsout = 0; DECLITERATE(allocwalk, sp, ub) { - if (sp->tag >= IGNOREBOUND) + if (sp->s_tag >= IGNOREBOUND) continue; - if ((sp->name[0] == 'L') && (sp->tag == LABELID) && !savelabels) + if ((sp->s_name[0] == 'L') && (sp->s_tag == LABELID) && !savelabels) continue; - len = strlen(sp->name); - if (len) - bwrite(sp->name, len + 1, symfile); + sp->s_index = strlen(sp->s_name); + if (sp->s_index) + bwrite(sp->s_name, sp->s_index + 1, symfile); } #endif FLEXNAMES } diff --git a/usr/src/old/as.vax/assyms.h b/usr/src/old/as.vax/assyms.h index 7b455dc789..18a1ae922e 100644 --- a/usr/src/old/as.vax/assyms.h +++ b/usr/src/old/as.vax/assyms.h @@ -1,5 +1,5 @@ /* Copyright (c) 1980 Regents of the University of California */ -/* "@(#)assyms.h 4.1 %G%" */ +/* "@(#)assyms.h 4.2 %G%" */ /* * To speed up walks through symbols defined in a particular * segment, we buil up a table of pointers into the symbol table @@ -40,9 +40,6 @@ extern int hshused; /*how many hash slots used*/ struct allocbox{ struct allocbox *nextalloc; struct symtab symslots[SYMDALLOP]; -#ifndef FLEXNAMES - char symnames[SYMDALLOP * NCPS]; -#endif }; #ifdef FLEXNAMES -- 2.20.1