NetBSD Problem Report #59492
From ltning@larry.weirdr.net Sun Jun 29 14:03:01 2025
Return-Path: <ltning@larry.weirdr.net>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits)
client-signature RSA-PSS (2048 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 264721A9239
for <gnats-bugs@gnats.NetBSD.org>; Sun, 29 Jun 2025 14:03:01 +0000 (UTC)
Message-Id: <20250629135245.7D9AC90466@larry.weirdr.net>
Date: Sun, 29 Jun 2025 13:43:15 +0000 (UTC)
From: ltning-netbsd@anduin.net
Reply-To: ltning-netbsd@anduin.net
To: gnats-bugs@NetBSD.org
Subject: getstarttsc is unconditionally called, which invokes pentium+-only rdtsc instruction
X-Send-Pr-Version: 3.95
>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
>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)
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.