diff options
author | bde <bde@FreeBSD.org> | 1998-08-10 19:41:07 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1998-08-10 19:41:07 +0000 |
commit | 8116baf9ca165766efd397b3ce5327baf82d903b (patch) | |
tree | 35ad0f03ec3a46902b2f8e22fab637ecd6f0414c /sys/amd64 | |
parent | d09c7eccb228027516b5db0d20d6eb3a3d6a5263 (diff) | |
download | FreeBSD-src-8116baf9ca165766efd397b3ce5327baf82d903b.zip FreeBSD-src-8116baf9ca165766efd397b3ce5327baf82d903b.tar.gz |
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.
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/amd64/exception.S | 51 | ||||
-rw-r--r-- | sys/amd64/amd64/exception.s | 51 |
2 files changed, 20 insertions, 82 deletions
diff --git a/sys/amd64/amd64/exception.S b/sys/amd64/amd64/exception.S index f2133f6..60856e2 100644 --- a/sys/amd64/amd64/exception.S +++ b/sys/amd64/amd64/exception.S @@ -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 diff --git a/sys/amd64/amd64/exception.s b/sys/amd64/amd64/exception.s index f2133f6..60856e2 100644 --- a/sys/amd64/amd64/exception.s +++ b/sys/amd64/amd64/exception.s @@ -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 |