Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/arch/x86/x86 Apply patch, requested by msaitoh in tic...



details:   https://anonhg.NetBSD.org/src/rev/cd45627b3e99
branches:  netbsd-9
changeset: 964039:cd45627b3e99
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Aug 02 07:33:38 2020 +0000

description:
Apply patch, requested by msaitoh in ticket #1031:

        sys/arch/x86/x86/cpu.c                  patch

Fix a panic on a CPU which has no rdtsc instruction. This bug was
added in ticket #1015.

diffstat:

 sys/arch/x86/x86/cpu.c |  25 +++++++++++++------------
 1 files changed, 13 insertions(+), 12 deletions(-)

diffs (48 lines):

diff -r f1067fd2031f -r cd45627b3e99 sys/arch/x86/x86/cpu.c
--- a/sys/arch/x86/x86/cpu.c    Sun Jul 26 11:09:19 2020 +0000
+++ b/sys/arch/x86/x86/cpu.c    Sun Aug 02 07:33:38 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.171.2.2 2020/07/15 17:25:08 martin Exp $     */
+/*     $NetBSD: cpu.c,v 1.171.2.3 2020/08/02 07:33:38 martin Exp $     */
 
 /*
  * Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.171.2.2 2020/07/15 17:25:08 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.171.2.3 2020/08/02 07:33:38 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"                /* for MPDEBUG */
@@ -1267,18 +1267,19 @@
 {
        uint64_t freq = 0, last_tsc;
 
-       if (cpu_hascounter())
+       if (cpu_hascounter()) {
                freq = cpu_tsc_freq_cpuid(ci);
 
-       if (freq != 0) {
-               /* Use TSC frequency taken from CPUID. */
-               ci->ci_data.cpu_cc_freq = freq;
-       } else {
-               /* Calibrate TSC frequency. */
-               last_tsc = cpu_counter_serializing();
-               x86_delay(100000);
-               ci->ci_data.cpu_cc_freq =
-                   (cpu_counter_serializing() - last_tsc) * 10;
+               if (freq != 0) {
+                       /* Use TSC frequency taken from CPUID. */
+                       ci->ci_data.cpu_cc_freq = freq;
+               } else {
+                       /* Calibrate TSC frequency. */
+                       last_tsc = cpu_counter_serializing();
+                       x86_delay(100000);
+                       ci->ci_data.cpu_cc_freq =
+                           (cpu_counter_serializing() - last_tsc) * 10;
+               }
        }
 }
 



Home | Main Index | Thread Index | Old Index