M boot/boot.c => boot/boot.c +2 -17
@@ 19,8 19,6 @@ int mflag;
int fflag;
int kflag;
int aflag;
-int nflag;
-int pflag;
int afd = -1;
char *bargv[Nbarg];
@@ 53,9 51,6 @@ boot(int argc, char *argv[])
print("\n");
#endif DEBUG
- if(argc <= 1)
- pflag = 1;
-
ARGBEGIN{
case 'a':
aflag = 1;
@@ 66,16 61,9 @@ boot(int argc, char *argv[])
case 'k':
kflag = 1;
break;
- case 'n':
- nflag = 1;
- break;
case 'm':
- pflag = 1;
mflag = 1;
break;
- case 'p':
- pflag = 1;
- break;
case 'f':
fflag = 1;
break;
@@ 129,8 117,6 @@ boot(int argc, char *argv[])
if(mount(fd, "/", MAFTER|MCREATE, "") < 0)
fatal("mount");
close(fd);
- if(cpuflag == 0 && nflag == 0)
- newkernel();
/*
* if a local file server exists and it's not
@@ 215,9 201,8 @@ rootserver(char *arg)
strcpy(reply, method->name);
/* parse replies */
- for(notfirst = 0;; notfirst = 1){
- if(pflag || notfirst)
- outin(prompt, reply, sizeof(reply));
+ for(;;){
+ outin(prompt, reply, sizeof(reply));
mp = findmethod(reply);
if(mp){
for(cp = reply; bargc < Nbarg-1 && *cp;){
M boot/local.c => boot/local.c +26 -12
@@ 4,7 4,6 @@
static char diskname[2*NAMELEN];
static char *disk;
-static char *niob;
void
configlocal(Method *mp)
@@ 12,20 11,39 @@ configlocal(Method *mp)
char *p;
int n;
- disk = mp->arg; /* 1st try from config file */
- if(disk && (niob = strchr(disk, ' '))) /* assign = */
- *niob++ = 0;
- if(strncmp(argv0, "dksc(0,", 7) == 0){
+ if(*sys == '/' || *sys == '#'){
+ /*
+ * if the user specifies the disk in the boot cmd or
+ * 'root is from' prompt, use it
+ */
+ disk = sys;
+ } else if(strncmp(argv0, "dksc(0,", 7) == 0){
+ /*
+ * on many mips arg0 of the boot command specifies the
+ * scsi logical unit number
+ */
p = strchr(argv0, ',');
n = strtoul(p+1, 0, 10);
sprint(diskname, "#w%d/sd%dfs", n, n);
disk = diskname;
- /*print("argv0=\"%s\" --> disk = \"%s\"\n", argv0, disk);/**/
+ } else if(mp->arg){
+ /*
+ * a default is supplied when the kernel is made
+ */
+ disk = mp->arg;
+ } else if(*bootdisk){
+ /*
+ * an environment variable from a pc's plan9.ini or
+ * from the mips nvram or generated by the kernel
+ * is the last resort.
+ */
+ disk = bootdisk;
}
- if(*sys == '/' || *sys == '#')
- disk = sys;
+
+ /* if we've decided on one, pass it on to all programs */
if(disk)
setenv("bootdisk", disk);
+
USED(mp);
}
@@ 72,10 90,6 @@ connectlocal(void)
close(p[1]);
argp = args;
*argp++ = "fs";
- if(niob){
- *argp++ = "-B";
- *argp++ = niob;
- }
*argp++ = "-f";
*argp++ = partition;
*argp++ = "-s";
M carrera/trap.c => carrera/trap.c +1 -2
@@ 596,8 596,7 @@ noted(Ureg *kur, Ureg **urp, ulong arg0)
nur = up->ureg;
oureg = (ulong)nur;
- if(oureg>=USTKTOP || oureg<USTKTOP-USTKSIZE
- || (oureg & (BY2V-1))
+ if((oureg & (BY2V-1))
|| !okaddr((ulong)oureg-BY2WD, BY2WD+sizeof(Ureg), 0)){
pprint("bad ureg in noted or call to noted() when not notified\n");
qunlock(&up->debug);
M pc/devvga.c => pc/devvga.c +0 -9
@@ 1051,21 1051,12 @@ screenputs(char *s, int n)
unlock(&screenlock);
}
-/*
- * paging routines for different cards
- */
static void
nopage(int page)
{
USED(page);
}
-static void
-cirruspage(int page)
-{
- vgaxo(Grx, 0x09, page<<4);
-}
-
/*
* character mode console
*/
M pc/main.c => pc/main.c +0 -1
@@ 219,7 219,6 @@ bootargs(ulong base)
ac = 0;
av[ac++] = pusharg("/386/9dos");
- av[ac++] = pusharg("-p");
cp[64] = 0;
buf[0] = 0;
if(strncmp(cp, "fd!", 3) == 0){
M pc/trap.c => pc/trap.c +2 -3
@@ 523,7 523,7 @@ notify(Ureg *ur)
sp -= sizeof(Ureg);
if(!okaddr((ulong)up->notify, 1, 0)
- || !okaddr(sp-ERRLEN-3*BY2WD, sizeof(Ureg)+ERRLEN-3*BY2WD, 0)){
+ || !okaddr(sp-ERRLEN-4*BY2WD, sizeof(Ureg)+ERRLEN+4*BY2WD, 1)){
pprint("suicide: bad address in notify\n");
qunlock(&up->debug);
pexit("Suicide", 0);
@@ 572,8 572,7 @@ noted(Ureg *ur, ulong arg0)
/* sanity clause */
oureg = (ulong)nur;
- if(oureg>=USTKTOP || oureg<USTKTOP-USTKSIZE
- || !okaddr((ulong)oureg-BY2WD, BY2WD+sizeof(Ureg), 0)){
+ if(!okaddr((ulong)oureg-BY2WD, BY2WD+sizeof(Ureg), 0)){
pprint("bad ureg in noted or call to noted() when not notified\n");
qunlock(&up->debug);
pexit("Suicide", 0);
A pc/vgaclgd542x.c => pc/vgaclgd542x.c +29 -0
@@ 0,0 1,29 @@
+#include "u.h"
+#include "../port/lib.h"
+#include "mem.h"
+#include "dat.h"
+#include "fns.h"
+#include "../port/error.h"
+
+#include <libg.h>
+#include "screen.h"
+#include "vga.h"
+
+static void
+clgd542xpage(int page)
+{
+ vgaxo(Grx, 0x09, page<<4);
+}
+
+static Vgac clgd542x = {
+ "clgd542x",
+ clgd542xpage,
+
+ 0,
+};
+
+void
+vgaclgd542xlink(void)
+{
+ addvgaclink(&clgd542x);
+}
M pc/vgaet4000.c => pc/vgaet4000.c +1 -1
@@ 258,7 258,7 @@ Hwgc et4000hwgc = {
0,
};
-void
+static void
et4000page(int page)
{
if(hwgc == &et4000hwgc){
M pc/vgas3.c => pc/vgas3.c +1 -1
@@ 231,7 231,7 @@ Hwgc s3hwgc = {
0,
};
-void
+static void
s3page(int page)
{
if(hwgc == &s3hwgc){
M port/sysproc.c => port/sysproc.c +1 -0
@@ 567,6 567,7 @@ syssegbrk(ulong *arg)
switch(s->type&SG_TYPE) {
case SG_TEXT:
case SG_DATA:
+ case SG_STACK:
error(Ebadarg);
default:
return ibrk(arg[1], i);
D power/conf.h => power/conf.h +0 -22
@@ 1,22 0,0 @@
-Conftab conftab[] = {
- {"nmach", &conf.nmach },
- {"nproc", &conf.nproc },
- {"npage0", &conf.npage0 },
- {"npage1", &conf.npage1 },
- {"npage", &conf.npage },
- {"upages", &conf.upages },
- {"nimage", &conf.nimage },
- {"nswap", &conf.nswap },
- {"base0", &conf.base0 },
- {"base1", &conf.base1 },
- {"copymode", &conf.copymode },
- {"ipif", &conf.ipif },
- {"ip", &conf.ip },
- {"arp", &conf.arp },
- {"frag", &conf.frag },
- {"debugger", &conf.debugger },
- {"ialloc", &conf.ialloc },
- {"pipeqsize", &conf.pipeqsize },
- { 0, 0 },
-};
-
M power/dat.h => power/dat.h +1 -2
@@ 84,8 84,7 @@ struct PMMU
*/
struct Notsave
{
- ulong svstatus;
- ulong svr1;
+ int UNUSED;
};
#include "../port/portdat.h"
M power/mem.h => power/mem.h +4 -0
@@ 50,6 50,8 @@
#define KUC 0x00000002
#define IEP 0x00000004
#define KUP 0x00000008
+#define IEO 0x00000010
+#define KUO 0x00000020
#define INTMASK 0x0000ff00
#define SW0 0x00000100
#define SW1 0x00000200
@@ 61,6 63,8 @@
#define INTR5 0x00008000
#define ISC 0x00010000
#define SWC 0x00020000
+#define CM 0x00080000
+#define PE 0x00100000
#define CU1 0x20000000
/*
M power/trap.c => power/trap.c +52 -12
@@ 8,7 8,7 @@
#include "../port/error.h"
void (*vmevec[256])(int);
-void noted(Ureg**, ulong);
+void noted(Ureg*, Ureg**, ulong);
void rfnote(Ureg**);
char *excname[] =
@@ 398,23 398,22 @@ notify(Ureg *ur)
qunlock(&up->debug);
pexit(n->msg, n->flag!=NDebug);
}
- up->svstatus = ur->status;
sp = ur->usp - sizeof(Ureg);
- if(sp&0x3 || !okaddr((ulong)up->notify, BY2WD, 0)
- || !okaddr(sp-ERRLEN-3*BY2WD, sizeof(Ureg)+ERRLEN+3*BY2WD, 1)) {
+ if(sp&(BY2WD-1) || !okaddr((ulong)up->notify, BY2WD, 0)
+ || !okaddr(sp-ERRLEN-4*BY2WD, sizeof(Ureg)+ERRLEN+4*BY2WD, 1)) {
pprint("suicide: bad address or sp in notify\n");
qunlock(&up->debug);
pexit("Suicide", 0);
}
- up->ureg = (void*)sp;
memmove((Ureg*)sp, ur, sizeof(Ureg));
- sp -= ERRLEN;
+ *(Ureg**)(sp-BY2WD) = up->ureg; /* word under Ureg is old up->ureg */
+ up->ureg = (void*)sp;
+ sp -= BY2WD+ERRLEN;
memmove((char*)sp, up->note[0].msg, ERRLEN);
sp -= 3*BY2WD;
*(ulong*)(sp+2*BY2WD) = sp+3*BY2WD; /* arg 2 is string */
- up->svr1 = ur->r1; /* save away r1 */
ur->r1 = (ulong)up->ureg; /* arg 1 is ureg* */
*(ulong*)(sp+1*BY2WD) = (ulong)up->ureg;/* arg 1 0(FP) is ureg* (for Alef) */
*(ulong*)(sp+0*BY2WD) = 0; /* arg 0 is pc */
@@ 431,15 430,31 @@ notify(Ureg *ur)
}
/*
+ * Check that status is OK to return from note.
+ */
+int
+validstatus(ulong kstatus, ulong ustatus)
+{
+ if((kstatus & INTMASK) != (ustatus & INTMASK))
+ return 0;
+ if((ustatus&(KUO|IEO|KUP|IEP|KUC|IE)) != (KUP|IEP))
+ return 0;
+ if(ustatus & (0xFFFF0000&~(CU1|CM|PE))) /* no CU3, CU2, CU0, BEV, TS, PZ, SWC, ISC */
+ return 0;
+ return 1;
+}
+
+/*
* Return user to state before notify()
*/
void
-noted(Ureg **urp, ulong arg0)
+noted(Ureg *kur, Ureg **urp, ulong arg0)
{
Ureg *nur;
+ ulong oureg, sp;
qlock(&up->debug);
- if(!up->notified) {
+ if(arg0!=NRSTR && !up->notified) {
qunlock(&up->debug);
pprint("call to noted() when not notified\n");
pexit("Suicide", 0);
@@ 447,16 462,25 @@ noted(Ureg **urp, ulong arg0)
up->notified = 0;
nur = up->ureg;
- if(nur->status != up->svstatus) {
+
+ oureg = (ulong)nur;
+ if((oureg & (BY2WD-1))
+ || !okaddr((ulong)oureg-BY2WD, BY2WD+sizeof(Ureg), 0)){
+ pprint("bad ureg in noted or call to noted() when not notified\n");
+ qunlock(&up->debug);
+ pexit("Suicide", 0);
+ }
+
+ if(!validstatus(kur->status, nur->status)) {
qunlock(&up->debug);
pprint("bad noted ureg status %lux\n", nur->status);
pexit("Suicide", 0);
}
memmove(*urp, up->ureg, sizeof(Ureg));
- (*urp)->r1 = up->svr1;
switch(arg0) {
case NCONT:
+ case NRSTR:
if(!okaddr(nur->pc, 1, 0) || !okaddr(nur->usp, BY2WD, 0)){
pprint("suicide: trap in noted\n");
qunlock(&up->debug);
@@ 467,6 491,22 @@ noted(Ureg **urp, ulong arg0)
rfnote(urp);
break;
+ case NSAVE:
+ if(!okaddr(nur->pc, BY2WD, 0) || !okaddr(nur->usp, BY2WD, 0)){
+ pprint("suicide: trap in noted\n");
+ qunlock(&up->debug);
+ pexit("Suicide", 0);
+ }
+ qunlock(&up->debug);
+ sp = oureg-4*BY2WD-ERRLEN;
+ splhi();
+ (*urp)->sp = sp;
+ ((ulong*)sp)[1] = oureg; /* arg 1 0(FP) is ureg* */
+ ((ulong*)sp)[0] = 0; /* arg 0 is pc */
+ (*urp)->r1 = oureg; /* arg 1 is ureg* */
+ rfnote(urp);
+ break;
+
default:
pprint("unknown noted arg 0x%lux\n", arg0);
up->lastnote.flag = NDebug;
@@ 542,7 582,7 @@ syscall(Ureg *aur)
up->psstate = 0;
up->insyscall = 0;
if(up->scallnr == NOTED) /* ugly hack */
- noted(&aur, *(ulong*)(sp+BY2WD)); /* doesn't return */
+ noted(ur, &aur, *(ulong*)(sp+BY2WD)); /* doesn't return */
splhi();
if(up->scallnr!=RFORK && (up->procctl || up->nnote)){