M alphapc/trap.c => alphapc/trap.c +37 -32
@@ 682,10 682,12 @@ print("unknown noted arg 0x%lux\n", arg0);
long
syscall(Ureg *aur)
{
+ int i;
char *e;
long ret;
ulong sp;
Ureg *ur;
+ ulong scallnr;
m->syscall++;
up = m->proc;
@@ 695,9 697,10 @@ syscall(Ureg *aur)
up->dbgreg = aur;
ur->type = 5; /* for debugging */
+ scallnr = ur->r0;
up->scallnr = ur->r0;
- if(up->scallnr == RFORK && up->fpstate == FPactive){
+ if(scallnr == RFORK && up->fpstate == FPactive){
savefpregs(&up->fpsave);
up->fpstate = FPinactive;
//print("SR=%lux+", up->fpsave.fpstatus);
@@ 707,46 710,48 @@ syscall(Ureg *aur)
sp = ur->sp;
up->nerrlab = 0;
ret = -1;
- if(waserror())
- goto error;
-
- if(up->scallnr >= nsyscall){
- pprint("bad sys call %d pc %lux\n",
- up->scallnr, (ulong)ur->pc);
-print("bad sys call %d pc %lux\n", up->scallnr, (ulong)ur->pc);
- postnote(up, 1, "sys: bad sys call", NDebug);
- error(Ebadarg);
- }
-
- if(sp & (BY2WD-1)){ /* XXX too weak? */
- pprint("odd sp in sys call pc %lux sp %lux\n",
- (ulong)ur->pc, (ulong)ur->sp);
- postnote(up, 1, "sys: odd stack", NDebug);
- error(Ebadarg);
- }
-
- if(sp<(USTKTOP-BY2PG) || sp>(USTKTOP-sizeof(Sargs)))
- validaddr(sp, sizeof(Sargs), 0);
+ if(!waserror()) {
+ if(scallnr >= nsyscall || systab[scallnr] == nil){
+ pprint("bad sys call %d pc %lux\n", up->scallnr, (ulong)ur->pc);
+ postnote(up, 1, "sys: bad sys call", NDebug);
+ error(Ebadarg);
+ }
- up->s = *((Sargs*)(sp+2*BY2WD));
- up->psstate = sysctab[up->scallnr];
+ if(sp & (BY2WD-1)){ /* XXX too weak? */
+ pprint("odd sp in sys call pc %lux sp %lux\n",
+ (ulong)ur->pc, (ulong)ur->sp);
+ postnote(up, 1, "sys: odd stack", NDebug);
+ error(Ebadarg);
+ }
- ret = (*systab[up->scallnr])(up->s.args);
- poperror();
+ if(sp<(USTKTOP-BY2PG) || sp>(USTKTOP-sizeof(Sargs)))
+ validaddr(sp, sizeof(Sargs), 0);
-error:
- /* failure: save the error buffer for errstr */
- e = up->syserrstr;
- up->syserrstr = up->errstr;
- up->errstr = e;
+ up->s = *((Sargs*)(sp+2*BY2WD));
+ up->psstate = sysctab[scallnr];
+ ret = systab[scallnr](up->s.args);
+ poperror();
+ }else{
+ /* failure: save the error buffer for errstr */
+ e = up->syserrstr;
+ up->syserrstr = up->errstr;
+ up->errstr = e;
+ }
+ if(up->nerrlab){
+ print("bad errstack [%uld]: %d extra\n", scallnr, up->nerrlab);
+ for(i = 0; i < NERR; i++)
+ print("sp=%lux pc=%lux\n",
+ up->errlab[i].sp, up->errlab[i].pc);
+ panic("error stack");
+ }
up->nerrlab = 0;
up->psstate = 0;
up->insyscall = 0;
- if(up->scallnr == NOTED) /* ugly hack */
+ if(scallnr == NOTED) /* ugly hack */
noted(ur, &aur, *(ulong*)(sp+2*BY2WD)); /* doesn't return */
- if(up->scallnr!=RFORK && (up->procctl || up->nnote)){
+ if(scallnr!=RFORK && (up->procctl || up->nnote)){
ur->r0 = ret; /* load up for noted() */
if(notify(ur))
return ur->r0;
M mtx/trap.c => mtx/trap.c +5 -6
@@ 627,10 627,10 @@ dbgpc(Proc *p)
void
syscall(Ureg* ureg)
{
+ int i;
char *e;
- ulong sp;
long ret;
- int i, scallnr;
+ ulong sp, scallnr;
m->syscall++;
up->insyscall = 1;
@@ 638,15 638,14 @@ syscall(Ureg* ureg)
up->dbgreg = ureg;
scallnr = ureg->r3;
-//print("scall %s lr =%lux\n", sysctab[scallnr], ureg->lr);
- up->scallnr = scallnr;
+ up->scallnr = ureg->r3;
spllo();
sp = ureg->usp;
up->nerrlab = 0;
ret = -1;
if(!waserror()){
- if(scallnr >= nsyscall){
+ if(scallnr >= nsyscall || systab[scallnr] == nil){
pprint("bad sys call number %d pc %lux\n", scallnr, ureg->pc);
postnote(up, 1, "sys: bad sys call", NDebug);
error(Ebadarg);
@@ 667,7 666,7 @@ syscall(Ureg* ureg)
up->errstr = e;
}
if(up->nerrlab){
- print("bad errstack [%d]: %d extra\n", scallnr, up->nerrlab);
+ print("bad errstack [%uld]: %d extra\n", scallnr, up->nerrlab);
print("scall %s lr =%lux\n", sysctab[scallnr], ureg->lr);
for(i = 0; i < NERR; i++)
print("sp=%lux pc=%lux\n", up->errlab[i].sp, up->errlab[i].pc);
M pc/kbd.c => pc/kbd.c +16 -2
@@ 354,10 354,24 @@ i8042intr(Ureg*, void*)
return;
case Latin:
alt = 1;
- collecting = 1;
- nk = 0;
+ /*
+ * VMware uses Ctl-Alt as the key combination
+ * to make the VM give up keyboard and mouse focus.
+ * This has the unfortunate side effect that when you
+ * come back into focus, Plan 9 thinks you want to type
+ * a compose sequence (you just typed alt).
+ *
+ * As a clusmy hack around this, we look for ctl-alt
+ * and don't treat it as the start of a compose sequence.
+ */
+ if(!ctl){
+ collecting = 1;
+ nk = 0;
+ }
return;
case Ctrl:
+ collecting = 0;
+ nk = 0;
ctl = 1;
return;
}
M pc/trap.c => pc/trap.c +2 -1
@@ 531,7 531,8 @@ syscall(Ureg* ureg)
char *e;
ulong sp;
long ret;
- int i, scallnr;
+ int i;
+ ulong scallnr;
if((ureg->cs & 0xFFFF) != UESEL)
panic("syscall: cs 0x%4.4luX\n", ureg->cs);
M pc/usbuhci.c => pc/usbuhci.c +15 -11
@@ 1425,23 1425,33 @@ reset(Usbhost *uh)
if(ctlr == nil)
return -1;
+ io = ctlr->io;
p = ctlr->pcidev;
- pcicfgw16(p, 0xc0, 0x2000); /* legacy support register: turn off lunacy mode */
uh->ctlr = ctlr;
- uh->port = ctlr->io;
+ uh->port = io;
uh->irq = p->intl;
uh->tbdf = p->tbdf;
- io = ctlr->io;
- i = inb(io+SOFMod);
+ XPRINT("usbcmd\t0x%.4x\nusbsts\t0x%.4x\nusbintr\t0x%.4x\nfrnum\t0x%.2x\n",
+ IN(Cmd), IN(Status), IN(Usbintr), inb(io+Frnum));
+ XPRINT("frbaseadd\t0x%.4x\nsofmod\t0x%x\nportsc1\t0x%.4x\nportsc2\t0x%.4x\n",
+ IN(Flbaseadd), inb(io+SOFMod), IN(Portsc0), IN(Portsc1));
+
+ OUT(Cmd, 0); /* stop */
+ while((IN(Status) & (1<<5)) == 0) /* wait for halt */
+ ;
+ OUT(Status, 0xFF); /* clear pending interrupts */
+ pcicfgw16(p, 0xc0, 0x2000); /* legacy support register: turn off lunacy mode */
+
if(0){
+ i = inb(io+SOFMod);
OUT(Cmd, 4); /* global reset */
delay(15);
OUT(Cmd, 0); /* end reset */
delay(4);
+ outb(io+SOFMod, i);
}
- outb(io+SOFMod, i);
ctlr->tdpool = xspanalloc(128*sizeof(TD), 16, 0);
for(i=128; --i>=0;){
@@ 1475,12 1485,6 @@ reset(Usbhost *uh)
ctlr->bulkq->head = PCIWADDR(ctlr->recvq) | IsQH;
ctlr->recvq->head = PCIWADDR(ctlr->bwsop) | IsQH; /* loop back */
- XPRINT("usbcmd\t0x%.4x\nusbsts\t0x%.4x\nusbintr\t0x%.4x\nfrnum\t0x%.2x\n",
- IN(Cmd), IN(Status), IN(Usbintr), inb(io+Frnum));
- XPRINT("frbaseadd\t0x%.4x\nsofmod\t0x%x\nportsc1\t0x%.4x\nportsc2\t0x%.4x\n",
- IN(Flbaseadd), inb(io+SOFMod), IN(Portsc0), IN(Portsc1));
- OUT(Cmd, 0); /* stop */
-
ctlr->frames = xspanalloc(FRAMESIZE, FRAMESIZE, 0);
ctlr->frameld = xallocz(FRAMESIZE, 1);
for (i = 0; i < NFRAME; i++)