1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-14 10:09:48 +00:00

Implemented dynamic registration of software interrupt handlers. Not

used yet.

Use dummy SWI handlers to avoid some checks for null pointers.
This commit is contained in:
Bruce Evans 1998-08-11 15:08:13 +00:00
parent a1eff3a036
commit 18c5a6c435
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=38244
17 changed files with 197 additions and 117 deletions

View File

@ -1,6 +1,6 @@
/* /*
* from: vector.s, 386BSD 0.1 unknown origin * from: vector.s, 386BSD 0.1 unknown origin
* $Id: apic_vector.s,v 1.29 1998/04/22 22:49:27 tegge Exp $ * $Id: apic_vector.s,v 1.30 1998/05/17 22:12:04 tegge Exp $
*/ */
@ -923,7 +923,6 @@ MCOUNT_LABEL(eintr)
*/ */
.globl _ihandlers .globl _ihandlers
_ihandlers: _ihandlers:
ihandlers:
/* /*
* used by: * used by:
* ipl.s: doreti_unpend * ipl.s: doreti_unpend
@ -939,18 +938,14 @@ ihandlers:
* ipl.s: doreti_unpend * ipl.s: doreti_unpend
* apic_ipl.s: splz_unpend * apic_ipl.s: splz_unpend
*/ */
.long swi_tty, swi_net .long swi_tty, swi_net, dummycamisr, dummycamisr
.long dummycamisr, dummycamisr .long _swi_vm, _swi_null, _softclock, swi_ast
.long _swi_vm, 0
.long _softclock, swi_ast
imasks: /* masks for interrupt handlers */ imasks: /* masks for interrupt handlers */
.space NHWI*4 /* padding; HWI masks are elsewhere */ .space NHWI*4 /* padding; HWI masks are elsewhere */
.long SWI_TTY_MASK, SWI_NET_MASK .long SWI_TTY_MASK, SWI_NET_MASK, SWI_CAMNET_MASK, SWI_CAMBIO_MASK
.long SWI_CAMNET_MASK, SWI_CAMBIO_MASK .long SWI_VM_MASK, 0, SWI_CLOCK_MASK, SWI_AST_MASK
.long SWI_VM_MASK, 0
.long SWI_CLOCK_MASK, SWI_AST_MASK
/* active flag for lazy masking */ /* active flag for lazy masking */
iactive: iactive:

View File

@ -1,6 +1,6 @@
/* /*
* from: vector.s, 386BSD 0.1 unknown origin * from: vector.s, 386BSD 0.1 unknown origin
* $Id: icu_vector.s,v 1.6 1997/09/28 19:30:01 gibbs Exp $ * $Id: icu_vector.s,v 1.7 1998/01/15 07:33:59 gibbs Exp $
*/ */
/* /*
@ -195,17 +195,16 @@ MCOUNT_LABEL(eintr)
.data .data
.globl _ihandlers .globl _ihandlers
_ihandlers: _ihandlers: /* addresses of interrupt handlers */
ihandlers: /* addresses of interrupt handlers */
/* actually resumption addresses for HWI's */ /* actually resumption addresses for HWI's */
.long Xresume0, Xresume1, Xresume2, Xresume3 .long Xresume0, Xresume1, Xresume2, Xresume3
.long Xresume4, Xresume5, Xresume6, Xresume7 .long Xresume4, Xresume5, Xresume6, Xresume7
.long Xresume8, Xresume9, Xresume10, Xresume11 .long Xresume8, Xresume9, Xresume10, Xresume11
.long Xresume12, Xresume13, Xresume14, Xresume15 .long Xresume12, Xresume13, Xresume14, Xresume15
.long swi_tty, swi_net, dummycamisr, dummycamisr .long swi_tty, swi_net, dummycamisr, dummycamisr
.long _swi_vm, 0, 0, 0 .long _swi_vm, _swi_null, _swi_null, _swi_null
.long 0, 0, 0, 0 .long _swi_null, _swi_null, _swi_null, _swi_null
.long 0, 0, _softclock, swi_ast .long _swi_null, _swi_null, _softclock, swi_ast
imasks: /* masks for interrupt handlers */ imasks: /* masks for interrupt handlers */
.space NHWI*4 /* padding; HWI masks are elsewhere */ .space NHWI*4 /* padding; HWI masks are elsewhere */

View File

@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: icu_ipl.s,v 1.2 1997/08/24 00:05:13 fsmp Exp $ * $Id: icu_ipl.s,v 1.3 1997/09/02 19:40:13 fsmp Exp $
*/ */
.data .data
@ -90,9 +90,6 @@ splz_unpend:
bsfl %ecx,%ecx bsfl %ecx,%ecx
btrl %ecx,_ipending btrl %ecx,_ipending
jnc splz_next jnc splz_next
movl ihandlers(,%ecx,4),%edx
testl %edx,%edx
je splz_next /* "can't happen" */
cmpl $NHWI,%ecx cmpl $NHWI,%ecx
jae splz_swi jae splz_swi
/* /*
@ -111,7 +108,7 @@ splz_swi:
pushl %eax pushl %eax
orl imasks(,%ecx,4),%eax orl imasks(,%ecx,4),%eax
movl %eax,_cpl movl %eax,_cpl
call %edx call *_ihandlers(,%ecx,4)
popl %eax popl %eax
movl %eax,_cpl movl %eax,_cpl
jmp splz_next jmp splz_next

View File

@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: icu_ipl.s,v 1.2 1997/08/24 00:05:13 fsmp Exp $ * $Id: icu_ipl.s,v 1.3 1997/09/02 19:40:13 fsmp Exp $
*/ */
.data .data
@ -90,9 +90,6 @@ splz_unpend:
bsfl %ecx,%ecx bsfl %ecx,%ecx
btrl %ecx,_ipending btrl %ecx,_ipending
jnc splz_next jnc splz_next
movl ihandlers(,%ecx,4),%edx
testl %edx,%edx
je splz_next /* "can't happen" */
cmpl $NHWI,%ecx cmpl $NHWI,%ecx
jae splz_swi jae splz_swi
/* /*
@ -111,7 +108,7 @@ splz_swi:
pushl %eax pushl %eax
orl imasks(,%ecx,4),%eax orl imasks(,%ecx,4),%eax
movl %eax,_cpl movl %eax,_cpl
call %edx call *_ihandlers(,%ecx,4)
popl %eax popl %eax
movl %eax,_cpl movl %eax,_cpl
jmp splz_next jmp splz_next

View File

@ -1,6 +1,6 @@
/* /*
* from: vector.s, 386BSD 0.1 unknown origin * from: vector.s, 386BSD 0.1 unknown origin
* $Id: icu_vector.s,v 1.6 1997/09/28 19:30:01 gibbs Exp $ * $Id: icu_vector.s,v 1.7 1998/01/15 07:33:59 gibbs Exp $
*/ */
/* /*
@ -195,17 +195,16 @@ MCOUNT_LABEL(eintr)
.data .data
.globl _ihandlers .globl _ihandlers
_ihandlers: _ihandlers: /* addresses of interrupt handlers */
ihandlers: /* addresses of interrupt handlers */
/* actually resumption addresses for HWI's */ /* actually resumption addresses for HWI's */
.long Xresume0, Xresume1, Xresume2, Xresume3 .long Xresume0, Xresume1, Xresume2, Xresume3
.long Xresume4, Xresume5, Xresume6, Xresume7 .long Xresume4, Xresume5, Xresume6, Xresume7
.long Xresume8, Xresume9, Xresume10, Xresume11 .long Xresume8, Xresume9, Xresume10, Xresume11
.long Xresume12, Xresume13, Xresume14, Xresume15 .long Xresume12, Xresume13, Xresume14, Xresume15
.long swi_tty, swi_net, dummycamisr, dummycamisr .long swi_tty, swi_net, dummycamisr, dummycamisr
.long _swi_vm, 0, 0, 0 .long _swi_vm, _swi_null, _swi_null, _swi_null
.long 0, 0, 0, 0 .long _swi_null, _swi_null, _swi_null, _swi_null
.long 0, 0, _softclock, swi_ast .long _swi_null, _swi_null, _softclock, swi_ast
imasks: /* masks for interrupt handlers */ imasks: /* masks for interrupt handlers */
.space NHWI*4 /* padding; HWI masks are elsewhere */ .space NHWI*4 /* padding; HWI masks are elsewhere */

View File

@ -1,6 +1,6 @@
/* /*
* from: vector.s, 386BSD 0.1 unknown origin * from: vector.s, 386BSD 0.1 unknown origin
* $Id: icu_vector.s,v 1.6 1997/09/28 19:30:01 gibbs Exp $ * $Id: icu_vector.s,v 1.7 1998/01/15 07:33:59 gibbs Exp $
*/ */
/* /*
@ -195,17 +195,16 @@ MCOUNT_LABEL(eintr)
.data .data
.globl _ihandlers .globl _ihandlers
_ihandlers: _ihandlers: /* addresses of interrupt handlers */
ihandlers: /* addresses of interrupt handlers */
/* actually resumption addresses for HWI's */ /* actually resumption addresses for HWI's */
.long Xresume0, Xresume1, Xresume2, Xresume3 .long Xresume0, Xresume1, Xresume2, Xresume3
.long Xresume4, Xresume5, Xresume6, Xresume7 .long Xresume4, Xresume5, Xresume6, Xresume7
.long Xresume8, Xresume9, Xresume10, Xresume11 .long Xresume8, Xresume9, Xresume10, Xresume11
.long Xresume12, Xresume13, Xresume14, Xresume15 .long Xresume12, Xresume13, Xresume14, Xresume15
.long swi_tty, swi_net, dummycamisr, dummycamisr .long swi_tty, swi_net, dummycamisr, dummycamisr
.long _swi_vm, 0, 0, 0 .long _swi_vm, _swi_null, _swi_null, _swi_null
.long 0, 0, 0, 0 .long _swi_null, _swi_null, _swi_null, _swi_null
.long 0, 0, _softclock, swi_ast .long _swi_null, _swi_null, _softclock, swi_ast
imasks: /* masks for interrupt handlers */ imasks: /* masks for interrupt handlers */
.space NHWI*4 /* padding; HWI masks are elsewhere */ .space NHWI*4 /* padding; HWI masks are elsewhere */

View File

@ -1,6 +1,6 @@
/* /*
* from: vector.s, 386BSD 0.1 unknown origin * from: vector.s, 386BSD 0.1 unknown origin
* $Id: apic_vector.s,v 1.29 1998/04/22 22:49:27 tegge Exp $ * $Id: apic_vector.s,v 1.30 1998/05/17 22:12:04 tegge Exp $
*/ */
@ -923,7 +923,6 @@ MCOUNT_LABEL(eintr)
*/ */
.globl _ihandlers .globl _ihandlers
_ihandlers: _ihandlers:
ihandlers:
/* /*
* used by: * used by:
* ipl.s: doreti_unpend * ipl.s: doreti_unpend
@ -939,18 +938,14 @@ ihandlers:
* ipl.s: doreti_unpend * ipl.s: doreti_unpend
* apic_ipl.s: splz_unpend * apic_ipl.s: splz_unpend
*/ */
.long swi_tty, swi_net .long swi_tty, swi_net, dummycamisr, dummycamisr
.long dummycamisr, dummycamisr .long _swi_vm, _swi_null, _softclock, swi_ast
.long _swi_vm, 0
.long _softclock, swi_ast
imasks: /* masks for interrupt handlers */ imasks: /* masks for interrupt handlers */
.space NHWI*4 /* padding; HWI masks are elsewhere */ .space NHWI*4 /* padding; HWI masks are elsewhere */
.long SWI_TTY_MASK, SWI_NET_MASK .long SWI_TTY_MASK, SWI_NET_MASK, SWI_CAMNET_MASK, SWI_CAMBIO_MASK
.long SWI_CAMNET_MASK, SWI_CAMBIO_MASK .long SWI_VM_MASK, 0, SWI_CLOCK_MASK, SWI_AST_MASK
.long SWI_VM_MASK, 0
.long SWI_CLOCK_MASK, SWI_AST_MASK
/* active flag for lazy masking */ /* active flag for lazy masking */
iactive: iactive:

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: asnames.h,v 1.21 1998/05/17 11:52:06 phk Exp $ * $Id: asnames.h,v 1.22 1998/05/17 18:53:08 tegge Exp $
*/ */
#ifndef _MACHINE_ASNAMES_H_ #ifndef _MACHINE_ASNAMES_H_
@ -245,6 +245,7 @@
#define _get_syscall_lock get_syscall_lock #define _get_syscall_lock get_syscall_lock
#define _getmicrouptime getmicrouptime #define _getmicrouptime getmicrouptime
#define _idqs idqs #define _idqs idqs
#define _ihandlers ihandlers
#define _imen imen #define _imen imen
#define _imen_lock imen_lock #define _imen_lock imen_lock
#define _in_vm86call in_vm86call #define _in_vm86call in_vm86call
@ -343,6 +344,8 @@
#define _ss_unlock ss_unlock #define _ss_unlock ss_unlock
#define _started_cpus started_cpus #define _started_cpus started_cpus
#define _stopped_cpus stopped_cpus #define _stopped_cpus stopped_cpus
#define _swi_generic swi_generic
#define _swi_null swi_null
#define _swi_vm swi_vm #define _swi_vm swi_vm
#define _syscall syscall #define _syscall syscall
#define _szsigcode szsigcode #define _szsigcode szsigcode

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: ipl.h,v 1.12 1997/09/21 21:38:53 gibbs Exp $ * $Id: ipl.h,v 1.13 1998/01/15 07:32:56 gibbs Exp $
*/ */
#ifndef _MACHINE_IPL_H_ #ifndef _MACHINE_IPL_H_
@ -56,6 +56,7 @@
#define SWI_VM (NHWI + 4) #define SWI_VM (NHWI + 4)
#define SWI_CLOCK 30 #define SWI_CLOCK 30
#define SWI_AST 31 #define SWI_AST 31
#define NSWI (32 - NHWI)
/* /*
* Corresponding interrupt-pending bits for ipending. * Corresponding interrupt-pending bits for ipending.

View File

@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: apic_ipl.s,v 1.19 1998/03/05 21:45:50 tegge Exp $ * $Id: apic_ipl.s,v 1.20 1998/04/22 22:49:29 tegge Exp $
*/ */
@ -116,21 +116,10 @@ splz_next:
ALIGN_TEXT ALIGN_TEXT
splz_unpend: splz_unpend:
bsfl %ecx,%ecx bsfl %ecx,%ecx
btrl %ecx, _ipending btrl %ecx,_ipending
jnc splz_next jnc splz_next
/*
* HWIs: will JUMP thru *_vec[], see comments below.
* SWIs: setup CALL of swi_tty, swi_net, _softclock, swi_ast.
*/
movl ihandlers(,%ecx,4),%edx
testl %edx,%edx
je splz_next /* "can't happen" */
cmpl $NHWI,%ecx cmpl $NHWI,%ecx
jae splz_swi jae splz_swi
pushl %ecx
AICPL_UNLOCK
popl %ecx
/* /*
* We would prefer to call the intr handler directly here but that * We would prefer to call the intr handler directly here but that
* doesn't work for badly behaved handlers that want the interrupt * doesn't work for badly behaved handlers that want the interrupt
@ -141,6 +130,9 @@ splz_unpend:
* The vec[] routines build the proper frame on the stack, * The vec[] routines build the proper frame on the stack,
* then call one of _Xintr0 thru _XintrNN. * then call one of _Xintr0 thru _XintrNN.
*/ */
pushl %ecx
AICPL_UNLOCK
popl %ecx
jmp *_vec(,%ecx,4) jmp *_vec(,%ecx,4)
ALIGN_TEXT ALIGN_TEXT
@ -150,10 +142,10 @@ splz_swi:
pushl %eax pushl %eax
orl imasks(,%ecx,4),%eax orl imasks(,%ecx,4),%eax
movl %eax,_cpl movl %eax,_cpl
pushl %edx pushl %ecx
AICPL_UNLOCK AICPL_UNLOCK
popl %edx popl %ecx
call %edx call *_ihandlers(,%ecx,4)
AICPL_LOCK AICPL_LOCK
popl %eax popl %eax
movl %eax,_cpl movl %eax,_cpl

View File

@ -1,6 +1,6 @@
/* /*
* from: vector.s, 386BSD 0.1 unknown origin * from: vector.s, 386BSD 0.1 unknown origin
* $Id: apic_vector.s,v 1.29 1998/04/22 22:49:27 tegge Exp $ * $Id: apic_vector.s,v 1.30 1998/05/17 22:12:04 tegge Exp $
*/ */
@ -923,7 +923,6 @@ MCOUNT_LABEL(eintr)
*/ */
.globl _ihandlers .globl _ihandlers
_ihandlers: _ihandlers:
ihandlers:
/* /*
* used by: * used by:
* ipl.s: doreti_unpend * ipl.s: doreti_unpend
@ -939,18 +938,14 @@ ihandlers:
* ipl.s: doreti_unpend * ipl.s: doreti_unpend
* apic_ipl.s: splz_unpend * apic_ipl.s: splz_unpend
*/ */
.long swi_tty, swi_net .long swi_tty, swi_net, dummycamisr, dummycamisr
.long dummycamisr, dummycamisr .long _swi_vm, _swi_null, _softclock, swi_ast
.long _swi_vm, 0
.long _softclock, swi_ast
imasks: /* masks for interrupt handlers */ imasks: /* masks for interrupt handlers */
.space NHWI*4 /* padding; HWI masks are elsewhere */ .space NHWI*4 /* padding; HWI masks are elsewhere */
.long SWI_TTY_MASK, SWI_NET_MASK .long SWI_TTY_MASK, SWI_NET_MASK, SWI_CAMNET_MASK, SWI_CAMBIO_MASK
.long SWI_CAMNET_MASK, SWI_CAMBIO_MASK .long SWI_VM_MASK, 0, SWI_CLOCK_MASK, SWI_AST_MASK
.long SWI_VM_MASK, 0
.long SWI_CLOCK_MASK, SWI_AST_MASK
/* active flag for lazy masking */ /* active flag for lazy masking */
iactive: iactive:

View File

@ -1,6 +1,6 @@
/* /*
* from: vector.s, 386BSD 0.1 unknown origin * from: vector.s, 386BSD 0.1 unknown origin
* $Id: icu_vector.s,v 1.6 1997/09/28 19:30:01 gibbs Exp $ * $Id: icu_vector.s,v 1.7 1998/01/15 07:33:59 gibbs Exp $
*/ */
/* /*
@ -195,17 +195,16 @@ MCOUNT_LABEL(eintr)
.data .data
.globl _ihandlers .globl _ihandlers
_ihandlers: _ihandlers: /* addresses of interrupt handlers */
ihandlers: /* addresses of interrupt handlers */
/* actually resumption addresses for HWI's */ /* actually resumption addresses for HWI's */
.long Xresume0, Xresume1, Xresume2, Xresume3 .long Xresume0, Xresume1, Xresume2, Xresume3
.long Xresume4, Xresume5, Xresume6, Xresume7 .long Xresume4, Xresume5, Xresume6, Xresume7
.long Xresume8, Xresume9, Xresume10, Xresume11 .long Xresume8, Xresume9, Xresume10, Xresume11
.long Xresume12, Xresume13, Xresume14, Xresume15 .long Xresume12, Xresume13, Xresume14, Xresume15
.long swi_tty, swi_net, dummycamisr, dummycamisr .long swi_tty, swi_net, dummycamisr, dummycamisr
.long _swi_vm, 0, 0, 0 .long _swi_vm, _swi_null, _swi_null, _swi_null
.long 0, 0, 0, 0 .long _swi_null, _swi_null, _swi_null, _swi_null
.long 0, 0, _softclock, swi_ast .long _swi_null, _swi_null, _softclock, swi_ast
imasks: /* masks for interrupt handlers */ imasks: /* masks for interrupt handlers */
.space NHWI*4 /* padding; HWI masks are elsewhere */ .space NHWI*4 /* padding; HWI masks are elsewhere */

View File

@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: icu_ipl.s,v 1.2 1997/08/24 00:05:13 fsmp Exp $ * $Id: icu_ipl.s,v 1.3 1997/09/02 19:40:13 fsmp Exp $
*/ */
.data .data
@ -90,9 +90,6 @@ splz_unpend:
bsfl %ecx,%ecx bsfl %ecx,%ecx
btrl %ecx,_ipending btrl %ecx,_ipending
jnc splz_next jnc splz_next
movl ihandlers(,%ecx,4),%edx
testl %edx,%edx
je splz_next /* "can't happen" */
cmpl $NHWI,%ecx cmpl $NHWI,%ecx
jae splz_swi jae splz_swi
/* /*
@ -111,7 +108,7 @@ splz_swi:
pushl %eax pushl %eax
orl imasks(,%ecx,4),%eax orl imasks(,%ecx,4),%eax
movl %eax,_cpl movl %eax,_cpl
call %edx call *_ihandlers(,%ecx,4)
popl %eax popl %eax
movl %eax,_cpl movl %eax,_cpl
jmp splz_next jmp splz_next

View File

@ -1,6 +1,6 @@
/* /*
* from: vector.s, 386BSD 0.1 unknown origin * from: vector.s, 386BSD 0.1 unknown origin
* $Id: icu_vector.s,v 1.6 1997/09/28 19:30:01 gibbs Exp $ * $Id: icu_vector.s,v 1.7 1998/01/15 07:33:59 gibbs Exp $
*/ */
/* /*
@ -195,17 +195,16 @@ MCOUNT_LABEL(eintr)
.data .data
.globl _ihandlers .globl _ihandlers
_ihandlers: _ihandlers: /* addresses of interrupt handlers */
ihandlers: /* addresses of interrupt handlers */
/* actually resumption addresses for HWI's */ /* actually resumption addresses for HWI's */
.long Xresume0, Xresume1, Xresume2, Xresume3 .long Xresume0, Xresume1, Xresume2, Xresume3
.long Xresume4, Xresume5, Xresume6, Xresume7 .long Xresume4, Xresume5, Xresume6, Xresume7
.long Xresume8, Xresume9, Xresume10, Xresume11 .long Xresume8, Xresume9, Xresume10, Xresume11
.long Xresume12, Xresume13, Xresume14, Xresume15 .long Xresume12, Xresume13, Xresume14, Xresume15
.long swi_tty, swi_net, dummycamisr, dummycamisr .long swi_tty, swi_net, dummycamisr, dummycamisr
.long _swi_vm, 0, 0, 0 .long _swi_vm, _swi_null, _swi_null, _swi_null
.long 0, 0, 0, 0 .long _swi_null, _swi_null, _swi_null, _swi_null
.long 0, 0, _softclock, swi_ast .long _swi_null, _swi_null, _softclock, swi_ast
imasks: /* masks for interrupt handlers */ imasks: /* masks for interrupt handlers */
.space NHWI*4 /* padding; HWI masks are elsewhere */ .space NHWI*4 /* padding; HWI masks are elsewhere */

View File

@ -36,7 +36,7 @@
* *
* @(#)ipl.s * @(#)ipl.s
* *
* $Id: ipl.s,v 1.21 1998/03/23 19:52:59 jlemon Exp $ * $Id: ipl.s,v 1.22 1998/07/27 16:51:33 jlemon Exp $
*/ */
@ -247,21 +247,12 @@ doreti_unpend:
#endif /* SMP */ #endif /* SMP */
/* /*
* Setup JUMP to _Xresume0 thru _Xresume23 for HWIs, * Set up JUMP to _ihandlers[%ecx] for HWIs.
* or * Set up CALL of _ihandlers[%ecx] for SWIs.
* Setup CALL of swi_tty, swi_net, _softclock, swi_ast for SWIs. * This is a bit early for the SMP case - we have to push %ecx and
* %edx, but could push only %ecx and load %edx later.
*/ */
movl ihandlers(,%ecx,4),%edx movl _ihandlers(,%ecx,4),%edx
testl %edx,%edx
#if 0
/* XXX SMP this would leave cil set: */
je doreti_next /* "can't happen" */
#else
jne 1f
int $3 /* _breakpoint */
jmp doreti_next /* "can't happen" */
1:
#endif
cmpl $NHWI,%ecx cmpl $NHWI,%ecx
jae doreti_swi jae doreti_swi
cli cli
@ -323,6 +314,7 @@ doreti_swi:
*/ */
#ifdef SMP #ifdef SMP
orl imasks(,%ecx,4), %eax orl imasks(,%ecx,4), %eax
pushl %ecx /* preserve for use by _swi_generic */
pushl %edx /* save handler entry point */ pushl %edx /* save handler entry point */
cli /* prevent INT deadlock */ cli /* prevent INT deadlock */
pushl %eax /* save cpl|cml */ pushl %eax /* save cpl|cml */
@ -335,6 +327,7 @@ doreti_swi:
FAST_ICPL_UNLOCK FAST_ICPL_UNLOCK
sti sti
popl %edx /* restore handler entry point */ popl %edx /* restore handler entry point */
popl %ecx
#else #else
orl imasks(,%ecx,4),%eax orl imasks(,%ecx,4),%eax
movl %eax,_cpl movl %eax,_cpl
@ -418,8 +411,8 @@ dummycamisr:
ret ret
/* /*
* XXX there should be a registration function to put the handler for the * This function will go away soon when register_swi() is used to register
* attached driver directly in ihandlers. Then this function will go away. * the poll functions.
*/ */
ALIGN_TEXT ALIGN_TEXT
swi_tty: swi_tty:
@ -439,6 +432,22 @@ swi_tty:
ret ret
#endif #endif
/*
* The arg is in a nonstandard place, so swi_dispatcher() can't be called
* directly and swi_generic() can't use ENTRY() or MCOUNT.
*/
ALIGN_TEXT
.globl _swi_generic
_swi_generic:
pushl %ecx
FAKE_MCOUNT(4(%esp))
call _swi_dispatcher
popl %ecx
ret
ENTRY(swi_null)
ret
#ifdef APIC_IO #ifdef APIC_IO
#include "i386/isa/apic_ipl.s" #include "i386/isa/apic_ipl.s"
#else #else

View File

@ -23,7 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $Id: kern_intr.c,v 1.17 1998/06/18 15:32:08 bde Exp $ * $Id: kern_intr.c,v 1.18 1998/07/15 02:32:08 bde Exp $
* *
*/ */
@ -42,8 +42,11 @@
#include <sys/drvresource.h> #include <sys/drvresource.h>
#endif /* RESOURCE_CHECK */ #endif /* RESOURCE_CHECK */
#include <machine/ipl.h>
#include <i386/isa/icu.h> #include <i386/isa/icu.h>
#include <i386/isa/intr_machdep.h> #include <i386/isa/intr_machdep.h>
#include <sys/interrupt.h> #include <sys/interrupt.h>
#include <stddef.h> #include <stddef.h>
@ -59,6 +62,14 @@ typedef struct intrec {
int flags; int flags;
} intrec; } intrec;
struct swilist {
swihand_t *sl_handler;
struct swilist *sl_next;
};
static intrec *intreclist_head[NHWI];
static struct swilist swilists[NSWI];
/* /*
* The interrupt multiplexer calls each of the handlers in turn, * The interrupt multiplexer calls each of the handlers in turn,
* and applies the associated interrupt mask to "cpl", which is * and applies the associated interrupt mask to "cpl", which is
@ -66,8 +77,6 @@ typedef struct intrec {
*/ */
#ifndef SMP #ifndef SMP
#include <machine/ipl.h>
static __inline intrmask_t static __inline intrmask_t
splq(intrmask_t mask) splq(intrmask_t mask)
{ {
@ -90,9 +99,6 @@ intr_mux(void *arg)
} }
} }
/* XXX better use NHWI from <machine/ipl.h> for array size ??? */
static intrec *intreclist_head[ICU_LEN];
static intrec* static intrec*
find_idesc(unsigned *maskptr, int irq) find_idesc(unsigned *maskptr, int irq)
{ {
@ -437,4 +443,89 @@ unregister_intr(int intr, inthand2_t handler)
return (EINVAL); return (EINVAL);
} }
void
register_swi(intr, handler)
int intr;
swihand_t *handler;
{
struct swilist *slp, *slq;
int s;
if (intr < NHWI || intr >= NHWI + NSWI)
panic("register_swi: bad intr %d", intr);
if (handler == swi_generic || handler == swi_null)
panic("register_swi: bad handler %p", (void *)handler);
slp = &swilists[intr - NHWI];
s = splhigh();
if (ihandlers[intr] == swi_null)
ihandlers[intr] = handler;
else {
if (slp->sl_next == NULL) {
slp->sl_handler = ihandlers[intr];
ihandlers[intr] = swi_generic;
}
slq = malloc(sizeof(*slq), M_DEVBUF, M_NOWAIT);
if (slq == NULL)
panic("register_swi: malloc failed");
slq->sl_handler = handler;
slq->sl_next = NULL;
while (slp->sl_next != NULL)
slp = slp->sl_next;
slp->sl_next = slq;
}
splx(s);
}
void
swi_dispatcher(intr)
int intr;
{
struct swilist *slp;
slp = &swilists[intr - NHWI];
do {
(*slp->sl_handler)();
slp = slp->sl_next;
} while (slp != NULL);
}
void
unregister_swi(intr, handler)
int intr;
swihand_t *handler;
{
struct swilist *slfoundpred, *slp, *slq;
int s;
if (intr < NHWI || intr >= NHWI + NSWI)
panic("unregister_swi: bad intr %d", intr);
if (handler == swi_generic || handler == swi_null)
panic("unregister_swi: bad handler %p", (void *)handler);
slp = &swilists[intr - NHWI];
s = splhigh();
if (ihandlers[intr] == handler)
ihandlers[intr] = swi_null;
else if (slp->sl_next != NULL) {
slfoundpred = NULL;
for (slq = slp->sl_next; slq != NULL;
slp = slq, slq = slp->sl_next)
if (slq->sl_handler == handler)
slfoundpred = slp;
slp = &swilists[intr - NHWI];
if (slfoundpred != NULL) {
slq = slfoundpred->sl_next;
slfoundpred->sl_next = slq->sl_next;
free(slq, M_DEVBUF);
} else if (slp->sl_handler == handler) {
slq = slp->sl_next;
slp->sl_next = slq->sl_next;
slp->sl_handler = slq->sl_handler;
free(slq, M_DEVBUF);
}
if (slp->sl_next == NULL)
ihandlers[intr] = slp->sl_handler;
}
splx(s);
}
#endif /* __i386__ */ #endif /* __i386__ */

View File

@ -23,13 +23,15 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $Id: interrupt.h,v 1.5 1997/06/08 17:15:31 ache Exp $ * $Id: interrupt.h,v 1.6 1997/07/09 18:08:15 ache Exp $
*/ */
/* XXX currently dev_instance must be set to the ISA device_id or -1 for PCI */ /* XXX currently dev_instance must be set to the ISA device_id or -1 for PCI */
#define INTR_FAST 0x00000001 /* fast interrupt handler */ #define INTR_FAST 0x00000001 /* fast interrupt handler */
#define INTR_EXCL 0x00010000 /* excl. intr, default is shared */ #define INTR_EXCL 0x00010000 /* excl. intr, default is shared */
typedef void swihand_t __P((void));
struct intrec *intr_create(void *dev_instance, int irq, inthand2_t handler, struct intrec *intr_create(void *dev_instance, int irq, inthand2_t handler,
void *arg, intrmask_t *maskptr, int flags); void *arg, intrmask_t *maskptr, int flags);
@ -38,7 +40,18 @@ int intr_destroy(struct intrec *idesc);
int intr_connect(struct intrec *idesc); int intr_connect(struct intrec *idesc);
int intr_disconnect(struct intrec *idesc); int intr_disconnect(struct intrec *idesc);
void register_swi __P((int intr, swihand_t *handler));
void swi_dispatcher __P((int intr));
swihand_t swi_generic;
swihand_t swi_null;
void unregister_swi __P((int intr, swihand_t *handler));
/* XXX emulate old interface for now ... */ /* XXX emulate old interface for now ... */
int register_intr __P((int intr, int device_id, u_int flags, int register_intr __P((int intr, int device_id, u_int flags,
inthand2_t *handler, u_int *maskptr, int unit)); inthand2_t *handler, u_int *maskptr, int unit));
int unregister_intr(int intr, inthand2_t handler); int unregister_intr(int intr, inthand2_t handler);
#ifdef NHWI
/* XXX type change in middle; MI code uses only the top NSWI entries. */
extern swihand_t *ihandlers[NHWI + NSWI];
#endif