Module Name: src Committed By: drochner Date: Sun Feb 14 11:09:54 UTC 2010
Modified Files: src/sys/arch/i386/i386: ibcs2_machdep.c svr4_machdep.c Log Message: fix confused CS selector, fixes the panic reported by Mark Davis per PR port-i386/42787 (the panic happens due to a GPF when a privileged descriptor is tried to be loaded with the UPL bit set) The original bug is very old (pre-2.0, i386/svr4_machdep.c rev. 1.69), but it was relatively harmless until the order of GDT entries was shuffled (pre-5.0, i386/segments.h rev. 1.42). Before, it caused a userlevel data selector to be used for CS which broke the emulation (likely the reason of PR port-i386/32424). The shuffle made that a privileged selector was used, causing the GPF. (recent -current doesn't panic on that GPF which seems to be a side effect of another change) To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/sys/arch/i386/i386/ibcs2_machdep.c cvs rdiff -u -r1.95 -r1.96 src/sys/arch/i386/i386/svr4_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/i386/i386/ibcs2_machdep.c diff -u src/sys/arch/i386/i386/ibcs2_machdep.c:1.39 src/sys/arch/i386/i386/ibcs2_machdep.c:1.40 --- src/sys/arch/i386/i386/ibcs2_machdep.c:1.39 Thu Dec 10 14:13:50 2009 +++ src/sys/arch/i386/i386/ibcs2_machdep.c Sun Feb 14 11:09:54 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: ibcs2_machdep.c,v 1.39 2009/12/10 14:13:50 matt Exp $ */ +/* $NetBSD: ibcs2_machdep.c,v 1.40 2010/02/14 11:09:54 drochner Exp $ */ /*- * Copyright (c) 1997, 2000 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ibcs2_machdep.c,v 1.39 2009/12/10 14:13:50 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ibcs2_machdep.c,v 1.40 2010/02/14 11:09:54 drochner Exp $"); #if defined(_KERNEL_OPT) #include "opt_vm86.h" @@ -74,7 +74,7 @@ pcb->pcb_savefpu.sv_87.sv_env.en_cw = __iBCS2_NPXCW__; tf = l->l_md.md_regs; tf->tf_eax = 0x2000000; /* XXX base of heap */ - tf->tf_cs = GSEL(LUCODEBIG_SEL, SEL_UPL); + tf->tf_cs = GSEL(GUCODEBIG_SEL, SEL_UPL); } /* Index: src/sys/arch/i386/i386/svr4_machdep.c diff -u src/sys/arch/i386/i386/svr4_machdep.c:1.95 src/sys/arch/i386/i386/svr4_machdep.c:1.96 --- src/sys/arch/i386/i386/svr4_machdep.c:1.95 Thu Dec 10 14:13:50 2009 +++ src/sys/arch/i386/i386/svr4_machdep.c Sun Feb 14 11:09:54 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: svr4_machdep.c,v 1.95 2009/12/10 14:13:50 matt Exp $ */ +/* $NetBSD: svr4_machdep.c,v 1.96 2010/02/14 11:09:54 drochner Exp $ */ /*- * Copyright (c) 1994, 2000 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: svr4_machdep.c,v 1.95 2009/12/10 14:13:50 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: svr4_machdep.c,v 1.96 2010/02/14 11:09:54 drochner Exp $"); #if defined(_KERNEL_OPT) #include "opt_vm86.h" @@ -119,7 +119,7 @@ pcb->pcb_savefpu.sv_xmm.sv_env.en_cw = __SVR4_NPXCW__; else pcb->pcb_savefpu.sv_87.sv_env.en_cw = __SVR4_NPXCW__; - tf->tf_cs = GSEL(LUCODEBIG_SEL, SEL_UPL); + tf->tf_cs = GSEL(GUCODEBIG_SEL, SEL_UPL); } void *