From 4fa1a84123c6c5454cd920511aa28dbad21f7b16 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Sat, 11 Jun 1994 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1994-06-11 --- carrera/fptrap.c | 12 +++++++----- carrera/l.s | 2 +- carrera/mem.h | 1 - carrera/trap.c | 23 +++++++++++++++++++++-- port/portfns.h | 1 + port/sysfile.c | 7 ++++++- 6 files changed, 36 insertions(+), 10 deletions(-) diff --git a/carrera/fptrap.c b/carrera/fptrap.c index 2b8457ebeafcf67a422adfdf8760baaa7f3dcf25..d41ab97228d0ccd1161d0337087b034c0dab7cff 100644 --- a/carrera/fptrap.c +++ b/carrera/fptrap.c @@ -174,17 +174,19 @@ fpunimp(ulong iw) return 0; } -static uvlong* +static ulong* reg(Ureg *ur, int regno) { /* regs go from R31 down in ureg, R29 is missing */ - if(regno == 31) + switch(regno) { + case 31: return &ur->r31; - if(regno == 30) + case 30: return &ur->r30; - if(regno == 29) + case 29: return &ur->sp; - return (&ur->r28) + (28-regno); + } + return (&ur->r28) + (28-regno)*(&ur->r27-&ur->r28); } static ulong diff --git a/carrera/l.s b/carrera/l.s index 28d6bf92568f8795369cbc64a724ff2256fecd61..7d56a4b510141c2d61355aedeb86a163892f9696 100644 --- a/carrera/l.s +++ b/carrera/l.s @@ -93,7 +93,7 @@ TEXT touser(SB), $-4 MOVW M(STATUS), R4 WAIT AND $(~KMODEMASK), R4 - OR $(KUSER|EXL|IE|UX), R4 + OR $(KUSER|EXL|IE), R4 MOVW R4, M(STATUS) WAIT MOVW R1, SP diff --git a/carrera/mem.h b/carrera/mem.h index e8d57bda03e4530a8b5a9a9e3865458fbfa7a894..b5b062b4c672e6aee21e420720958bcf82206555 100644 --- a/carrera/mem.h +++ b/carrera/mem.h @@ -66,7 +66,6 @@ #define ERL 0x00000004 #define KSUPER 0x00000008 #define KUSER 0x00000010 -#define UX 0x00000020 #define INTMASK 0x0000ff00 #define INTR0 0x00000100 #define INTR1 0x00000200 diff --git a/carrera/trap.c b/carrera/trap.c index b9d20067c6d9089afa216e9521018719914d20f9..ce57dd6a073e1e52bb3c4f7f3411672fff04a3fc 100644 --- a/carrera/trap.c +++ b/carrera/trap.c @@ -283,6 +283,14 @@ trap(Ureg *ur) } } +struct +{ + ulong cause; + ulong devint3; + ulong devint4; + ulong state; +}sisr; + void intr(Ureg *ur) { @@ -292,9 +300,11 @@ intr(Ureg *ur) m->intr++; cause &= INTR7|INTR6|INTR5|INTR4|INTR3|INTR2|INTR1|INTR0; - +sisr.cause = cause; if(cause & INTR3) { devint = IO(uchar, Intcause); +sisr.devint3 = devint; +sisr.state = 0; switch(devint) { default: panic("unknown devint=#%lux", devint); @@ -318,9 +328,11 @@ intr(Ureg *ur) break; } cause &= ~INTR3; +sisr.state = 1; } if(cause & INTR2) { +sisr.state = 2; isr = IO(ulong, R4030Isr); if(isr) { iprint("R4030 Interrupt\n"); @@ -330,12 +342,14 @@ intr(Ureg *ur) iprint(" MFA #%lux\n", IO(ulong, R4030Mfa)); } cause &= ~INTR2; +sisr.state = 3; } if(cause & INTR4) { devint = IO(uchar, I386ack); vec = devint&~0x7; - +sisr.devint4 = devint; +sisr.state = 4; /* reenable the 8259 interrupt */ if(vec == Int0vec || vec == Int1vec){ EISAOUTB(Int0ctl, EOI); @@ -348,13 +362,18 @@ intr(Ureg *ur) iprint("i386ACK #%lux\n", devint); break; case 7: +sisr.state = 5; audiosbintr(); +sisr.state = 6; break; case 13: +sisr.state = 7; audiodmaintr(); +sisr.state = 8; break; } cause &= ~INTR4; +sisr.state = 9; } if(cause & INTR7) { diff --git a/port/portfns.h b/port/portfns.h index f7fca4e44eaec9a5667dcccfae0916696f5c6aac..770e595dd1dbd242f5e7361c20ac0644399f65d0 100644 --- a/port/portfns.h +++ b/port/portfns.h @@ -244,6 +244,7 @@ void uncachepage(Page*); long unionread(Chan*, void*, long); void unlock(Lock*); void unmount(Chan*, Chan*); +Chan* undomount(Chan*); void userinit(void); ulong userpc(void); long userwrite(char*, int); diff --git a/port/sysfile.c b/port/sysfile.c index b0fc1fb44cbc929264c6f861a813454d5da78832..e4bda348c4940892b405e96f207c7a49fce0e98f 100644 --- a/port/sysfile.c +++ b/port/sysfile.c @@ -94,7 +94,12 @@ sysfd2path(ulong *arg) error(Ebadarg); c = fdtochan(arg[0], -1, 0, 0); - + /* If we used open the chan will be at the first element + * of a union rather than the mhead of the union. undomount + * will make it look like we used Atodir rather than Aopen. + */ + if(c->qid.path & CHDIR) + c = undomount(c); ptpath(c->path, (char*)arg[1], arg[2]); return 0; }