1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-26 16:18:31 +00:00

Support for the new FAST_HI algorithm.

Improved interrupt handling, fewer silo overflows.

With help from:	dave adkins <adkin003@gold.tc.umn.edu>
This commit is contained in:
Steve Passe 1997-08-29 18:16:18 +00:00
parent 83eea89664
commit 5f642c1666
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=28909
5 changed files with 142 additions and 38 deletions

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: exception.s,v 1.17 1997/08/23 05:16:26 smp Exp smp $
* $Id: exception.s,v 1.19 1997/08/28 09:50:41 smp Exp smp $
*/
#include "npx.h" /* NNPX */
@ -40,19 +40,27 @@
#include <machine/trap.h> /* trap codes */
#include <machine/asmacros.h> /* miscellaneous macros */
#include <machine/param.h>
#include <machine/smptests.h> /* INTR_SIMPLELOCK */
#ifndef SMP
#undef INTR_SIMPLELOCK /* simplifies cpp tests */
#undef REAL_ECPL
#undef REAL_ICPL
#undef REAL_AICPL
#undef REAL_AVCPL
#endif /* !SMP */
#if defined(SMP) && defined(REAL_ECPL)
#ifdef REAL_ECPL
#define ECPL_LOCK SCPL_LOCK
#define ECPL_UNLOCK SCPL_UNLOCK
#else /* SMP */
#else /* REAL_ECPL */
#define ECPL_LOCK
#define ECPL_UNLOCK
#endif /* SMP */
#endif /* REAL_ECPL */
#define KCSEL 0x08 /* kernel code selector */
#define KDSEL 0x10 /* kernel data selector */
@ -148,26 +156,35 @@ IDTVEC(fpu)
movl %ax,%ds
movl %ax,%es
FAKE_MCOUNT(12*4(%esp))
#ifdef SMP
MPLOCKED incl _cnt+V_TRAP
FPU_LOCK
ECPL_LOCK
#ifdef INTR_SIMPLELOCK
movl _cml,%eax
pushl %eax /* save original cml */
orl $SWI_AST_MASK,%eax
movl %eax,_cml
#else
movl _cpl,%eax
pushl %eax /* save original cpl */
orl $SWI_AST_MASK,%eax
movl %eax,_cpl
#endif /* INTR_SIMPLELOCK */
ECPL_UNLOCK
pushl $0 /* dummy unit to finish intr frame */
call _npxintr
#else
#else /* SMP */
movl _cpl,%eax
pushl %eax
pushl $0 /* dummy unit to finish intr frame */
incl _cnt+V_TRAP
orl $SWI_AST_MASK,%eax
movl %eax,_cpl
call _npxintr
#endif /* SMP */
call _npxintr
incb _intr_nesting_level
MEXITCOUNT
jmp _doreti
@ -194,7 +211,11 @@ calltrap:
MPLOCKED incl _cnt+V_TRAP
ALIGN_LOCK
ECPL_LOCK
#ifdef INTR_SIMPLELOCK
orl $SWI_AST_MASK,_cml
#else
orl $SWI_AST_MASK,_cpl
#endif
ECPL_UNLOCK
call _trap
@ -212,16 +233,20 @@ calltrap:
testl $PSL_VM,TF_EFLAGS(%esp)
jne 1f
#endif /* VM86 */
#ifdef SMP
ECPL_LOCK
/* XXX will this work??? */
#ifdef INTR_SIMPLELOCK
pushl _cml /* XXX will this work??? */
#else
pushl _cpl
#endif /* INTR_SIMPLELOCK */
ECPL_UNLOCK
jmp 2f
1:
pushl $0 /* cpl to restore */
2:
#else
#else /* SMP */
movl _cpl,%eax
1:
pushl %eax
@ -263,7 +288,11 @@ IDTVEC(syscall)
MPLOCKED incl _cnt+V_SYSCALL
SYSCALL_LOCK
ECPL_LOCK
#ifdef INTR_SIMPLELOCK
movl $SWI_AST_MASK,_cml
#else
movl $SWI_AST_MASK,_cpl
#endif
ECPL_UNLOCK
call _syscall
@ -293,7 +322,11 @@ IDTVEC(int0x80_syscall)
MPLOCKED incl _cnt+V_SYSCALL
ALTSYSCALL_LOCK
ECPL_LOCK
#ifdef INTR_SIMPLELOCK
movl $SWI_AST_MASK,_cml
#else
movl $SWI_AST_MASK,_cpl
#endif
ECPL_UNLOCK
call _syscall

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: exception.s,v 1.17 1997/08/23 05:16:26 smp Exp smp $
* $Id: exception.s,v 1.19 1997/08/28 09:50:41 smp Exp smp $
*/
#include "npx.h" /* NNPX */
@ -40,19 +40,27 @@
#include <machine/trap.h> /* trap codes */
#include <machine/asmacros.h> /* miscellaneous macros */
#include <machine/param.h>
#include <machine/smptests.h> /* INTR_SIMPLELOCK */
#ifndef SMP
#undef INTR_SIMPLELOCK /* simplifies cpp tests */
#undef REAL_ECPL
#undef REAL_ICPL
#undef REAL_AICPL
#undef REAL_AVCPL
#endif /* !SMP */
#if defined(SMP) && defined(REAL_ECPL)
#ifdef REAL_ECPL
#define ECPL_LOCK SCPL_LOCK
#define ECPL_UNLOCK SCPL_UNLOCK
#else /* SMP */
#else /* REAL_ECPL */
#define ECPL_LOCK
#define ECPL_UNLOCK
#endif /* SMP */
#endif /* REAL_ECPL */
#define KCSEL 0x08 /* kernel code selector */
#define KDSEL 0x10 /* kernel data selector */
@ -148,26 +156,35 @@ IDTVEC(fpu)
movl %ax,%ds
movl %ax,%es
FAKE_MCOUNT(12*4(%esp))
#ifdef SMP
MPLOCKED incl _cnt+V_TRAP
FPU_LOCK
ECPL_LOCK
#ifdef INTR_SIMPLELOCK
movl _cml,%eax
pushl %eax /* save original cml */
orl $SWI_AST_MASK,%eax
movl %eax,_cml
#else
movl _cpl,%eax
pushl %eax /* save original cpl */
orl $SWI_AST_MASK,%eax
movl %eax,_cpl
#endif /* INTR_SIMPLELOCK */
ECPL_UNLOCK
pushl $0 /* dummy unit to finish intr frame */
call _npxintr
#else
#else /* SMP */
movl _cpl,%eax
pushl %eax
pushl $0 /* dummy unit to finish intr frame */
incl _cnt+V_TRAP
orl $SWI_AST_MASK,%eax
movl %eax,_cpl
call _npxintr
#endif /* SMP */
call _npxintr
incb _intr_nesting_level
MEXITCOUNT
jmp _doreti
@ -194,7 +211,11 @@ calltrap:
MPLOCKED incl _cnt+V_TRAP
ALIGN_LOCK
ECPL_LOCK
#ifdef INTR_SIMPLELOCK
orl $SWI_AST_MASK,_cml
#else
orl $SWI_AST_MASK,_cpl
#endif
ECPL_UNLOCK
call _trap
@ -212,16 +233,20 @@ calltrap:
testl $PSL_VM,TF_EFLAGS(%esp)
jne 1f
#endif /* VM86 */
#ifdef SMP
ECPL_LOCK
/* XXX will this work??? */
#ifdef INTR_SIMPLELOCK
pushl _cml /* XXX will this work??? */
#else
pushl _cpl
#endif /* INTR_SIMPLELOCK */
ECPL_UNLOCK
jmp 2f
1:
pushl $0 /* cpl to restore */
2:
#else
#else /* SMP */
movl _cpl,%eax
1:
pushl %eax
@ -263,7 +288,11 @@ IDTVEC(syscall)
MPLOCKED incl _cnt+V_SYSCALL
SYSCALL_LOCK
ECPL_LOCK
#ifdef INTR_SIMPLELOCK
movl $SWI_AST_MASK,_cml
#else
movl $SWI_AST_MASK,_cpl
#endif
ECPL_UNLOCK
call _syscall
@ -293,7 +322,11 @@ IDTVEC(int0x80_syscall)
MPLOCKED incl _cnt+V_SYSCALL
ALTSYSCALL_LOCK
ECPL_LOCK
#ifdef INTR_SIMPLELOCK
movl $SWI_AST_MASK,_cml
#else
movl $SWI_AST_MASK,_cpl
#endif
ECPL_UNLOCK
call _syscall

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: exception.s,v 1.17 1997/08/23 05:16:26 smp Exp smp $
* $Id: exception.s,v 1.19 1997/08/28 09:50:41 smp Exp smp $
*/
#include "npx.h" /* NNPX */
@ -40,19 +40,27 @@
#include <machine/trap.h> /* trap codes */
#include <machine/asmacros.h> /* miscellaneous macros */
#include <machine/param.h>
#include <machine/smptests.h> /* INTR_SIMPLELOCK */
#ifndef SMP
#undef INTR_SIMPLELOCK /* simplifies cpp tests */
#undef REAL_ECPL
#undef REAL_ICPL
#undef REAL_AICPL
#undef REAL_AVCPL
#endif /* !SMP */
#if defined(SMP) && defined(REAL_ECPL)
#ifdef REAL_ECPL
#define ECPL_LOCK SCPL_LOCK
#define ECPL_UNLOCK SCPL_UNLOCK
#else /* SMP */
#else /* REAL_ECPL */
#define ECPL_LOCK
#define ECPL_UNLOCK
#endif /* SMP */
#endif /* REAL_ECPL */
#define KCSEL 0x08 /* kernel code selector */
#define KDSEL 0x10 /* kernel data selector */
@ -148,26 +156,35 @@ IDTVEC(fpu)
movl %ax,%ds
movl %ax,%es
FAKE_MCOUNT(12*4(%esp))
#ifdef SMP
MPLOCKED incl _cnt+V_TRAP
FPU_LOCK
ECPL_LOCK
#ifdef INTR_SIMPLELOCK
movl _cml,%eax
pushl %eax /* save original cml */
orl $SWI_AST_MASK,%eax
movl %eax,_cml
#else
movl _cpl,%eax
pushl %eax /* save original cpl */
orl $SWI_AST_MASK,%eax
movl %eax,_cpl
#endif /* INTR_SIMPLELOCK */
ECPL_UNLOCK
pushl $0 /* dummy unit to finish intr frame */
call _npxintr
#else
#else /* SMP */
movl _cpl,%eax
pushl %eax
pushl $0 /* dummy unit to finish intr frame */
incl _cnt+V_TRAP
orl $SWI_AST_MASK,%eax
movl %eax,_cpl
call _npxintr
#endif /* SMP */
call _npxintr
incb _intr_nesting_level
MEXITCOUNT
jmp _doreti
@ -194,7 +211,11 @@ calltrap:
MPLOCKED incl _cnt+V_TRAP
ALIGN_LOCK
ECPL_LOCK
#ifdef INTR_SIMPLELOCK
orl $SWI_AST_MASK,_cml
#else
orl $SWI_AST_MASK,_cpl
#endif
ECPL_UNLOCK
call _trap
@ -212,16 +233,20 @@ calltrap:
testl $PSL_VM,TF_EFLAGS(%esp)
jne 1f
#endif /* VM86 */
#ifdef SMP
ECPL_LOCK
/* XXX will this work??? */
#ifdef INTR_SIMPLELOCK
pushl _cml /* XXX will this work??? */
#else
pushl _cpl
#endif /* INTR_SIMPLELOCK */
ECPL_UNLOCK
jmp 2f
1:
pushl $0 /* cpl to restore */
2:
#else
#else /* SMP */
movl _cpl,%eax
1:
pushl %eax
@ -263,7 +288,11 @@ IDTVEC(syscall)
MPLOCKED incl _cnt+V_SYSCALL
SYSCALL_LOCK
ECPL_LOCK
#ifdef INTR_SIMPLELOCK
movl $SWI_AST_MASK,_cml
#else
movl $SWI_AST_MASK,_cpl
#endif
ECPL_UNLOCK
call _syscall
@ -293,7 +322,11 @@ IDTVEC(int0x80_syscall)
MPLOCKED incl _cnt+V_SYSCALL
ALTSYSCALL_LOCK
ECPL_LOCK
#ifdef INTR_SIMPLELOCK
movl $SWI_AST_MASK,_cml
#else
movl $SWI_AST_MASK,_cpl
#endif
ECPL_UNLOCK
call _syscall

View File

@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
* $Id: mplock.s,v 1.20 1997/08/25 21:31:38 bde Exp $
* $Id: mplock.s,v 1.19 1997/08/29 07:26:27 smp Exp smp $
*
* Functions for locking between CPUs in a SMP system.
*
@ -28,7 +28,7 @@
#include <i386/isa/intr_machdep.h>
#define GLPROFILE
#define GLPROFILE_NOT
#ifdef CHEAP_TPR
@ -213,8 +213,8 @@ NON_GPROF_ENTRY(get_mplock)
pushfl /* save current EFLAGS */
testl $(1<<9), (%esp) /* test EI bit */
jnz 1f /* INTs currently enabled */
movl $TPR_BLOCK_HWI, lapic_tpr /* CHEAP_TPR */
sti /* allow IPI (and only IPI) INTs */
movl $TPR_IGNORE_HWI, lapic_tpr /* CHEAP_TPR */
sti /* allow IPI and FAST INTs */
1:
pushl $_mp_lock
call _MPgetlock
@ -298,8 +298,8 @@ NON_GPROF_ENTRY(get_isrlock)
/* block all HW INTs via Task Priority Register */
pushl lapic_tpr /* save current TPR */
pushfl /* save current EFLAGS */
movl $TPR_BLOCK_HWI, lapic_tpr /* CHEAP_TPR */
sti /* allow IPI (and only IPI) INTs */
movl $TPR_IGNORE_HWI, lapic_tpr /* CHEAP_TPR */
sti /* allow IPI and FAST INTs */
pushl $_mp_lock
call _MPgetlock
@ -344,7 +344,7 @@ NON_GPROF_ENTRY(rel_isrlock)
NON_GPROF_ENTRY(get_fpu_lock)
pushl lapic_tpr
pushfl
movl $TPR_BLOCK_HWI, lapic_tpr /* CHEAP_TPR */
movl $TPR_IGNORE_HWI, lapic_tpr /* CHEAP_TPR */
sti
pushl $_mp_lock
call _MPgetlock
@ -375,7 +375,7 @@ NON_GPROF_ENTRY(rel_fpu_lock)
NON_GPROF_ENTRY(get_align_lock)
pushl lapic_tpr
pushfl
movl $TPR_BLOCK_HWI, lapic_tpr /* CHEAP_TPR */
movl $TPR_IGNORE_HWI, lapic_tpr /* CHEAP_TPR */
sti
pushl $_mp_lock
call _MPgetlock
@ -406,7 +406,7 @@ NON_GPROF_ENTRY(rel_align_lock)
NON_GPROF_ENTRY(get_syscall_lock)
pushl lapic_tpr
pushfl
movl $TPR_BLOCK_HWI, lapic_tpr /* CHEAP_TPR */
movl $TPR_IGNORE_HWI, lapic_tpr /* CHEAP_TPR */
sti
pushl $_mp_lock
call _MPgetlock
@ -437,7 +437,7 @@ NON_GPROF_ENTRY(rel_syscall_lock)
NON_GPROF_ENTRY(get_altsyscall_lock)
pushl lapic_tpr
pushfl
movl $TPR_BLOCK_HWI, lapic_tpr /* CHEAP_TPR */
movl $TPR_IGNORE_HWI, lapic_tpr /* CHEAP_TPR */
sti
pushl $_mp_lock
call _MPgetlock

View File

@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: simplelock.s,v 1.3 1997/08/24 00:05:37 fsmp Exp $
* $Id: simplelock.s,v 1.8 1997/08/29 07:26:27 smp Exp smp $
*/
/*
@ -32,6 +32,7 @@
#include <machine/asmacros.h> /* miscellaneous macros */
#include <i386/isa/intr_machdep.h>
#include <machine/smptests.h> /** FAST_HI */
/*
* The following impliments the primitives described in i386/i386/param.h
@ -172,7 +173,11 @@ ENTRY(ss_lock)
movl $1, %ecx /* value for a held lock */
ssetlock:
pushl lapic_tpr /* save current task priority */
#ifdef FAST_HI
movl $TPR_BLOCK_FHWI, lapic_tpr /* block FAST hw INTs */
#else
movl $TPR_BLOCK_HWI, lapic_tpr /* block hw INTs */
#endif
xchgl %ecx, (%eax) /* compete */
testl %ecx, %ecx
jz sgotit /* it was clear, return */