Skip to content

Commit 3efa410

Browse files
committed
refactor: import inside the x86_64 module
1 parent af206af commit 3efa410

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

src/registers/control.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
33
pub use super::model_specific::{Efer, EferFlags};
44
use bitflags::bitflags;
5-
#[cfg(feature = "inline_asm")]
6-
use core::arch::asm;
75

86
/// Various control flags modifying the basic operation of the CPU.
97
#[derive(Debug)]
@@ -163,6 +161,8 @@ bitflags! {
163161
mod x86_64 {
164162
use super::*;
165163
use crate::{instructions::tlb::Pcid, structures::paging::PhysFrame, PhysAddr, VirtAddr};
164+
#[cfg(feature = "inline_asm")]
165+
use core::arch::asm;
166166

167167
impl Cr0 {
168168
/// Read the current set of CR0 flags.

src/registers/model_specific.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ use bitflags::bitflags;
44
// imports for intra doc links
55
#[cfg(doc)]
66
use crate::registers::segmentation::{FS, GS};
7-
#[cfg(feature = "inline_asm")]
8-
use core::arch::asm;
97

108
/// A model specific register.
119
#[derive(Debug)]
@@ -129,6 +127,8 @@ mod x86_64 {
129127
control::Cr4Flags,
130128
segmentation::{Segment, Segment64, CS, SS},
131129
};
130+
#[cfg(feature = "inline_asm")]
131+
use core::arch::asm;
132132

133133
impl Msr {
134134
/// Read 64 bits msr register.

src/registers/rflags.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
#[cfg(feature = "instructions")]
44
pub use self::x86_64::*;
55

6-
#[cfg(feature = "inline_asm")]
7-
use core::arch::asm;
8-
96
use bitflags::bitflags;
107

118
bitflags! {
@@ -68,6 +65,8 @@ bitflags! {
6865
#[cfg(feature = "instructions")]
6966
mod x86_64 {
7067
use super::*;
68+
#[cfg(feature = "inline_asm")]
69+
use core::arch::asm;
7170

7271
/// Returns the current value of the RFLAGS register.
7372
///

src/registers/xcontrol.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
//! Access to various extended system registers
22
use bitflags::bitflags;
33

4-
#[cfg(feature = "inline_asm")]
5-
use core::arch::asm;
6-
74
/// Extended feature enable mask register
85
#[derive(Debug)]
96
pub struct XCr0;
@@ -57,6 +54,9 @@ bitflags! {
5754
#[cfg(feature = "instructions")]
5855
mod x86_64 {
5956
use super::*;
57+
#[cfg(feature = "inline_asm")]
58+
use core::arch::asm;
59+
6060
impl XCr0 {
6161
/// Read the current set of XCR0 flags.
6262
#[inline]

0 commit comments

Comments
 (0)