M boot/key.c => boot/key.c +3 -0
@@ 83,6 83,9 @@ key(int islocal, Method *mp)
}
close(fd);
+//fprint(2, "hostowner = %s\n", safe->authid);
+//fprint(2, "hostdomain = %s\n", safe->authdom);
+
/* set host's key */
if(writefile("#c/key", safe->machkey, DESKEYLEN) < 0)
fatal("#c/key");
M boot/sac.c => boot/sac.c +1 -7
@@ 15,7 15,6 @@ configsac(Method *mp)
USED(mp);
-print("configsac\n");
/*
* create the name space, mount the root fs
*/
@@ 24,6 23,7 @@ print("configsac\n");
if(bind("#C", "/", MAFTER) < 0)
fatal("bind /");
+ // fixed sysname - enables correct namespace file
fd = open("#c/sysname", OWRITE);
if(fd < 0)
fatal("open sysname");
@@ 36,12 36,6 @@ print("configsac\n");
write(fd, "brick", 5);
close(fd);
- bargc = parsefields("-n 135.104.9.69 255.255.255.0 135.104.9.1 "
- "135.104.9.69 135.104.9.69", bargv, Nbarg-1, " ");
- configip("ether0");
-
- // fixed sysname - enables correct cpurc and namespace files
- // to be used
sprint(cmd, "/%s/init", cputype);
execl(cmd, "init", "-c", 0);
M ip/esp.c => ip/esp.c +5 -5
@@ 352,7 352,7 @@ espiput(Proto *esp, uchar*, Block *bp)
bp = concatblock(bp);
if(BLEN(bp) < EsphdrSize + ecb->espivlen + EsptailSize + ecb->ahlen) {
- qunlock(esp);
+ qunlock(c);
netlog(f, Logesp, "esp: short block %I -> %I!%d\n", raddr,
laddr, spi);
freeb(bp);
@@ 362,7 362,7 @@ espiput(Proto *esp, uchar*, Block *bp)
eh = (Esphdr*)(bp->rp);
auth = bp->wp - ecb->ahlen;
if(!ecb->auth(ecb, eh->espspi, auth-eh->espspi, auth)) {
- qunlock(esp);
+ qunlock(c);
print("esp: bad auth %I -> %I!%ld\n", raddr, laddr, spi);
netlog(f, Logesp, "esp: bad auth %I -> %I!%d\n", raddr,
laddr, spi);
@@ 372,14 372,14 @@ print("esp: bad auth %I -> %I!%ld\n", raddr, laddr, spi);
payload = BLEN(bp)-EsphdrSize-ecb->ahlen;
if(payload<=0 || payload%4 != 0 || payload%ecb->espblklen!=0) {
- qunlock(esp);
+ qunlock(c);
netlog(f, Logesp, "esp: bad length %I -> %I!%d payload=%d BLEN=%d\n", raddr,
laddr, spi, payload, BLEN(bp));
freeb(bp);
return;
}
if(!ecb->cipher(ecb, bp->rp+EsphdrSize, payload)) {
- qunlock(esp);
+ qunlock(c);
print("esp: cipher failed %I -> %I!%ld: %r\n", raddr, laddr, spi);
netlog(f, Logesp, "esp: cipher failed %I -> %I!%d: %r\n", raddr,
laddr, spi);
@@ 392,7 392,7 @@ print("esp: cipher failed %I -> %I!%ld: %r\n", raddr, laddr, spi);
payload -= et->pad + ecb->espivlen;
nexthdr = et->nexthdr;
if(payload <= 0) {
- qunlock(esp);
+ qunlock(c);
netlog(f, Logesp, "esp: short packet after decrypt %I -> %I!%d\n", raddr,
laddr, spi);
freeb(bp);
M mpc/devrtc.c => mpc/devrtc.c +1 -1
@@ 22,7 22,7 @@ enum{
Nvoff= 4*1024, /* where usable nvram lives */
Nvsize= 4*1024,
- Nvoff2= 8*1024, /* where usable nvram lives */
+ Nvoff2= 8*1024, /* where second usable nvram lives */
Nvsize2= 4*1024,
};
M mpc/main.c => mpc/main.c +22 -19
@@ 15,6 15,14 @@ int nconf;
int predawn = 1;
+typedef struct Bootargs Bootargs;
+
+struct Bootargs
+{
+ char args[1000];
+ uchar chksum;
+};
+
Conf conf;
static void options(void);
@@ 31,22 39,10 @@ main(void)
cpminit();
uartinstall();
mmuinit();
-if(0) {
- predawn = 0;
- print("spllo() = %ux\n", spllo());
- for(;;) {
- print("hello\n");
- delay(1000);
- }
-}
+
// turn on pcmcia
*(uchar*)(NVRAMMEM+0x100001) |= 0x60;
-//print("sr1=%ux sr2=%ux\n", *(uchar*)(NVRAMMEM+0x100000), *(uchar*)(NVRAMMEM+0x100001));
-//print("sccr=%ulx\n", m->iomem->sccr);
-print("%ux %ux\n", m->iomem->memc[0].base, m->iomem->memc[7].base);
-print("%ux %ux\n", m->iomem->memc[0].option, m->iomem->memc[7].option);
-print("%ux\n", *(uchar*)(0xff000000));
pageinit();
procinit0();
initseg();
@@ 81,8 77,10 @@ machinit(void)
*(ushort*)&(io->memc[4].base) = 0x8060;
// *(ushort*)&(io->memc[7].option) = 0xffe0;
*(ushort*)&(io->memc[7].base) = 0xff00;
+
}
+
void
bootargs(ulong base)
{
@@ 278,7 276,7 @@ confinit(void)
conf.npage = conf.npage0 + conf.npage1;
- conf.upages = (conf.npage*50)/100;
+ conf.upages = (conf.npage*60)/100;
conf.ialloc = ((conf.npage-conf.upages)/2)*BY2PG;
/* set up other configuration parameters */
@@ 312,10 310,7 @@ getcfields(char* lp, char** fields, int n, char* sep)
static char BOOTARGS[] =
"ether0=type=SCC port=1 ea=08003e27df94\r\n"
- "ether1=type=589E port=0x300\r\n"
- "vgasize=640x480x8\r\n"
- "kernelpercent=40\r\n"
- "console=0 lcd\r\nbaud=9600\r\n";
+ "ether1=type=589E port=0x300\r\n";
static void
options(void)
@@ 323,11 318,18 @@ options(void)
long i, n;
char *cp, *p, *q;
char *line[MAXCONF];
+ Bootargs *ba;
/*
* parse configuration args from dos file plan9.ini
*/
- cp = BOOTARGS; /* where b.com leaves its config */
+ ba = (Bootargs*)(NVRAMMEM+ 4*1024);
+ if(ba->chksum == nvcsum(ba->args, sizeof(ba->args))) {
+ cp = smalloc(strlen(ba->args)+1);
+ memmove(cp, ba->args, strlen(ba->args)+1);
+ } else
+ cp = BOOTARGS;
+print("bootargs = %s\n", cp);
/*
* Strip out '\r', change '\t' -> ' '.
@@ 435,3 437,4 @@ cistrcmp(char *a, char *b)
}
return 0;
}
+
M mpc/mem.h => mpc/mem.h +1 -1
@@ 176,7 176,7 @@
#define INTMEM 0x80000000
#define ISAMEM 0x80100000
#define FLASHMEM 0xff000000
-#define SACMEM FLASHMEM + 0x40000
+#define SACMEM FLASHMEM + 0x80000
#define NVRAMMEM 0x80600000
#define DRAMMEM 0xff800000 /* to 0xffffffff: 8 Meg */
M port/devtinyfs.c => port/devtinyfs.c +6 -6
@@ 460,7 460,7 @@ tinyfsgen(Chan *c, Dirtab *tab, int ntab, int i, Dir *dp)
return 0;
qid.path = i;
qid.vers = 0;
- devdir(c, qid, f->name, f->length, eve, 0664, dp);
+ devdir(c, qid, f->name, f->length, eve, 0775, dp);
return 1;
}
@@ 480,13 480,12 @@ tinyfsattach(void *spec)
Tfs *fs;
Chan *c;
volatile struct { Chan *cc; } rock;
- int i, fd;
+ int i;
+ char buf[NAMELEN*2];
- fd = atoi(spec);
- if(fd < 0)
- error("bad specifier");
+ snprint(buf, sizeof(buf), "/dev/%s", spec);
+ rock.cc = namec(buf, Aopen, ORDWR, 0);
- rock.cc = fdtochan(fd, ORDWR, 0, 1);
if(waserror()){
cclose(rock.cc);
nexterror();
@@ 594,6 593,7 @@ tinyfsopen(Chan *c, int omode)
c->qid.path = f - rock.fs->f;
break;
case OREAD:
+ case OEXEC:
break;
default:
error(Eperm);
M port/portdat.h => port/portdat.h +1 -1
@@ 744,7 744,7 @@ struct Logflag {
struct Cmdbuf
{
- char buf[64];
+ char buf[256];
char *f[16];
int nf;
};