diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2014-12-15 01:29:43 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2014-12-15 01:29:43 +0100 |
commit | 6f8e390eea2ac9aaa754e1ab2ecd73af5857f798 (patch) | |
tree | 86f441493c298552179633359e927679b70c7af6 | |
parent | 48680cf730307b0432d98365ed2a32e3f18b6af0 (diff) |
Make spl7 just clear IF instead of setting the PIC mask
* i386/i386/spl.S (spl7): Just set curr_ipl and cli.
(splx) [MACH_KDB || MACH_TTD]: When curr_ipl is 7, make sure that IF is cleared.
(splx): When staying at ipl7, do not enable interrupts.
(spl) [MACH_KDB || MACH_TTD]: When curr_ipl is 7, make sure that IF is cleared.
(spl): When new ipl is 7, branch to spl7.
* i386/i386/locore.S (TIME_TRAP_UENTRY, TIME_TRAP_SENTRY): Save flags, and
restore them instead of blindly using sti.
-rw-r--r-- | i386/i386/locore.S | 6 | ||||
-rw-r--r-- | i386/i386/spl.S | 36 |
2 files changed, 39 insertions, 3 deletions
diff --git a/i386/i386/locore.S b/i386/i386/locore.S index e1befa7..15715f6 100644 --- a/i386/i386/locore.S +++ b/i386/i386/locore.S @@ -119,6 +119,7 @@ LEXT(retry_table_end) ;\ * Uses %eax, %ebx, %ecx. */ #define TIME_TRAP_UENTRY \ + pushf /* Save flags */ ;\ cli /* block interrupts */ ;\ movl VA_ETC,%ebx /* get timer value */ ;\ movl CX(EXT(current_tstamp),%edx),%ecx /* get old time stamp */;\ @@ -131,7 +132,7 @@ LEXT(retry_table_end) ;\ 0: addl $(TH_SYSTEM_TIMER-TH_USER_TIMER),%ecx ;\ /* switch to sys timer */;\ movl %ecx,CX(EXT(current_timer),%edx) /* make it current */ ;\ - sti /* allow interrupts */ + popf /* allow interrupts */ /* * Update time on system call entry. @@ -141,6 +142,7 @@ LEXT(retry_table_end) ;\ * Same as TIME_TRAP_UENTRY, but preserves %eax. */ #define TIME_TRAP_SENTRY \ + pushf /* Save flags */ ;\ cli /* block interrupts */ ;\ movl VA_ETC,%ebx /* get timer value */ ;\ movl CX(EXT(current_tstamp),%edx),%ecx /* get old time stamp */;\ @@ -155,7 +157,7 @@ LEXT(retry_table_end) ;\ 0: addl $(TH_SYSTEM_TIMER-TH_USER_TIMER),%ecx ;\ /* switch to sys timer */;\ movl %ecx,CX(EXT(current_timer),%edx) /* make it current */ ;\ - sti /* allow interrupts */ + popf /* allow interrupts */ /* * update time on user trap exit. diff --git a/i386/i386/spl.S b/i386/i386/spl.S index 3c07509..41458ac 100644 --- a/i386/i386/spl.S +++ b/i386/i386/spl.S @@ -140,15 +140,35 @@ Entry(splsched) Entry(splhigh) Entry(splhi) ENTRY(spl7) - SETIPL(SPL7) + /* ipl7 just clears IF */ + movl $SPL7,%eax + xchgl EXT(curr_ipl),%eax + cli + ret ENTRY(splx) movl S_ARG0,%edx /* get ipl */ + +#if MACH_KDB || MACH_TTD + /* First make sure that if we're exitting from ipl7, IF is still cleared */ + cmpl $SPL7,EXT(curr_ipl) /* from ipl7? */ + jne 0f + pushfl + popl %eax + testl $0x200,%eax /* IF? */ + jz 0f + int3 /* Oops, interrupts got enabled?! */ + +0: +#endif /* MACH_KDB || MACH_TTD */ testl %edx,%edx /* spl0? */ jz EXT(spl0) /* yes, handle specially */ cmpl EXT(curr_ipl),%edx /* same ipl as current? */ jne spl /* no */ + cmpl $SPL7,%edx /* spl7? */ + je 1f /* to ipl7, don't enable interrupts */ sti /* ensure interrupts are enabled */ +1: movl %edx,%eax /* return previous ipl */ ret @@ -207,6 +227,20 @@ splx_cli: .align TEXT_ALIGN .globl spl spl: +#if MACH_KDB || MACH_TTD + /* First make sure that if we're exitting from ipl7, IF is still cleared */ + cmpl $SPL7,EXT(curr_ipl) /* from ipl7? */ + jne 0f + pushfl + popl %eax + testl $0x200,%eax /* IF? */ + jz 0f + int3 /* Oops, interrupts got enabled?! */ + +0: +#endif /* MACH_KDB || MACH_TTD */ + cmpl $SPL7,%edx /* spl7? */ + je EXT(spl7) /* yes, handle specially */ movl EXT(pic_mask)(,%edx,4),%eax /* get PIC mask */ cli /* disable interrupts */ |