Skip to content

Commit

Permalink
Rename FSBase/GSBase to FsBase/GsBase
Browse files Browse the repository at this point in the history
to better fit the naming conventions of this crate.
  • Loading branch information
phil-opp committed Aug 12, 2019
1 parent 5b0d914 commit f77d7ed
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/instructions/segmentation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub unsafe fn load_gs(sel: SegmentSelector) {
asm!("movw $0, %gs " :: "r" (sel.0) : "memory");
}

/// Swap `KernelGSBase` MSR and `GSBase` MSR.
/// Swap `KernelGsBase` MSR and `GsBase` MSR.
#[inline]
pub unsafe fn swap_gs() {
asm!("swapgs" ::: "memory" : "volatile");
Expand Down
28 changes: 14 additions & 14 deletions src/registers/model_specific.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,32 @@ pub struct Efer;

/// FS.Base Model Specific Register.
#[derive(Debug)]
pub struct FSBase;
pub struct FsBase;

/// GS.Base Model Specific Register.
#[derive(Debug)]
pub struct GSBase;
pub struct GsBase;

/// KernelGSBase Model Specific Register.
/// KernelGsBase Model Specific Register.
#[derive(Debug)]
pub struct KernelGSBase;
pub struct KernelGsBase;

impl Efer {
/// The underlying model specific register.
pub const MSR: Msr = Msr(0xC0000080);
}

impl FSBase {
impl FsBase {
/// The underlying model specific register.
pub const MSR: Msr = Msr(0xC000_0100);
}

impl GSBase {
impl GsBase {
/// The underlying model specific register.
pub const MSR: Msr = Msr(0xC000_0101);
}

impl KernelGSBase {
impl KernelGsBase {
/// The underlying model specific register.
pub const MSR: Msr = Msr(0xC000_0102);
}
Expand Down Expand Up @@ -137,8 +137,8 @@ mod x86_64 {
}
}

impl FSBase {
/// Read the current FSBase register.
impl FsBase {
/// Read the current FsBase register.
pub fn read() -> VirtAddr {
VirtAddr::new(unsafe { Self::MSR.read() })
}
Expand All @@ -149,8 +149,8 @@ mod x86_64 {
}
}

impl GSBase {
/// Read the current GSBase register.
impl GsBase {
/// Read the current GsBase register.
pub fn read() -> VirtAddr {
VirtAddr::new(unsafe { Self::MSR.read() })
}
Expand All @@ -161,13 +161,13 @@ mod x86_64 {
}
}

impl KernelGSBase {
/// Read the current KernelGSBase register.
impl KernelGsBase {
/// Read the current KernelGsBase register.
pub fn read() -> VirtAddr {
VirtAddr::new(unsafe { Self::MSR.read() })
}

/// Write a given virtual address to the KernelGSBase register.
/// Write a given virtual address to the KernelGsBase register.
pub fn write(address: VirtAddr) {
unsafe { Self::MSR.write(address.as_u64()) };
}
Expand Down

0 comments on commit f77d7ed

Please sign in to comment.