update mips compiler for geoff's routerboard work. great to see mips back! Reference: /n/atom/patch/applied2013/vcompupd Date: Wed Jul 31 17:22:13 CES 2013 Signed-off-by: quanstro@quanstro.net --- /sys/src/cmd/va/a.h Wed Jul 31 17:20:56 2013 +++ /sys/src/cmd/va/a.h Wed Jul 31 17:20:57 2013 @@ -30,7 +30,7 @@ { Sym* link; char* macro; - long value; + vlong value; ushort type; char *name; char sym; @@ -62,7 +62,7 @@ struct Gen { Sym* sym; - long offset; + vlong offset; short type; short reg; short name; @@ -75,7 +75,7 @@ Hist* link; char* name; long line; - long offset; + vlong offset; }; #define H ((Hist*)0) --- /sys/src/cmd/va/a.y Wed Jul 31 17:20:58 2013 +++ /sys/src/cmd/va/a.y Wed Jul 31 17:20:58 2013 @@ -4,7 +4,7 @@ %union { Sym *sym; - long lval; + vlong lval; double dval; char sval[8]; Gen gen; --- /sys/src/cmd/vc/gc.h Wed Jul 31 17:20:59 2013 +++ /sys/src/cmd/vc/gc.h Wed Jul 31 17:21:00 2013 @@ -120,7 +120,7 @@ }; #define R ((Reg*)0) -#define NRGN 600 +#define NRGN 1000 /* was 600; raised for paranoia.c */ struct Rgn { Reg* enter; --- /sys/src/cmd/vl/asm.c Wed Jul 31 17:21:01 2013 +++ /sys/src/cmd/vl/asm.c Wed Jul 31 17:21:03 2013 @@ -1,5 +1,12 @@ #include "l.h" +/* can't include a.out.h due to name clashes, but these are taken from it */ +#define _MAGIC(f, b) ((f)|((((4*(b))+0)*(b))+7)) +#define V_MAGIC _MAGIC(0, 16) /* mips 3000 BE */ +#define M_MAGIC _MAGIC(0, 18) /* mips 4000 BE */ +#define N_MAGIC _MAGIC(0, 22) /* mips 4000 LE */ +#define P_MAGIC _MAGIC(0, 24) /* mips 3000 LE */ + long OFFSET; /* long BADOFFSET = -1; @@ -168,11 +175,75 @@ return s->value; } +static void +plan9bootimage(ulong sects, ulong submagicvers, ulong tm, + ulong hdrtxtsz, ulong textsz, ulong textva, ulong lcsize) +{ + lput(0x160L<<16|sects); /* magic and sections */ + lput(tm); /* time and date */ + lput(hdrtxtsz+datsize); /* offset to symbol table */ + lput(symsize); /* size of symbol table */ + lput((0x38L<<16)|7L); /* size of optional hdr and flags */ + lput(submagicvers); /* magic and version */ + + lput(textsz); /* segment sizes */ + lput(datsize); + lput(bsssize); + + lput(entryvalue()); /* va of entry */ + lput(textva); /* va of base of text */ + lput(INITDAT); /* va of base of data */ + lput(INITDAT+datsize); /* va of base of bss */ + + lput(~0); /* gp reg mask */ + lput(lcsize); /* pcsize / cprmask[0] */ + lput(0); /* coproc reg masks[1⋯3] */ + lput(0); + lput(0); + lput(~0); /* gp value ?? */ +} + +static void +symhdrs(ulong hdrtxtsz) +{ + strnput(".text", 8); /* text segment */ + lput(INITTEXT); /* address */ + lput(INITTEXT); + lput(textsize); + lput(HEADR); + lput(0); + lput(HEADR+textsize+datsize+symsize); + lput(lcsize); /* line number size */ + lput(0x20); /* flags */ + + strnput(".data", 8); /* data segment */ + lput(INITDAT); /* address */ + lput(INITDAT); + lput(datsize); + lput(hdrtxtsz); + lput(0); + lput(0); + lput(0); + lput(0x40); /* flags */ + + strnput(".bss", 8); /* bss segment */ + lput(INITDAT+datsize); /* address */ + lput(INITDAT+datsize); + lput(bsssize); + lput(0); + lput(0); + lput(0); + lput(0); + lput(0x80); /* flags */ +} + void asmb(void) { Prog *p; - long t, etext; + long tm; + ulong rndtxtsz; + vlong t, etext; Optab *o; if(debug['v']) @@ -187,8 +258,7 @@ autosize = p->to.offset + 4; } if(p->pc != pc) { - diag("phase error %lux sb %lux", - p->pc, pc); + diag("phase error %llux sb %llux", p->pc, pc); if(!debug['a']) prasm(curp); pc = p->pc; @@ -229,6 +299,7 @@ case 3: case 5: case 6: + case 7: OFFSET = HEADR+textsize; seek(cout, OFFSET, 0); break; @@ -257,6 +328,7 @@ case 1: case 5: case 6: + case 7: OFFSET = HEADR+textsize+datsize; seek(cout, OFFSET, 0); break; @@ -276,57 +348,26 @@ Bflush(&bso); OFFSET = 0; seek(cout, OFFSET, 0); + + rndtxtsz = rnd(HEADR+textsize, (INITRND > 0? INITRND: 4096)); + tm = time(0); switch(HEADTYPE) { case 0: - lput(0x160L<<16); /* magic and sections */ - lput(0L); /* time and date */ - lput(rnd(HEADR+textsize, 4096)+datsize); - lput(symsize); /* nsyms */ - lput((0x38L<<16)|7L); /* size of optional hdr and flags */ - lput((0413<<16)|0437L); /* magic and version */ - lput(rnd(HEADR+textsize, 4096)); /* sizes */ - lput(datsize); - lput(bsssize); - lput(entryvalue()); /* va of entry */ - lput(INITTEXT-HEADR); /* va of base of text */ - lput(INITDAT); /* va of base of data */ - lput(INITDAT+datsize); /* va of base of bss */ - lput(~0L); /* gp reg mask */ - lput(0L); - lput(0L); - lput(0L); - lput(0L); - lput(~0L); /* gp value ?? */ + /* 0413: plan 9 boot image, text segment rounded (to 4KB) */ + plan9bootimage(0, 0413<<16|0437, 0, rndtxtsz, rndtxtsz, + INITTEXT-HEADR, 0); break; case 1: - lput(0x160L<<16); /* magic and sections */ - lput(0L); /* time and date */ - lput(HEADR+textsize+datsize); - lput(symsize); /* nsyms */ - lput((0x38L<<16)|7L); /* size of optional hdr and flags */ - - lput((0407<<16)|0437L); /* magic and version */ - lput(textsize); /* sizes */ - lput(datsize); - lput(bsssize); - lput(entryvalue()); /* va of entry */ - lput(INITTEXT); /* va of base of text */ - lput(INITDAT); /* va of base of data */ - lput(INITDAT+datsize); /* va of base of bss */ - lput(~0L); /* gp reg mask */ - lput(lcsize); - lput(0L); - lput(0L); - lput(0L); - lput(~0L); /* gp value ?? */ - lput(0L); /* complete mystery */ + /* 0407: plan 9 boot image, extra word */ + plan9bootimage(0, 0407<<16|0437, 0, HEADR+textsize, textsize, + INITTEXT, lcsize); + lput(0); /* extra; complete mystery */ break; - case 2: + case 2: /* plan 9 format */ if (little) - t = 24; + lput(P_MAGIC); /* mips 3000 LE */ else - t = 16; - lput(((((4*t)+0)*t)+7)); /* magic */ + lput(V_MAGIC); /* mips 3000 BE */ lput(textsize); /* sizes */ lput(datsize); lput(bsssize); @@ -336,115 +377,25 @@ lput(lcsize); break; case 3: - lput((0x160L<<16)|3L); /* magic and sections */ - lput(time(0)); /* time and date */ - lput(HEADR+textsize+datsize); - lput(symsize); /* nsyms */ - lput((0x38L<<16)|7L); /* size of optional hdr and flags */ - - lput((0407<<16)|0437L); /* magic and version */ - lput(textsize); /* sizes */ - lput(datsize); - lput(bsssize); - lput(entryvalue()); /* va of entry */ - lput(INITTEXT); /* va of base of text */ - lput(INITDAT); /* va of base of data */ - lput(INITDAT+datsize); /* va of base of bss */ - lput(~0L); /* gp reg mask */ - lput(lcsize); - lput(0L); - lput(0L); - lput(0L); - lput(~0L); /* gp value ?? */ - - strnput(".text", 8); /* text segment */ - lput(INITTEXT); /* address */ - lput(INITTEXT); - lput(textsize); - lput(HEADR); - lput(0L); - lput(HEADR+textsize+datsize+symsize); - lput(lcsize); /* line number size */ - lput(0x20L); /* flags */ - - strnput(".data", 8); /* data segment */ - lput(INITDAT); /* address */ - lput(INITDAT); - lput(datsize); - lput(HEADR+textsize); - lput(0L); - lput(0L); - lput(0L); - lput(0x40L); /* flags */ - - strnput(".bss", 8); /* bss segment */ - lput(INITDAT+datsize); /* address */ - lput(INITDAT+datsize); - lput(bsssize); - lput(0L); - lput(0L); - lput(0L); - lput(0L); - lput(0x80L); /* flags */ + /* 0407: plan 9 mips 4k boot image with symbols */ + plan9bootimage(3, 0407<<16|0437, tm, HEADR+textsize, textsize, + INITTEXT, lcsize); + symhdrs(HEADR+textsize); break; case 4: - - lput((0x160L<<16)|3L); /* magic and sections */ - lput(time(0)); /* time and date */ - lput(rnd(HEADR+textsize, 4096)+datsize); - lput(symsize); /* nsyms */ - lput((0x38L<<16)|7L); /* size of optional hdr and flags */ - - lput((0413<<16)|01012L); /* magic and version */ - lput(textsize); /* sizes */ - lput(datsize); - lput(bsssize); - lput(entryvalue()); /* va of entry */ - lput(INITTEXT); /* va of base of text */ - lput(INITDAT); /* va of base of data */ - lput(INITDAT+datsize); /* va of base of bss */ - lput(~0L); /* gp reg mask */ - lput(lcsize); - lput(0L); - lput(0L); - lput(0L); - lput(~0L); /* gp value ?? */ - - strnput(".text", 8); /* text segment */ - lput(INITTEXT); /* address */ - lput(INITTEXT); - lput(textsize); - lput(HEADR); - lput(0L); - lput(HEADR+textsize+datsize+symsize); - lput(lcsize); /* line number size */ - lput(0x20L); /* flags */ - - strnput(".data", 8); /* data segment */ - lput(INITDAT); /* address */ - lput(INITDAT); - lput(datsize); - lput(rnd(HEADR+textsize, 4096)); /* sizes */ - lput(0L); - lput(0L); - lput(0L); - lput(0x40L); /* flags */ - - strnput(".bss", 8); /* bss segment */ - lput(INITDAT+datsize); /* address */ - lput(INITDAT+datsize); - lput(bsssize); - lput(0L); - lput(0L); - lput(0L); - lput(0L); - lput(0x80L); /* flags */ + /* 0413: plan 9 mips 4k boot image with symbols */ + plan9bootimage(3, 0413<<16|01012, tm, rndtxtsz, textsize, + INITTEXT, lcsize); + symhdrs(rndtxtsz); break; case 5: elf32(MIPS, little? ELFDATA2LSB: ELFDATA2MSB, 0, nil); break; case 6: break; + case 7: + elf64(MIPSR4K, little? ELFDATA2LSB: ELFDATA2MSB, 0, nil); + break; } cflush(); } @@ -599,9 +550,9 @@ void asmlc(void) { - long oldpc, oldlc; + long oldlc, v, s; + vlong oldpc; Prog *p; - long v, s; oldpc = INITTEXT; oldlc = 0; @@ -610,8 +561,7 @@ if(p->as == ATEXT) curtext = p; if(debug['V']) - Bprint(&bso, "%6lux %P\n", - p->pc, p); + Bprint(&bso, "%6llux %P\n", p->pc, p); continue; } if(debug['V']) @@ -643,8 +593,7 @@ else Bprint(&bso, " lc%ld(%d,%ld)\n", s, 0, s); - Bprint(&bso, "%6lux %P\n", - p->pc, p); + Bprint(&bso, "%6llux %P\n", p->pc, p); } lcsize += 5; continue; @@ -653,15 +602,13 @@ CPUT(0+s); /* 1-64 +lc */ if(debug['V']) { Bprint(&bso, " lc+%ld(%ld)\n", s, 0+s); - Bprint(&bso, "%6lux %P\n", - p->pc, p); + Bprint(&bso, "%6llux %P\n", p->pc, p); } } else { CPUT(64-s); /* 65-128 -lc */ if(debug['V']) { Bprint(&bso, " lc%ld(%ld)\n", s, 64-s); - Bprint(&bso, "%6lux %P\n", - p->pc, p); + Bprint(&bso, "%6llux %P\n", p->pc, p); } } lcsize++; @@ -954,7 +901,7 @@ if(o2) { o1 += 1; if(debug['a']) - Bprint(&bso, " %.8lux: %.8lux %.8lux%P\n", + Bprint(&bso, " %.8llux: %.8lux %.8lux%P\n", p->pc, o1, o2, p); LPUT(o1); LPUT(o2); --- /sys/src/cmd/vl/l.h Wed Jul 31 17:21:04 2013 +++ /sys/src/cmd/vl/l.h Wed Jul 31 17:21:04 2013 @@ -58,7 +58,7 @@ } u0; Prog* cond; Prog* link; - long pc; + vlong pc; long line; uchar mark; uchar optab; @@ -75,7 +75,7 @@ short version; short become; short frame; - long value; + vlong value; Sym* link; }; struct Autom @@ -185,10 +185,10 @@ EXTERN long HEADR; /* length of header */ EXTERN int HEADTYPE; /* type of header */ -EXTERN long INITDAT; /* data location */ -EXTERN long INITRND; /* data round above text location */ -EXTERN long INITTEXT; /* text location */ -EXTERN long INITTEXTP; /* text location (physical) */ +EXTERN vlong INITDAT; /* data location */ +EXTERN vlong INITRND; /* data round above text location */ +EXTERN vlong INITTEXT; /* text location */ +EXTERN vlong INITTEXTP; /* text location (physical) */ EXTERN char* INITENTRY; /* entry point */ EXTERN long autosize; EXTERN Biobuf bso; @@ -229,11 +229,11 @@ EXTERN Opcross opcross[10]; EXTERN Oprang oprange[ALAST]; EXTERN char* outfile; -EXTERN long pc; +EXTERN vlong pc; EXTERN uchar repop[ALAST]; EXTERN long symsize; EXTERN Prog* textp; -EXTERN long textsize; +EXTERN vlong textsize; EXTERN long thunk; EXTERN int version; EXTERN char xcmp[32][32]; @@ -249,6 +249,7 @@ Count mfrom; Count page; Count jump; + Count store; } nop; extern char* anames[]; @@ -275,7 +276,7 @@ void asmlc(void); int asmout(Prog*, Optab*, int); void asmsym(void); -long atolwhex(char*); +vlong atolwhex(char*); Prog* brloop(Prog*); void buildop(void); void buildrep(int, int); @@ -313,6 +314,7 @@ void names(void); void nocache(Prog*); void noops(void); +void nopstat(char*, Count*); void nuxiinit(void); void objfile(char*); int ocmp(const void*, const void*); @@ -327,7 +329,7 @@ void putsymb(char*, int, long, int); long regoff(Adr*); int relinv(int); -long rnd(long, long); +vlong rnd(vlong, long); void sched(Prog*, Prog*); void span(void); void strnput(char*, int); @@ -337,4 +339,3 @@ void xdefine(char*, int, long); void xfol(Prog*); void xfol(Prog*); -void nopstat(char*, Count*); --- /sys/src/cmd/vl/noop.c Wed Jul 31 17:21:05 2013 +++ /sys/src/cmd/vl/noop.c Wed Jul 31 17:21:06 2013 @@ -1,5 +1,218 @@ #include "l.h" +/* + * flag: insert nops to prevent three consecutive stores. + * workaround for 24k erratum #48, costs about 10% in text space, + * so only enable this if you need it. test cases are "hoc -e '7^6'" + * and "{ echo moon; echo plot } | scat". + */ +enum { + Mips24k = 0, +}; + +static int +isdblwrdmov(Prog *p) +{ + if(p == nil) + return 0; + switch(p->as){ + case AMOVD: + case AMOVDF: + case AMOVDW: + case AMOVFD: + case AMOVWD: + case AMOVV: + case AMOVVL: + case AMOVVR: + case AMOVFV: + case AMOVDV: + case AMOVVF: + case AMOVVD: + return 1; + } + return 0; +} + +static int +ismove(Prog *p) +{ + if(p == nil) + return 0; + switch(p->as){ + case AMOVB: + case AMOVBU: + case AMOVF: + case AMOVFW: + case AMOVH: + case AMOVHU: + case AMOVW: + case AMOVWF: + case AMOVWL: + case AMOVWR: + case AMOVWU: + return 1; + } + if(isdblwrdmov(p)) + return 1; + return 0; +} + +static int +isstore(Prog *p) +{ + if(p == nil) + return 0; + if(ismove(p)) + switch(p->to.type) { + case D_OREG: + case D_EXTERN: + case D_STATIC: + case D_AUTO: + case D_PARAM: + return 1; + } + return 0; +} + +static int +iscondbranch(Prog *p) +{ + if(p == nil) + return 0; + switch(p->as){ + case ABEQ: + case ABFPF: + case ABFPT: + case ABGEZ: + case ABGEZAL: + case ABGTZ: + case ABLEZ: + case ABLTZ: + case ABLTZAL: + case ABNE: + return 1; + } + return 0; +} + +static int +isbranch(Prog *p) +{ + if(p == nil) + return 0; + switch(p->as){ + case AJAL: + case AJMP: + case ARET: + case ARFE: + return 1; + } + if(iscondbranch(p)) + return 1; + return 0; +} + +static void +nopafter(Prog *p) +{ + p->mark |= LABEL|SYNC; + addnop(p); +} + +/* + * workaround for 24k erratum #48, costs about 0.5% in space. + * inserts a NOP before the last of 3 consecutive stores. + * double-word stores complicate things. + */ +static int +no3stores(Prog *p) +{ + Prog *p1; + + if(!isstore(p)) + return 0; + p1 = p->link; + if(!isstore(p1)) + return 0; + if(isdblwrdmov(p) || isdblwrdmov(p1)) { + nopafter(p); + nop.store.count++; + nop.store.outof++; + return 1; + } + if(isstore(p1->link)) { + nopafter(p1); + nop.store.count++; + nop.store.outof++; + return 1; + } + return 0; +} + +/* + * keep stores out of branch delay slots. + * this is costly in space (the other 9.5%), but makes no3stores effective. + * there is undoubtedly a better way to do this. + */ +void +storesnosched(void) +{ + Prog *p; + + for(p = firstp; p != P; p = p->link) + if(isstore(p)) + p->mark |= NOSCHED; +} + +int +triplestorenops(void) +{ + int r; + Prog *p, *p1; + + r = 0; + for(p = firstp; p != P; p = p1) { + p1 = p->link; +// if (p->mark & NOSCHED) +// continue; + if(ismove(p) && isstore(p)) { + if (no3stores(p)) + r++; + /* + * given storenosched, the next two + * checks shouldn't be necessary. + */ + /* + * add nop after first MOV in `MOV; Bcond; MOV'. + */ + else if(isbranch(p1) && isstore(p1->link)) { + nopafter(p); + nop.branch.count++; + nop.branch.outof++; + r++; + } + /* + * this may be a branch target, so insert a nop after, + * in case a branch leading here has a store in its + * delay slot and we have consecutive stores here. + */ + if(p->mark & (LABEL|SYNC) && !isnop(p1)) { + nopafter(p); + nop.branch.count++; + nop.branch.outof++; + r++; + } + } else if (isbranch(p)) + /* + * can't ignore delay slot of a conditional branch; + * the branch could fail and fall through. + */ + if (!iscondbranch(p) && p1) + p1 = p1->link; /* skip its delay slot */ + } + return r; +} + void noops(void) { @@ -348,6 +561,8 @@ break; } } + if (Mips24k) + storesnosched(); curtext = P; q = P; /* p - 1 */ @@ -388,6 +603,9 @@ } q = p; } + + if (Mips24k) + triplestorenops(); } void --- /sys/src/cmd/vl/obj.c Wed Jul 31 17:21:08 2013 +++ /sys/src/cmd/vl/obj.c Wed Jul 31 17:21:09 2013 @@ -1,3 +1,4 @@ +/* vl - mips linker */ #define EXTERN #include "l.h" #include @@ -11,19 +12,19 @@ char thechar = 'v'; char *thestring = "mips"; char *libdir; +int little; /* - * -H0 -T0x40004C -D0x10000000 is abbrev unix - * -H1 -T0x80020000 -R4 is bootp() format for 3k - * -H2 -T4128 -R4096 is plan9 format - * -H3 -T0x80020000 -R8 is bootp() format for 4k - * -H4 -T0x400000 -R4 is sgi unix coff executable - * -H5 -T0x4000A0 -R4 is sgi unix elf executable - * -H6 is headerless + * -H0 -T0x40004C -D0x10000000 is abbrev unix (boot image) + * -H1 -T0x80020000 -R4 is bootp() format for 3k (boot image) + * -H2 -T16416 -R16384 is plan9 format + * -H3 -T0x80020000 -R8 is bootp() format for 4k (4k boot image) + * -H4 -T0x400000 -R4 is sgi unix coff executable (4k boot image) + * -H5 -T0x4000A0 -R4 is sgi unix elf executable + * -H6 is headerless + * -H7 is 64-bit elf executable */ -int little; - void usage(void) { @@ -139,12 +140,12 @@ break; case 2: /* plan 9 */ HEADR = 32L; - if(INITTEXT == -1) - INITTEXT = 4128; if(INITDAT == -1) INITDAT = 0; if(INITRND == -1) - INITRND = 4096; + INITRND = 16*1024; + if(INITTEXT == -1) + INITTEXT = INITRND + HEADR; break; case 3: /* boot for 4k */ HEADR = 20L+56L+3*40L; @@ -182,14 +183,23 @@ if(INITRND == -1) INITRND = 4096; break; + case 7: /* 64-bit elf executable */ + HEADR = rnd(Ehdr64sz+3*Phdr64sz, 16); + if(INITTEXT == -1) + INITTEXT = 0x00400000L+HEADR; + if(INITDAT == -1) + INITDAT = 0x10000000; + if(INITRND == -1) + INITRND = 0; + break; } if (INITTEXTP == -1) INITTEXTP = INITTEXT; if(INITDAT != 0 && INITRND != 0) - print("warning: -D0x%lux is ignored because of -R0x%lux\n", + print("warning: -D%#llux is ignored because of -R%#llux\n", INITDAT, INITRND); if(debug['v']) - Bprint(&bso, "HEADER = -H0x%d -T0x%lux -D0x%lux -R0x%lux\n", + Bprint(&bso, "HEADER = -H%d -T%#llux -D%#llux -R%#llux\n", HEADTYPE, INITTEXT, INITDAT, INITRND); Bflush(&bso); zprg.as = AGOK; @@ -414,7 +424,7 @@ zaddr(uchar *p, Adr *a, Sym *h[]) { int i, c; - long l; + int l; Sym *s; Auto *u; @@ -689,7 +699,7 @@ void ldobj(int f, long c, char *pn) { - long ipc; + vlong ipc; Prog *p, *t; uchar *bloc, *bsize, *stop; Sym *h[NSYM], *s, *di; @@ -719,7 +729,7 @@ } o = bloc[0]; /* as */ if(o <= AXXX || o >= ALAST) { - diag("%s: line %ld: opcode out of range %d", pn, pc-ipc, o); + diag("%s: line %lld: opcode out of range %d", pn, pc-ipc, o); print(" probably not a .%c file\n", thechar); errorexit(); } --- /sys/src/cmd/vl/pass.c Wed Jul 31 17:21:10 2013 +++ /sys/src/cmd/vl/pass.c Wed Jul 31 17:21:11 2013 @@ -22,7 +22,7 @@ s->type, s->name, p); v = p->from.offset + p->reg; if(v > s->value) - diag("initialize bounds (%ld): %s\n%P", + diag("initialize bounds (%lld): %s\n%P", s->value, s->name, p); } @@ -135,7 +135,8 @@ if(strlen(s->name) >= 10) /* has loader address */ sprint(literal, "$%p.%lux", s, p->from.offset); else - sprint(literal, "$%s.%d.%lux", s->name, s->version, p->from.offset); + sprint(literal, "$%s.%d.%lux", s->name, + s->version, p->from.offset); } else { if(p->from.name != D_NONE) continue; @@ -338,7 +339,7 @@ void patch(void) { - long c, vexit; + vlong c, vexit; Prog *p, *q; Sym *s; int a; @@ -378,7 +379,7 @@ q = q->link; } if(q == P) { - diag("branch out of range %ld\n%P", c, p); + diag("branch out of range %lld\n%P", c, p); p->to.type = D_NONE; } p->cond = q; @@ -449,10 +450,10 @@ return P; } -long +vlong atolwhex(char *s) { - long n; + vlong n; int f; n = 0; @@ -489,8 +490,8 @@ return n; } -long -rnd(long v, long r) +vlong +rnd(vlong v, long r) { long c; --- /sys/src/cmd/vl/span.c Wed Jul 31 17:21:12 2013 +++ /sys/src/cmd/vl/span.c Wed Jul 31 17:21:13 2013 @@ -37,7 +37,7 @@ Sym *setext, *s; Optab *o; int m, bflag, i; - long c, otxt, v; + vlong c, otxt, v; if(debug['v']) Bprint(&bso, "%5.2f span\n", cputime()); @@ -154,7 +154,7 @@ if(INITRND) INITDAT = rnd(c, INITRND); if(debug['v']) - Bprint(&bso, "tsize = %lux\n", textsize); + Bprint(&bso, "tsize = %llux\n", textsize); Bflush(&bso); } --- /sys/src/cmd/vt/event.c Wed Jul 31 17:21:13 2013 +++ /sys/src/cmd/vt/event.c Wed Jul 31 17:21:14 2013 @@ -23,7 +23,7 @@ static int start_host(void) { - int fd; + int fd; cs = consctl(); @@ -58,7 +58,7 @@ einit(Emouse|Ekeyboard); outfd = start_host(); - if(estart(Ehost, outfd, BUFSIZ) != Ehost) { + if( estart(Ehost, outfd, BUFSIZ) != Ehost) { exits("event init error"); } }