Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove deprecated from_bits_unchecked functions #449

Merged
merged 1 commit into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions src/registers/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,6 @@
}
}

impl Cr0Flags {
#[deprecated = "use the safe `from_bits_retain` method instead"]
/// Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
pub const unsafe fn from_bits_unchecked(bits: u64) -> Self {
Self::from_bits_retain(bits)
}
}

/// Contains the Page Fault Linear Address (PFLA).
///
/// When a page fault occurs, the CPU sets this register to the faulting virtual address.
Expand All @@ -82,14 +74,6 @@
}
}

impl Cr3Flags {
#[deprecated = "use the safe `from_bits_retain` method instead"]
/// Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
pub const unsafe fn from_bits_unchecked(bits: u64) -> Self {
Self::from_bits_retain(bits)
}
}

/// Contains various control flags that enable architectural extensions, and
/// indicate support for specific processor capabilities.
#[derive(Debug)]
Expand Down Expand Up @@ -175,14 +159,6 @@
}
}

impl Cr4Flags {
#[deprecated = "use the safe `from_bits_retain` method instead"]
/// Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
pub const unsafe fn from_bits_unchecked(bits: u64) -> Self {
Self::from_bits_retain(bits)
}
}

#[cfg(feature = "instructions")]
mod x86_64 {
use super::*;
Expand Down Expand Up @@ -320,7 +296,7 @@
#[inline]
pub fn read_pcid() -> (PhysFrame, Pcid) {
let (frame, value) = Cr3::read_raw();
(frame, Pcid::new(value as u16).unwrap())

Check warning on line 299 in src/registers/control.rs

View workflow job for this annotation

GitHub Actions / Clippy

casting to the same type is unnecessary (`u16` -> `u16`)
}

/// Write a new P4 table address into the CR3 register.
Expand Down
12 changes: 0 additions & 12 deletions src/registers/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,6 @@ impl Dr6Flags {
DebugAddressRegisterNumber::Dr3 => Self::TRAP3,
}
}

#[deprecated = "use the safe `from_bits_retain` method instead"]
/// Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
pub const unsafe fn from_bits_unchecked(bits: u64) -> Self {
Self::from_bits_retain(bits)
}
}

bitflags! {
Expand Down Expand Up @@ -239,12 +233,6 @@ impl Dr7Flags {
DebugAddressRegisterNumber::Dr3 => Self::GLOBAL_BREAKPOINT_3_ENABLE,
}
}

#[deprecated = "use the safe `from_bits_retain` method instead"]
/// Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
pub const unsafe fn from_bits_unchecked(bits: u64) -> Self {
Self::from_bits_retain(bits)
}
}

/// The condition for a hardware breakpoint.
Expand Down
16 changes: 0 additions & 16 deletions src/registers/model_specific.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

/// A model specific register.
#[derive(Debug)]
pub struct Msr(u32);

Check warning on line 10 in src/registers/model_specific.rs

View workflow job for this annotation

GitHub Actions / Test MSRV and Stable Features (nightly)

field `0` is never read

Check warning on line 10 in src/registers/model_specific.rs

View workflow job for this annotation

GitHub Actions / Test MSRV and Stable Features (nightly)

field `0` is never read

Check warning on line 10 in src/registers/model_specific.rs

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest)

field `0` is never read

Check warning on line 10 in src/registers/model_specific.rs

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest)

field `0` is never read

Check warning on line 10 in src/registers/model_specific.rs

View workflow job for this annotation

GitHub Actions / Test (windows-latest)

field `0` is never read

Check warning on line 10 in src/registers/model_specific.rs

View workflow job for this annotation

GitHub Actions / Test (windows-latest)

field `0` is never read

Check warning on line 10 in src/registers/model_specific.rs

View workflow job for this annotation

GitHub Actions / Test (macos-latest)

field `0` is never read

Check warning on line 10 in src/registers/model_specific.rs

View workflow job for this annotation

GitHub Actions / Test (macos-latest)

field `0` is never read

impl Msr {
/// Create an instance from a register.
Expand Down Expand Up @@ -132,14 +132,6 @@
}
}

impl EferFlags {
#[deprecated = "use the safe `from_bits_retain` method instead"]
/// Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
pub const unsafe fn from_bits_unchecked(bits: u64) -> Self {
Self::from_bits_retain(bits)
}
}

bitflags! {
/// Flags stored in IA32_U_CET and IA32_S_CET (Table-2-2 in Intel SDM Volume
/// 4). The Intel SDM-equivalent names are described in parentheses.
Expand All @@ -165,14 +157,6 @@
}
}

impl CetFlags {
#[deprecated = "use the safe `from_bits_retain` method instead"]
/// Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
pub const unsafe fn from_bits_unchecked(bits: u64) -> Self {
Self::from_bits_retain(bits)
}
}

#[cfg(feature = "instructions")]
mod x86_64 {
use super::*;
Expand Down
8 changes: 0 additions & 8 deletions src/registers/mxcsr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,6 @@ impl Default for MxCsr {
}
}

impl MxCsr {
#[deprecated = "use the safe `from_bits_retain` method instead"]
/// Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
pub const unsafe fn from_bits_unchecked(bits: u32) -> Self {
Self::from_bits_retain(bits)
}
}

#[cfg(feature = "instructions")]
mod x86_64 {
use super::*;
Expand Down
8 changes: 0 additions & 8 deletions src/registers/rflags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,6 @@ bitflags! {
}
}

impl RFlags {
#[deprecated = "use the safe `from_bits_retain` method instead"]
/// Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
pub const unsafe fn from_bits_unchecked(bits: u64) -> Self {
Self::from_bits_retain(bits)
}
}

#[cfg(feature = "instructions")]
mod x86_64 {
use super::*;
Expand Down
8 changes: 0 additions & 8 deletions src/registers/xcontrol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,6 @@ bitflags! {
}
}

impl XCr0Flags {
#[deprecated = "use the safe `from_bits_retain` method instead"]
/// Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
pub const unsafe fn from_bits_unchecked(bits: u64) -> Self {
Self::from_bits_retain(bits)
}
}

#[cfg(feature = "instructions")]
mod x86_64 {
use super::*;
Expand Down
6 changes: 0 additions & 6 deletions src/structures/gdt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,6 @@ impl DescriptorFlags {
/// A 64-bit user code segment
pub const USER_CODE64: Self =
Self::from_bits_truncate(Self::KERNEL_CODE64.bits() | Self::DPL_RING_3.bits());

#[deprecated = "use the safe `from_bits_retain` method instead"]
/// Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
pub const unsafe fn from_bits_unchecked(bits: u64) -> Self {
Self::from_bits_retain(bits)
}
}

impl Descriptor {
Expand Down
8 changes: 0 additions & 8 deletions src/structures/idt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@

/// An Interrupt Descriptor Table entry.
///
/// The generic parameter is some [`InterruptFn`], depending on the interrupt vector.

Check warning on line 674 in src/structures/idt.rs

View workflow job for this annotation

GitHub Actions / Test MSRV and Stable Features (nightly)

unresolved link to `InterruptFn`

Check warning on line 674 in src/structures/idt.rs

View workflow job for this annotation

GitHub Actions / Test MSRV and Stable Features (nightly)

unresolved link to `InterruptFn`

Check warning on line 674 in src/structures/idt.rs

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest)

unresolved link to `InterruptFn`

Check warning on line 674 in src/structures/idt.rs

View workflow job for this annotation

GitHub Actions / Test (windows-latest)

unresolved link to `InterruptFn`

Check warning on line 674 in src/structures/idt.rs

View workflow job for this annotation

GitHub Actions / Test MSRV and Stable Features (1.59)

unresolved link to `InterruptFn`

Check warning on line 674 in src/structures/idt.rs

View workflow job for this annotation

GitHub Actions / Test MSRV and Stable Features (1.59)

unresolved link to `InterruptFn`

Check warning on line 674 in src/structures/idt.rs

View workflow job for this annotation

GitHub Actions / Test (macos-latest)

unresolved link to `InterruptFn`
#[derive(Clone, Copy)]
#[repr(C)]
pub struct Entry<F> {
Expand Down Expand Up @@ -1115,14 +1115,6 @@
}
}

impl PageFaultErrorCode {
#[deprecated = "use the safe `from_bits_retain` method instead"]
/// Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
pub const unsafe fn from_bits_unchecked(bits: u64) -> Self {
Self::from_bits_retain(bits)
}
}

/// Describes an error code referencing a segment selector.
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
#[repr(transparent)]
Expand Down
8 changes: 0 additions & 8 deletions src/structures/paging/page_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,6 @@ bitflags! {
}
}

impl PageTableFlags {
#[deprecated = "use the safe `from_bits_retain` method instead"]
/// Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
pub const unsafe fn from_bits_unchecked(bits: u64) -> Self {
Self::from_bits_retain(bits)
}
}

/// The number of entries in a page table.
const ENTRY_COUNT: usize = 512;

Expand Down
Loading