Page MenuHomeFreeBSD

wrmsr_early_safe(9)
ClosedPublic

Authored by kib on Sep 18 2025, 10:02 PM.
Tags
None
Referenced Files
F150441176: D52607.id162554.diff
Wed, Apr 1, 6:02 AM
F150435111: D52607.id162380.diff
Wed, Apr 1, 5:13 AM
F150432939: D52607.id162380.diff
Wed, Apr 1, 4:56 AM
F150400561: D52607.id162380.diff
Tue, Mar 31, 9:53 PM
Unknown Object (File)
Sun, Mar 29, 1:07 AM
Unknown Object (File)
Sat, Mar 28, 3:47 AM
Unknown Object (File)
Fri, Mar 27, 9:14 PM
Unknown Object (File)
Tue, Mar 24, 7:24 PM
Subscribers

Details

Summary

The variant of wrmsr_safe(9) that might work before IDT and curpcb are initialized. Assumes BSP, and that all APs are parked.

Before calling wrmsr_early_safe(), the wrmsr_early_safe_start() should be called, afterward wrmsr_early_safe_end() restores the #gp IDT slot.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

I have created a patch D52643 on top of this one. We have successfully tested it. At boot this message is observed:

Copyright (c) 1992-2025 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 15.0-PRERELEASE NCD-9043-AMD-microcode-kib-n7648-9bbf40e9a419 RED1 amd64
FreeBSD clang version 19.1.7 (https://github.com/llvm/llvm-project.git llvmorg-19.1.7-0-gcd708029e0b2)
VT(efifb): resolution 800x600
CPU microcode: load failed. BIOS updated advised
CPU: AMD EPYC 8124P 16-Core Processor                (2450.12-MHz K8-class CPU)
  Origin="AuthenticAMD"  Id=0xaa0f02  Family=0x19  Model=0xa0  Stepping=2

I'm not sure our patches are going to compile on i386. IMHO, we need this to make a priority for 15.0-RELEASE.

kib edited the summary of this revision. (Show Details)

Re-use idt0 for early IDT, removing restriction that the boot is UEFI. Now early_safe() should work regardless of the boot method.

This revision is now accepted and ready to land.Sep 24 2025, 12:38 PM