mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-01 22:25:22 +00:00
Fixed restoring of cpl after trap handling. The wrong cpl (SWI_AST_MASK
instead of 0) was "restored" after handling a trap that occurred while returning to user mode. This bug was most noticeable for VM86 and is still detected and fixed up (on return from the next exception) in doreti if VM86 is configured.
This commit is contained in:
parent
b97fc94873
commit
0c61bd3a7d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=38233
|
@ -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.53 1998/05/28 09:29:54 phk Exp $
|
||||
* $Id: exception.s,v 1.54 1998/07/28 17:55:37 bde Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
|
@ -209,55 +209,24 @@ calltrap:
|
|||
ALIGN_LOCK
|
||||
ECPL_LOCK
|
||||
#ifdef CPL_AND_CML
|
||||
orl $SWI_AST_MASK,_cml
|
||||
movl _cml,%eax
|
||||
movl %eax,%ebx /* keep orig. cml here during trap() */
|
||||
orl $SWI_AST_MASK,%eax
|
||||
movl %eax,_cml
|
||||
#else
|
||||
orl $SWI_AST_MASK,_cpl
|
||||
movl _cpl,%eax
|
||||
movl %eax,%ebx /* keep orig. cpl here during trap() */
|
||||
orl $SWI_AST_MASK,%eax
|
||||
movl %eax,_cpl
|
||||
#endif
|
||||
ECPL_UNLOCK
|
||||
call _trap
|
||||
|
||||
/*
|
||||
* There was no place to save the cpl so we have to recover it
|
||||
* indirectly. For traps from user mode it was 0, and for traps
|
||||
* from kernel mode Oring SWI_AST_MASK into it didn't change it.
|
||||
*/
|
||||
#ifndef SMP
|
||||
subl %eax,%eax
|
||||
#endif
|
||||
#ifdef VM86
|
||||
cmpl $1,_in_vm86call
|
||||
je 2f /* keep kernel cpl */
|
||||
#endif
|
||||
testb $SEL_RPL_MASK,TRAPF_CS_OFF(%esp)
|
||||
jne 1f
|
||||
#ifdef VM86
|
||||
testl $PSL_VM,TF_EFLAGS(%esp)
|
||||
jne 1f
|
||||
#endif /* VM86 */
|
||||
|
||||
2:
|
||||
#ifdef SMP
|
||||
ECPL_LOCK
|
||||
#ifdef CPL_AND_CML
|
||||
pushl _cml /* XXX will this work??? */
|
||||
#else
|
||||
pushl _cpl
|
||||
#endif
|
||||
ECPL_UNLOCK
|
||||
jmp 2f
|
||||
1:
|
||||
pushl $0 /* cpl to restore */
|
||||
2:
|
||||
#else /* SMP */
|
||||
movl _cpl,%eax
|
||||
1:
|
||||
pushl %eax
|
||||
#endif /* SMP */
|
||||
|
||||
/*
|
||||
* Return via _doreti to handle ASTs. Have to change trap frame
|
||||
* to interrupt frame.
|
||||
*/
|
||||
pushl %ebx /* cpl to restore */
|
||||
subl $4,%esp /* dummy unit to finish intr frame */
|
||||
MPLOCKED incb _intr_nesting_level
|
||||
MEXITCOUNT
|
||||
|
|
|
@ -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.53 1998/05/28 09:29:54 phk Exp $
|
||||
* $Id: exception.s,v 1.54 1998/07/28 17:55:37 bde Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
|
@ -209,55 +209,24 @@ calltrap:
|
|||
ALIGN_LOCK
|
||||
ECPL_LOCK
|
||||
#ifdef CPL_AND_CML
|
||||
orl $SWI_AST_MASK,_cml
|
||||
movl _cml,%eax
|
||||
movl %eax,%ebx /* keep orig. cml here during trap() */
|
||||
orl $SWI_AST_MASK,%eax
|
||||
movl %eax,_cml
|
||||
#else
|
||||
orl $SWI_AST_MASK,_cpl
|
||||
movl _cpl,%eax
|
||||
movl %eax,%ebx /* keep orig. cpl here during trap() */
|
||||
orl $SWI_AST_MASK,%eax
|
||||
movl %eax,_cpl
|
||||
#endif
|
||||
ECPL_UNLOCK
|
||||
call _trap
|
||||
|
||||
/*
|
||||
* There was no place to save the cpl so we have to recover it
|
||||
* indirectly. For traps from user mode it was 0, and for traps
|
||||
* from kernel mode Oring SWI_AST_MASK into it didn't change it.
|
||||
*/
|
||||
#ifndef SMP
|
||||
subl %eax,%eax
|
||||
#endif
|
||||
#ifdef VM86
|
||||
cmpl $1,_in_vm86call
|
||||
je 2f /* keep kernel cpl */
|
||||
#endif
|
||||
testb $SEL_RPL_MASK,TRAPF_CS_OFF(%esp)
|
||||
jne 1f
|
||||
#ifdef VM86
|
||||
testl $PSL_VM,TF_EFLAGS(%esp)
|
||||
jne 1f
|
||||
#endif /* VM86 */
|
||||
|
||||
2:
|
||||
#ifdef SMP
|
||||
ECPL_LOCK
|
||||
#ifdef CPL_AND_CML
|
||||
pushl _cml /* XXX will this work??? */
|
||||
#else
|
||||
pushl _cpl
|
||||
#endif
|
||||
ECPL_UNLOCK
|
||||
jmp 2f
|
||||
1:
|
||||
pushl $0 /* cpl to restore */
|
||||
2:
|
||||
#else /* SMP */
|
||||
movl _cpl,%eax
|
||||
1:
|
||||
pushl %eax
|
||||
#endif /* SMP */
|
||||
|
||||
/*
|
||||
* Return via _doreti to handle ASTs. Have to change trap frame
|
||||
* to interrupt frame.
|
||||
*/
|
||||
pushl %ebx /* cpl to restore */
|
||||
subl $4,%esp /* dummy unit to finish intr frame */
|
||||
MPLOCKED incb _intr_nesting_level
|
||||
MEXITCOUNT
|
||||
|
|
|
@ -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.53 1998/05/28 09:29:54 phk Exp $
|
||||
* $Id: exception.s,v 1.54 1998/07/28 17:55:37 bde Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
|
@ -209,55 +209,24 @@ calltrap:
|
|||
ALIGN_LOCK
|
||||
ECPL_LOCK
|
||||
#ifdef CPL_AND_CML
|
||||
orl $SWI_AST_MASK,_cml
|
||||
movl _cml,%eax
|
||||
movl %eax,%ebx /* keep orig. cml here during trap() */
|
||||
orl $SWI_AST_MASK,%eax
|
||||
movl %eax,_cml
|
||||
#else
|
||||
orl $SWI_AST_MASK,_cpl
|
||||
movl _cpl,%eax
|
||||
movl %eax,%ebx /* keep orig. cpl here during trap() */
|
||||
orl $SWI_AST_MASK,%eax
|
||||
movl %eax,_cpl
|
||||
#endif
|
||||
ECPL_UNLOCK
|
||||
call _trap
|
||||
|
||||
/*
|
||||
* There was no place to save the cpl so we have to recover it
|
||||
* indirectly. For traps from user mode it was 0, and for traps
|
||||
* from kernel mode Oring SWI_AST_MASK into it didn't change it.
|
||||
*/
|
||||
#ifndef SMP
|
||||
subl %eax,%eax
|
||||
#endif
|
||||
#ifdef VM86
|
||||
cmpl $1,_in_vm86call
|
||||
je 2f /* keep kernel cpl */
|
||||
#endif
|
||||
testb $SEL_RPL_MASK,TRAPF_CS_OFF(%esp)
|
||||
jne 1f
|
||||
#ifdef VM86
|
||||
testl $PSL_VM,TF_EFLAGS(%esp)
|
||||
jne 1f
|
||||
#endif /* VM86 */
|
||||
|
||||
2:
|
||||
#ifdef SMP
|
||||
ECPL_LOCK
|
||||
#ifdef CPL_AND_CML
|
||||
pushl _cml /* XXX will this work??? */
|
||||
#else
|
||||
pushl _cpl
|
||||
#endif
|
||||
ECPL_UNLOCK
|
||||
jmp 2f
|
||||
1:
|
||||
pushl $0 /* cpl to restore */
|
||||
2:
|
||||
#else /* SMP */
|
||||
movl _cpl,%eax
|
||||
1:
|
||||
pushl %eax
|
||||
#endif /* SMP */
|
||||
|
||||
/*
|
||||
* Return via _doreti to handle ASTs. Have to change trap frame
|
||||
* to interrupt frame.
|
||||
*/
|
||||
pushl %ebx /* cpl to restore */
|
||||
subl $4,%esp /* dummy unit to finish intr frame */
|
||||
MPLOCKED incb _intr_nesting_level
|
||||
MEXITCOUNT
|
||||
|
|
Loading…
Reference in a new issue