NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/59492: getstarttsc is unconditionally called, which invokes pentium+-only rdtsc instruction
>Number: 59492
>Category: kern
>Synopsis: getstarttsc is unconditionally called, which invokes pentium+-only rdtsc instruction
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: unknown
>Arrival-Date: Sun Jun 29 14:05:00 +0000 2025
>Originator: ltning-netbsd%anduin.net@localhost
>Release: NetBSD 10.99.14, 142944465ef00e308ba3bebe6a7485e9f7e649af
>Environment:
System: NetBSD larry.weirdr.net 10.99.14 NetBSD 10.99.14 (486BEAST) #1: Sun Jun 29 15:16:37 CEST 2025 ltning@motherfucker:/usr/home/ltning/github/NetBSD_clean/obj_i386/sys/arch/i386/compile/486BEAST i386
Architecture: i386
Machine: i386
>Description:
Recent changes to sys/arch/i386/i386/locore.S breaks booting on i486. The new getstarttsc macro and the BOOT_DURATION option invokes the rdtsc instruction which only exists on Pentium and newer.
>How-To-Repeat:
Build and boot ~any kernel on an i486-class machine.
>Fix:
Suggested fix by mlelstv (IRC) is to add a condition to the getstarttsc invocation. See below patch. Confirmed working on this machine (AMD Am486).
index d5ab1e54d92a..3c25d35504b5 100644
--- a/sys/arch/i386/i386/locore.S
+++ b/sys/arch/i386/i386/locore.S
@@ -356,7 +356,9 @@ END(tmpgdt)
ENTRY(start)
#ifndef XENPV
+#ifdef BOOT_DURATION
getstarttsc
+#endif
/* Warm boot */
movw $0x1234,0x472
@@ -1208,7 +1210,10 @@ END(start)
#ifndef XENPV
/* entry point for Xen PVH */
ENTRY(start_pvh)
+
+#ifdef BOOT_DURATION
getstarttsc
+#endif
/* Xen doesn't start us with a valid gdt */
movl $RELOC(gdtdesc_xenpvh), %eax
lgdt (%eax)
Home |
Main Index |
Thread Index |
Old Index