Various cleanups in interrupt code, and fix a potential crash in doreti:

if we enter doreti_checkast with only soft interrupt pendings, we would
jump to one of the soft* vector with %esi uninitialized, and the vector
would do a jump *%esi at the end ...
I don't know why nobody ever went into this; I guess in the common case
there's no soft irq pending without a hard irq in this code path ...
This commit is contained in:
bouyer 2007-06-25 20:09:34 +00:00
parent bf539c16bd
commit 1206dd032d
2 changed files with 5 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: spl.S,v 1.8 2007/02/09 21:55:14 ad Exp $ */
/* $NetBSD: spl.S,v 1.9 2007/06/25 20:09:34 bouyer Exp $ */
/* NetBSD: spl.S,v 1.11 2004/02/20 17:35:01 yamt Exp */
/*
@ -146,8 +146,8 @@ IDTVEC(spllower)
IDTVEC(doreti)
IDEPTH_DECR
popl %ebx # get previous priority
movl $.Ldoreti_resume,%esi # address to resume loop at
.Ldoreti_resume:
movl $.Ldoreti_resume,%esi # address to resume loop at
movl %ebx,%eax
movl CPUVAR(IUNMASK)(,%eax,4),%eax
andl CPUVAR(IPENDING),%eax
@ -158,7 +158,6 @@ IDTVEC(doreti)
jmp *IS_RESUME(%eax)
2: /* Check for ASTs on exit to user mode. */
movl %ebx,CPUVAR(ILEVEL)
5:
testb $CHK_UPL,TF_CS(%esp)
jnz doreti_checkast
#ifdef VM86

View File

@ -1,4 +1,4 @@
/* $NetBSD: vector.S,v 1.17 2007/02/09 21:55:14 ad Exp $ */
/* $NetBSD: vector.S,v 1.18 2007/06/25 20:09:34 bouyer Exp $ */
/* NetBSD: 1.13 2004/03/11 11:39:26 yamt Exp */
/*
@ -197,10 +197,8 @@ IDTVEC(recurse_/**/name/**/num) ;\
IDTVEC(resume_/**/name/**/num) \
/*movl %esp,%ecx*/ ;\
movl $IREENT_MAGIC,TF_ERR(%esp) ;\
movl %ebx,%esi ;\
pushl %ebx ;\
movl CPUVAR(ISOURCES) + (num) * 4, %ebp ;\
1: \
pushl %esi ;\
movl $num,CPUVAR(ILEVEL) ;\
IDEPTH_INCR /* leaves old %esp on stack */ ;\
STI(%eax) ;\
@ -213,7 +211,7 @@ IDTVEC(resume_/**/name/**/num) \
movl IH_IPL_NEXT(%ebx),%ebx /* next handler in chain */ ;\
testl %ebx,%ebx ;\
jnz 6b ;\
5: \
\
UNLOCK_KERNEL ;\
CLI(%eax) ;\
unmask(num) /* unmask it in hardware */ ;\