From: briggs Date: Sun, 30 Mar 1997 21:53:23 +0000 (+0000) Subject: An implementation of pieces of the Deferred Task Manager--required by X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=2459feb25ed6b6218bc9bc9e900aa16fae3762e9;p=openbsd An implementation of pieces of the Deferred Task Manager--required by some video cards. Provided by Paul Goyette . This introduces another simulated software interrupt. --- diff --git a/sys/arch/mac68k/include/cpu.h b/sys/arch/mac68k/include/cpu.h index e90f92203d9..43546893109 100644 --- a/sys/arch/mac68k/include/cpu.h +++ b/sys/arch/mac68k/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.15 1997/03/12 13:29:39 briggs Exp $ */ +/* $OpenBSD: cpu.h,v 1.16 1997/03/30 21:53:23 briggs Exp $ */ /* $NetBSD: cpu.h,v 1.45 1997/02/10 22:13:40 scottr Exp $ */ /* @@ -141,14 +141,19 @@ extern volatile u_int8_t ssir; #define SIR_CLOCK 0x02 #define SIR_SERIAL 0x04 +/* Mac-specific SSIR(s) */ +#define SIR_DTMGR 0x80 + #define siroff(mask) \ - __asm __volatile ( "andb %0,_ssir" : : "ir" (~(mask))); + __asm __volatile ( "andb %0,_ssir" : : "ir" (~(mask) & 0xff)); #define setsoftnet() \ __asm __volatile ( "orb %0,_ssir" : : "i" (SIR_NET)) #define setsoftclock() \ __asm __volatile ( "orb %0,_ssir" : : "i" (SIR_CLOCK)) #define setsoftserial() \ __asm __volatile ( "orb %0,_ssir" : : "i" (SIR_SERIAL)) +#define setsoftdtmgr() \ + __asm __volatile ( "orb %0,_ssir" : : "i" (SIR_DTMGR)) #define CPU_CONSDEV 1 #define CPU_MAXID 2 diff --git a/sys/arch/mac68k/mac68k/macrom.c b/sys/arch/mac68k/mac68k/macrom.c index 51e055be4b2..2b8469828f1 100644 --- a/sys/arch/mac68k/mac68k/macrom.c +++ b/sys/arch/mac68k/mac68k/macrom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: macrom.c,v 1.10 1997/03/08 16:17:05 briggs Exp $ */ +/* $OpenBSD: macrom.c,v 1.11 1997/03/30 21:53:25 briggs Exp $ */ /* $NetBSD: macrom.c,v 1.31 1997/03/01 17:20:34 scottr Exp $ */ /*- @@ -121,7 +121,8 @@ caddr_t ResHndls[]={0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; #endif void setup_egret __P((void)); - +void mrg_execute_deferred __P((void)); +void mrg_DTInstall __P((void)); /* * Last straw functions; we didn't set them up, so freak out! @@ -151,6 +152,48 @@ mrg_Delay() * of ticks */ } +/* + * Handle the Deferred Task manager here + */ +static caddr_t mrg_DTList = NULL; + +void +mrg_DTInstall(void) +{ + caddr_t ptr, prev; + + __asm(" movl a0, %0" : "=g" (ptr) ); + + (caddr_t *)prev = &mrg_DTList; + while (*prev != NULL) + prev = *(caddr_t *)prev; + *(caddr_t *)ptr = NULL; + *(caddr_t *)prev = ptr; + setsoftdtmgr(); + + __asm(" clrl d0" : : : "d0"); +} + +void +mrg_execute_deferred(void) +{ + caddr_t ptr; + int s; + + while (mrg_DTList != NULL) { + s = splhigh(); + ptr = *(caddr_t *)mrg_DTList; + mrg_DTList = *(caddr_t *)ptr; + splx(s); + + __asm(" moveml a0-a6/d1-d7,sp@- + movl %0, a0 + movl a0@(8), a2 + movl a0@(12), a1 + jsr a2@ + moveml sp@+,a0-a6/d1-d7" : : "g" (ptr) ); + } +} void mrg_VBLQueue() @@ -581,6 +624,7 @@ caddr_t mrg_OStraps[256] = { [0x3b] (caddr_t)mrg_Delay, [0x47] (caddr_t)mrg_SetTrapAddress, [0x55] (caddr_t)mrg_StripAddress, + [0x82] (caddr_t)mrg_DTInstall, #else #error "Using a GNU C extension." #endif @@ -909,6 +953,8 @@ mrg_init() mrg_VIA2 = (caddr_t)(Via1Base + VIA2 * 0x2000); /* see via.h */ SCCRd = (caddr_t)(IOBase + sccA); /* ser.c ; we run before serinit */ + jDTInstall = (caddr_t) mrg_DTInstall; + /* AV ROMs want this low memory vector to point to a jump table */ InitEgretJTVec = (u_int32_t **)&mrg_AVInitEgretJT; diff --git a/sys/arch/mac68k/mac68k/macrom.h b/sys/arch/mac68k/mac68k/macrom.h index 9bce888e5bf..79ee820fee9 100644 --- a/sys/arch/mac68k/mac68k/macrom.h +++ b/sys/arch/mac68k/mac68k/macrom.h @@ -1,4 +1,4 @@ -/* $OpenBSD: macrom.h,v 1.5 1997/02/23 06:05:02 briggs Exp $ */ +/* $OpenBSD: macrom.h,v 1.6 1997/03/30 21:53:26 briggs Exp $ */ /* $NetBSD: macrom.h,v 1.9 1996/05/25 14:45:35 briggs Exp $ */ /*- @@ -78,6 +78,8 @@ extern caddr_t ExpandMem; /* pointer to Expanded Memory used by */ extern u_int16_t VBLQueue; /* Vertical blanking Queue, unused ? */ extern caddr_t VBLQueue_head; /* Vertical blanking Queue, head */ extern caddr_t VBLQueue_tail; /* Vertical blanking Queue, tail */ +extern caddr_t jDTInstall; /* short-cut to deferred task mgr */ + /* trap handler */ extern u_int32_t **InitEgretJTVec; /* pointer to a jump table for */ /* InitEgret on AV machines */ diff --git a/sys/arch/mac68k/mac68k/macromasm.s b/sys/arch/mac68k/mac68k/macromasm.s index 92595bcd78c..85da58c6cbd 100644 --- a/sys/arch/mac68k/mac68k/macromasm.s +++ b/sys/arch/mac68k/mac68k/macromasm.s @@ -1,4 +1,4 @@ -/* $OpenBSD: macromasm.s,v 1.4 1997/02/23 06:05:03 briggs Exp $ */ +/* $OpenBSD: macromasm.s,v 1.5 1997/03/30 21:53:27 briggs Exp $ */ /* $NetBSD: macromasm.s,v 1.11 1996/05/25 14:45:37 briggs Exp $ */ /*- @@ -104,6 +104,8 @@ loglob(VBLQueue, 0x160) /* Vertical blanking Queue, unused ? */ loglob(VBLQueue_head, 0x162) /* Vertical blanking Queue, head */ loglob(VBLQueue_tail, 0x166) /* Vertical blanking Queue, tail */ + loglob(jDTInstall, 0x9dc) /* short-cut to deferred task mgr */ + /* trap handler */ loglob(InitEgretJTVec, 0x2010) /* pointer to a jump table for */ /* InitEgret on AV machines */ diff --git a/sys/arch/mac68k/mac68k/trap.c b/sys/arch/mac68k/mac68k/trap.c index cfd20ddfa4b..cf916f70ee2 100644 --- a/sys/arch/mac68k/mac68k/trap.c +++ b/sys/arch/mac68k/mac68k/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.8 1997/02/21 05:49:30 briggs Exp $ */ +/* $OpenBSD: trap.c,v 1.9 1997/03/30 21:53:27 briggs Exp $ */ /* $NetBSD: trap.c,v 1.45 1997/01/20 04:30:05 scottr Exp $ */ /* @@ -511,6 +511,12 @@ copyfault: cnt.v_soft++; softclock(); } + if (ssir & SIR_DTMGR) { + void mrg_execute_deferred __P((void)); + siroff(SIR_DTMGR); + cnt.v_soft++; + mrg_execute_deferred(); + } /* * If this was not an AST trap, we are all done. */