From 491995f83b50c0dec38b58f39a931384fc1ca35d Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Sat, 1 Aug 1992 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1992-08-01 --- ss/dat.h | 1 + ss/l.s | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ ss/main.c | 1 + ss/trap.c | 11 +++++++++-- 4 files changed, 59 insertions(+), 2 deletions(-) diff --git a/ss/dat.h b/ss/dat.h index 8d5d9f94897747dee07bb12fc1c979c46c08f3de..023e9ff6fa4b7b1d8b420231fd59df20de8ca043 100644 --- a/ss/dat.h +++ b/ss/dat.h @@ -64,6 +64,7 @@ struct Conf { int nmach; /* processors */ int nproc; /* processes */ + int ss2; /* is a sparcstation 2 */ ulong npage0; /* total physical pages of memory, bank 0 */ ulong npage1; /* total physical pages of memory, bank 1 */ ulong base0; /* base of bank 0 */ diff --git a/ss/l.s b/ss/l.s index 36e696ebd3fd16a8134954bf54938dad7dac8a6c..38df7d1130be433af0db3f8e260120a0093846da 100644 --- a/ss/l.s +++ b/ss/l.s @@ -367,6 +367,18 @@ TEXT putw4(SB), $0 MOVW R8, (R7, 4) RETURN +TEXT putw6(SB), $0 + + MOVW 4(FP), R8 + MOVW R8, (R7, 6) + RETURN + +TEXT putw8(SB), $0 + + MOVW 4(FP), R8 + MOVW R8, (R7, 8) + RETURN + TEXT getw4(SB), $0 MOVW (R7, 4), R7 @@ -384,6 +396,42 @@ TEXT putwD(SB), $0 MOVW R8, (R7, 0xD) RETURN +TEXT putw716(SB), $0 + + MOVW 4(FP), R8 + MOVW R8, (R7, 0x7) + ADD $BY2PG, R7 + MOVW R8, (R7, 0x7) + ADD $BY2PG, R7 + MOVW R8, (R7, 0x7) + ADD $BY2PG, R7 + MOVW R8, (R7, 0x7) + ADD $BY2PG, R7 + MOVW R8, (R7, 0x7) + ADD $BY2PG, R7 + MOVW R8, (R7, 0x7) + ADD $BY2PG, R7 + MOVW R8, (R7, 0x7) + ADD $BY2PG, R7 + MOVW R8, (R7, 0x7) + ADD $BY2PG, R7 + MOVW R8, (R7, 0x7) + ADD $BY2PG, R7 + MOVW R8, (R7, 0x7) + ADD $BY2PG, R7 + MOVW R8, (R7, 0x7) + ADD $BY2PG, R7 + MOVW R8, (R7, 0x7) + ADD $BY2PG, R7 + MOVW R8, (R7, 0x7) + ADD $BY2PG, R7 + MOVW R8, (R7, 0x7) + ADD $BY2PG, R7 + MOVW R8, (R7, 0x7) + ADD $BY2PG, R7 + MOVW R8, (R7, 0x7) + RETURN + TEXT putwD16(SB), $0 MOVW 4(FP), R8 diff --git a/ss/main.c b/ss/main.c index c1881f40d5a13b973cd910f090e10c093c22325e..c52f37c14ba94c3afa21fbc10d1477f3dd104f90 100644 --- a/ss/main.c +++ b/ss/main.c @@ -205,6 +205,7 @@ confinit(void) if(conf.nmach > MAXMACH) panic("confinit"); + conf.ss2 = 0; conf.npage0 = (4*1024*1024)/BY2PG; /* BUG */ conf.npage1 = (4*1024*1024)/BY2PG; /* BUG */ conf.base0 = 0; diff --git a/ss/trap.c b/ss/trap.c index 7dcac7818a1f537921d7fb4b0134e07e65f019a0..6810ee49b679806f82989bbf6f91f48eb5483480 100644 --- a/ss/trap.c +++ b/ss/trap.c @@ -132,6 +132,9 @@ trap(Ureg *ur) user = !(ur->psr&PSRPSUPER); tbr = (ur->tbr&0xFFF)>>4; + /* SS2 bug: flush cache line holding trap entry in table */ + if(conf.ss2) + putw2(CACHETAGS+((TRAPS+16*tbr)&(VACSIZE-1)), 0); if(tbr > 16){ /* interrupt */ if(u && u->p->state==Running){ if(u->p->fpstate == FPactive){ @@ -237,7 +240,8 @@ trapinit(void) a += 0x40000000; /* CALL traplink(SB) */ t = TRAPS; for(i=0; i<256; i++){ - *(ulong*)t = a; /* CALL traplink(SB) */ + /* ss2: must flush cache line for table */ + *(ulong*)(t+0) = a; /* CALL traplink(SB) */ *(ulong*)(t+4) = 0xa7480000; /* MOVW PSR, R19 */ a -= 16/4; t += 16; @@ -250,7 +254,6 @@ trapinit(void) a += 0x40000000; *(ulong*)t = a; /* CALL syscall(SB) */ *(ulong*)(t+4) = 0xa7480000; /* MOVW PSR, R19 */ - puttbr(TRAPS); } @@ -534,6 +537,10 @@ syscall(Ureg *aur) u->p->insyscall = 1; u->p->pc = ur->pc; + /* SS2 bug: flush cache line holding trap entry in table */ + if(conf.ss2) + putw2(CACHETAGS+((TRAPS+16*128)&(VACSIZE-1)), 0); + /* * since the system call interface does not * guarantee anything about registers,