Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/i386/i386 PR #32894: protection fault trap in tmx86...



details:   https://anonhg.NetBSD.org/src/rev/185b1d7a80a2
branches:  trunk
changeset: 770564:185b1d7a80a2
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Oct 23 13:02:32 2011 +0000

description:
PR #32894: protection fault trap in tmx86_get_longrun_mode

Use rdmsr_safe in tmx86_init_longrun to verify that the MSRs are present.

diffstat:

 sys/arch/i386/i386/longrun.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r 62fdd3d75412 -r 185b1d7a80a2 sys/arch/i386/i386/longrun.c
--- a/sys/arch/i386/i386/longrun.c      Sun Oct 23 08:42:06 2011 +0000
+++ b/sys/arch/i386/i386/longrun.c      Sun Oct 23 13:02:32 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: longrun.c,v 1.3 2008/02/27 20:18:56 xtraeme Exp $      */
+/*     $NetBSD: longrun.c,v 1.4 2011/10/23 13:02:32 jmcneill Exp $     */
 
 /*-
  * Copyright (c) 2001 Tamotsu Hattori.
@@ -35,7 +35,7 @@
  *
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: longrun.c,v 1.3 2008/02/27 20:18:56 xtraeme Exp $");
+__KERNEL_RCSID(0, "$NetBSD: longrun.c,v 1.4 2011/10/23 13:02:32 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -92,6 +92,11 @@
 tmx86_init_longrun(void)
 {
        const struct sysctlnode *mnode;
+       uint64_t msr;
+
+       /* PR #32894, make sure the longrun MSR is present */
+       if (rdmsr_safe(MSR_TMx86_LONGRUN, &msr) == EFAULT)
+               return;
 
        /* create the sysctl machdep.tm_longrun_* nodes */
         sysctl_createv(NULL, 0, NULL, &mnode, CTLFLAG_PERMANENT,



Home | Main Index | Thread Index | Old Index