--- /sys/src/9/port/fault.c Thu Jun 13 23:04:13 2013 +++ /sys/src/9/port/fault.c Mon Jun 24 22:28:37 2013 @@ -8,7 +8,6 @@ int fault(ulong addr, int read) { - int tries; Segment *s; char *sps; @@ -22,7 +21,7 @@ spllo(); m->pfault++; - for(tries = 200; tries > 0; tries--) { + for(;;) { s = seg(up, addr, 1); /* leaves s->lk qlocked if seg != nil */ if(s == 0) { up->psstate = sps; @@ -38,13 +37,6 @@ if(fixfault(s, addr, read, 1) == 0) /* qunlocks s->lk */ break; } - /* - * if we loop more than a few times, we're probably stuck on - * an unfixable address, almost certainly due to a bug - * elsewhere, so there's no point in spinning forever. - */ - if (tries <= 0) - panic("fault: fault stuck on va %#8.8p read %d\n", addr, read); up->psstate = sps; return 0; --- /sys/src/cmd/8l/elf.h Fri Mar 22 05:02:18 2013 +++ /sys/src/cmd/8l/elf.h Thu Jun 27 00:34:09 2013 @@ -45,6 +45,7 @@ I860 = 7, /* Intel i860 */ MIPS = 8, /* Mips R2000 */ S370 = 9, /* Amdhal */ + MIPSR4K = 10, /* Mips R4000 */ SPARC64 = 18, /* Sun SPARC v9 */ POWER = 20, /* PowerPC */ POWER64 = 21, /* PowerPC64 */ --- /sys/src/cmd/file.c Wed Apr 24 01:06:27 2013 +++ /sys/src/cmd/file.c Thu Jun 27 00:33:52 2013 @@ -1456,7 +1456,7 @@ if(n>0 && n < nelem(type) && type[n]) t = type[n]; - print("%s ELF %s\n", p, t); + print("%s ELF%s %s\n", p, (buf[4] == 2? "64": "32"), t); } else print("application/x-elf-executable"); --- /sys/src/cmd/ip/ipconfig/main.c Sat Jul 24 00:51:30 2010 +++ /sys/src/cmd/ip/ipconfig/main.c Tue Jun 25 00:35:14 2013 @@ -1156,6 +1156,10 @@ DEBUG("dhcprecv: read timed out"); return; } + if(n == 0){ + warning("dhcprecv: zero-length packet read"); + return; + } bp = parsebootp(buf, n); if(bp == 0) { @@ -1608,7 +1612,8 @@ bp = (Bootp*)p; if(n < bp->optmagic - p) { - warning("parsebootp: short bootp packet"); + warning("parsebootp: short bootp packet; with options, " + "need %d bytes, got %d", bp->optmagic - p, n); return nil; } --- /sys/src/cmd/vl/noop.c Sun Jun 23 06:46:35 2013 +++ /sys/src/cmd/vl/noop.c Tue Jun 25 00:34:29 2013 @@ -3,7 +3,8 @@ /* * 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. a test case is "hoc -e '7^6'". + * so only enable this if you need it. test cases are "hoc -e '7^6'" + * and "{ echo moon; echo plot } | scat". */ enum { Mips24k = 0, @@ -111,6 +112,13 @@ 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. @@ -127,15 +135,13 @@ if(!isstore(p1)) return 0; if(isdblwrdmov(p) || isdblwrdmov(p1)) { - p->mark |= LABEL|SYNC; - addnop(p); + nopafter(p); nop.store.count++; nop.store.outof++; return 1; } if(isstore(p1->link)) { - p1->mark |= LABEL|SYNC; - addnop(p1); + nopafter(p1); nop.store.count++; nop.store.outof++; return 1; @@ -155,21 +161,48 @@ for(p = firstp; p != P; p = p->link) if(isstore(p)) - p->mark |= NOSCHED; /* keep stores out of delay slots */ + p->mark |= NOSCHED; } -void +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)) - no3stores(p); - else if (isbranch(p)) + 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. @@ -177,6 +210,7 @@ if (!iscondbranch(p) && p1) p1 = p1->link; /* skip its delay slot */ } + return r; } void --- /sys/src/libmach/elf.h Wed Jul 18 02:17:55 2012 +++ /sys/src/libmach/elf.h Thu Jun 27 00:35:28 2013 @@ -119,6 +119,7 @@ I860 = 7, /* Intel i860 */ MIPS = 8, /* Mips R2000 */ S370 = 9, /* Amdhal */ + MIPSR4K = 10, /* Mips R4000 */ SPARC64 = 18, /* Sun SPARC v9 */ POWER = 20, /* PowerPC */ POWER64 = 21, /* PowerPC64 */