Mostly fix an obscure condition where an AST could be delayed by as much as a

clock tick.  And softclock() no longer takes an argument.
This commit is contained in:
mycroft 1994-05-05 08:44:53 +00:00
parent 62bf6a1578
commit fb113f41fd
2 changed files with 24 additions and 12 deletions

View File

@ -37,7 +37,7 @@
* SUCH DAMAGE.
*
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91
* $Id: locore.s,v 1.65 1994/05/05 05:35:46 cgd Exp $
* $Id: locore.s,v 1.66 1994/05/05 08:44:53 mycroft Exp $
*/
/*
@ -1824,6 +1824,13 @@ ENTRY(proffault)
/*
* Trap and fault vector routines
*
* On exit from the kernel to user mode, we always need to check for ASTs. In
* addition, we need to do this atomically; otherwise an interrupt may occur
* which causes an AST, but it won't get processed until the next kernel entry
* (possibly the next clock tick). Thus, we disable interrupt before checking,
* and only enable them again on the final `iret' or before calling the AST
* handler.
*
* XXX - debugger traps are now interrupt gates so at least bdb doesn't lose
* control. The sti's give the standard losing behaviour for ddb and kgdb.
*/
@ -1961,13 +1968,15 @@ calltrap:
movl _cpl,%ebx
#endif
call _trap
/*
2: /*
* Check for ASTs.
*/
cli
testb $SEL_RPL_MASK,TF_CS(%esp)
jz 1f
btrl $0,_astpending
jnc 1f
sti
movl $T_ASTFLT,TF_TRAPNO(%esp)
call _trap
#ifndef DIAGNOSTIC
@ -1975,8 +1984,9 @@ calltrap:
#else
1: cmpl _cpl,%ebx
jne 3f
2: INTRFASTEXIT
3: pushl $4f
INTRFASTEXIT
3: sti
pushl $4f
call _printf
addl $4,%esp
#ifdef DDB
@ -2016,12 +2026,14 @@ IDTVEC(syscall)
movl _cpl,%ebx
#endif
call _syscall
/*
2: /*
* Check for ASTs.
*/
cli
/* Always returning to user mode here. */
btrl $0,_astpending
jnc 1f
sti
movl $T_ASTFLT,TF_TRAPNO(%esp)
call _trap
#ifndef DIAGNOSTIC
@ -2029,8 +2041,9 @@ IDTVEC(syscall)
#else
1: cmpl _cpl,%ebx
jne 3f
2: INTRFASTEXIT
3: pushl $4f
INTRFASTEXIT
3: sti
pushl $4f
call _printf
addl $4,%esp
#ifdef DDB

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)icu.s 7.2 (Berkeley) 5/21/91
* $Id: icu.s,v 1.32 1994/04/25 04:59:24 mycroft Exp $
* $Id: icu.s,v 1.33 1994/05/05 08:44:57 mycroft Exp $
*/
/*
@ -107,11 +107,13 @@ IDTVEC(doreti)
btrl %eax,_ipending
jnc 1b # some intr cleared the in-memory bit
jmp *_Xresume(,%eax,4)
2: /* Check for ASTs only on exit to user mode. */
2: /* Check for ASTs on exit to user mode. */
cli
testb $SEL_RPL_MASK,TF_CS(%esp)
jz 3f
btrl $0,_astpending
jnc 3f
sti
/* Pushed T_ASTFLT into TF_TRAPNO on interrupt entry. */
call _trap
3: INTRFASTEXIT
@ -165,9 +167,6 @@ IDTVEC(softnet)
IDTVEC(softclock)
leal SIR_CLOCKMASK(%ebx),%eax
movl %eax,_cpl
pushl %ebx # XXX previous cpl (not used)
pushl %esp # XXX pointer to frame
call _softclock
addl $8,%esp # XXX discard dummies
movl %ebx,_cpl
jmp %esi