Skip to content

Re-add Support for Rust <=1.93 Toolchains With Unsafe CPUID Instrinsics#84

Merged
Javagedes merged 1 commit intoOpenDevicePartnership:mainfrom
kouchekiniad:unsafe-cpuid-support
Apr 1, 2026
Merged

Re-add Support for Rust <=1.93 Toolchains With Unsafe CPUID Instrinsics#84
Javagedes merged 1 commit intoOpenDevicePartnership:mainfrom
kouchekiniad:unsafe-cpuid-support

Conversation

@kouchekiniad
Copy link
Copy Markdown
Contributor

@kouchekiniad kouchekiniad commented Mar 23, 2026

Description

This change adds unsafe { } wrappers around the __cpuid and __cpuid_count intrinsics, adding back support for Rust <= 1.93 toolchains where these are considered unsafe calls. To prevent warnings about these wrappers being unnecessary on Rust >= 1.94 (or >= nightly-2025-12-27) toolchains, this change additionally adds #[allow(unused_unsafe)] declarations to the wrappers.

  • Impacts functionality?
  • Impacts security?
  • Breaking change?
  • Includes tests?
  • Includes documentation?

How This Was Tested

Built Patina and Patina-MTRR; Ran tests with nightly and non-nightly toolchains.

Integration Instructions

n/a

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@kouchekiniad kouchekiniad force-pushed the unsafe-cpuid-support branch from 9ace3af to 0b1e959 Compare March 23, 2026 21:52
@os-d os-d requested review from Javagedes, cfernald and vineelko March 24, 2026 17:01
Comment thread src/hal.rs
Comment thread src/hal.rs
Copy link
Copy Markdown
Collaborator

@makubacki makubacki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kouchekiniad, please add specific versions in the commit/PR message. It will be easier to understand now, but particularly in the future with versions explicitly stated.

@kouchekiniad kouchekiniad force-pushed the unsafe-cpuid-support branch from 0b1e959 to 3eda0ec Compare April 1, 2026 18:08
@kouchekiniad kouchekiniad changed the title Re-add Support for Toolchains With Unsafe CPUID Instrinsics Re-add Support for Rust <= 1.93 Toolchains With Unsafe CPUID Instrinsics Apr 1, 2026
@kouchekiniad kouchekiniad force-pushed the unsafe-cpuid-support branch from 3eda0ec to f8cd0c9 Compare April 1, 2026 18:17
@kouchekiniad kouchekiniad changed the title Re-add Support for Rust <= 1.93 Toolchains With Unsafe CPUID Instrinsics Re-add Support for Rust <=1.93 Toolchains With Unsafe CPUID Instrinsics Apr 1, 2026
This change adds unsafe wrappers with `#[allow(unused_unsafe)]` around calls to __cpuid and __cpuid_count
to simultaneously support Rust <= 1.93 toolchains that consider __cpuid unsafe and Rust >= 1.94
(or >= nightly-2025-12-27) toolchains that consider __cpuid safe.
@Javagedes Javagedes force-pushed the unsafe-cpuid-support branch from f8cd0c9 to 180bf84 Compare April 1, 2026 18:22
@Javagedes Javagedes enabled auto-merge (squash) April 1, 2026 18:24
@Javagedes Javagedes merged commit f8c4ef0 into OpenDevicePartnership:main Apr 1, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants