aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Gerd Zellweger <mail@gerdzellweger.com> 2018-04-26 14:24:12 -0700
committerGravatar Gerd Zellweger <mail@gerdzellweger.com> 2018-04-26 14:24:12 -0700
commit848ec0fae090dbc1657d02b436b8b887df519e90 (patch)
tree9d289473fde6fe1b45a376d10a16944b33ad7de9
parent19843c0bcfb7a5d80720ba82524d40b3d69ace4e (diff)
downloadrust-x86-848ec0fae090dbc1657d02b436b8b887df519e90.tar.gz
rust-x86-848ec0fae090dbc1657d02b436b8b887df519e90.tar.zst
rust-x86-848ec0fae090dbc1657d02b436b8b887df519e90.zip
Rename types Descriptor{arch} to Descriptor.
Signed-off-by: Gerd Zellweger <mail@gerdzellweger.com>
-rw-r--r--src/bits16/segmentation.rs2
-rw-r--r--src/bits32/dtables.rs8
-rw-r--r--src/bits32/segmentation.rs10
-rw-r--r--src/bits64/dtables.rs8
-rw-r--r--src/bits64/rflags.rs2
-rw-r--r--src/bits64/segmentation.rs13
6 files changed, 21 insertions, 22 deletions
diff --git a/src/bits16/segmentation.rs b/src/bits16/segmentation.rs
index 5dc74fc..4e95a1d 100644
--- a/src/bits16/segmentation.rs
+++ b/src/bits16/segmentation.rs
@@ -5,7 +5,7 @@ impl GateDescriptorBuilder<u16> for DescriptorBuilder {
fn tss_descriptor(selector: SegmentSelector, offset: u16, available: bool) -> DescriptorBuilder {
let typ = match available {
true => DescriptorType::System32(SystemDescriptorTypes32::TSSAvailable16),
- false => DescriptorType::System32(SystemDescriptorTypes32::TssBusy16),
+ false => DescriptorType::System32(SystemDescriptorTypes32::TSSBusy16),
};
DescriptorBuilder::with_selector_offset(selector, offset.into()).set_type(typ)
diff --git a/src/bits32/dtables.rs b/src/bits32/dtables.rs
index 2be3be3..51596f8 100644
--- a/src/bits32/dtables.rs
+++ b/src/bits32/dtables.rs
@@ -1,19 +1,19 @@
//! Functions to load descriptor tables.
use dtables::DescriptorTablePointer;
-use bits32::segmentation::Descriptor32;
+use bits32::segmentation::Descriptor;
/// Load GDT table with 32bit descriptors
-pub unsafe fn lgdt(gdt: &DescriptorTablePointer<Descriptor32>) {
+pub unsafe fn lgdt(gdt: &DescriptorTablePointer<Descriptor>) {
asm!("lgdt ($0)" :: "r" (gdt) : "memory");
}
/// Load LDT table with 32bit descriptors.
-pub unsafe fn lldt(ldt: &DescriptorTablePointer<Descriptor32>) {
+pub unsafe fn lldt(ldt: &DescriptorTablePointer<Descriptor>) {
asm!("lldt ($0)" :: "r" (ldt) : "memory");
}
/// Load IDT table with 32bit descriptors.
-pub unsafe fn lidt(idt: &DescriptorTablePointer<Descriptor32>) {
+pub unsafe fn lidt(idt: &DescriptorTablePointer<Descriptor>) {
asm!("lidt ($0)" :: "r" (idt) : "memory");
}
diff --git a/src/bits32/segmentation.rs b/src/bits32/segmentation.rs
index d75f4d8..dc6da52 100644
--- a/src/bits32/segmentation.rs
+++ b/src/bits32/segmentation.rs
@@ -8,12 +8,12 @@ use ::Ring;
/// See Intel 3a, Section 3.4.5 "Segment Descriptors", and Section 3.5.2
#[derive(Copy, Clone, Debug, Default)]
#[repr(C, packed)]
-pub struct Descriptor32 {
+pub struct Descriptor {
pub lower: u32,
pub upper: u32,
}
-impl Descriptor32 {
+impl Descriptor {
pub(crate) fn apply_builder_settings(&mut self, builder: &DescriptorBuilder) {
builder.dpl.map(|ring| self.set_dpl(ring));
@@ -172,9 +172,9 @@ impl LdtDescriptorBuilder<u32> for DescriptorBuilder {
}
}
-impl BuildDescriptor<Descriptor32> for DescriptorBuilder {
- fn finish(&self) -> Descriptor32 {
- let mut desc: Descriptor32 = Default::default();
+impl BuildDescriptor<Descriptor> for DescriptorBuilder {
+ fn finish(&self) -> Descriptor {
+ let mut desc: Descriptor = Default::default();
desc.apply_builder_settings(self);
let typ = match self.typ {
diff --git a/src/bits64/dtables.rs b/src/bits64/dtables.rs
index 2bc06c8..00fad0f 100644
--- a/src/bits64/dtables.rs
+++ b/src/bits64/dtables.rs
@@ -1,18 +1,18 @@
//! Functions to load descriptor tables.
use dtables::DescriptorTablePointer;
-use bits64::segmentation::Descriptor64;
+use bits64::segmentation::Descriptor;
/// Load GDT table with 64-bits descriptors.
-pub unsafe fn lgdt(gdt: &DescriptorTablePointer<Descriptor64>) {
+pub unsafe fn lgdt(gdt: &DescriptorTablePointer<Descriptor>) {
asm!("lgdt ($0)" :: "r" (gdt) : "memory");
}
/// Load LDT table with 64-bits descriptors.
-pub unsafe fn lldt(ldt: &DescriptorTablePointer<Descriptor64>) {
+pub unsafe fn lldt(ldt: &DescriptorTablePointer<Descriptor>) {
asm!("lldt ($0)" :: "r" (ldt) : "memory");
}
/// Load IDT table with 64-bits descriptors.
-pub unsafe fn lidt(idt: &DescriptorTablePointer<Descriptor64>) {
+pub unsafe fn lidt(idt: &DescriptorTablePointer<Descriptor>) {
asm!("lidt ($0)" :: "r" (idt) : "memory");
}
diff --git a/src/bits64/rflags.rs b/src/bits64/rflags.rs
index 6301420..e6dae17 100644
--- a/src/bits64/rflags.rs
+++ b/src/bits64/rflags.rs
@@ -68,7 +68,7 @@ impl RFlags {
}
#[cfg(target_arch="x86-64")]
-pub unsafe fn flags() -> RFlags {
+pub unsafe fn read() -> RFlags {
let r: u64;
asm!("pushfq; popq $0" : "=r"(r) :: "memory");
RFlags::from_bits_truncate(r)
diff --git a/src/bits64/segmentation.rs b/src/bits64/segmentation.rs
index 8bcd8cf..058bead 100644
--- a/src/bits64/segmentation.rs
+++ b/src/bits64/segmentation.rs
@@ -1,7 +1,7 @@
#[allow(unused_imports)]
use segmentation::{SegmentSelector};
use segmentation::{DescriptorBuilder, BuildDescriptor, DescriptorType, GateDescriptorBuilder, SegmentDescriptorBuilder, LdtDescriptorBuilder, CodeSegmentType, DataSegmentType, SystemDescriptorTypes64};
-use bits32::segmentation::{Descriptor32};
+use bits32::segmentation::Descriptor as Descriptor32;
/// Entry for IDT, GDT or LDT.
///
@@ -9,13 +9,13 @@ use bits32::segmentation::{Descriptor32};
/// "Segment Descriptor Tables in IA-32e Mode", especially Figure 3-8.
#[derive(Copy, Clone, Debug, Default)]
#[repr(C, packed)]
-pub struct Descriptor64 {
+pub struct Descriptor {
desc32: Descriptor32,
lower: u32,
upper: u32
}
-impl Descriptor64 {
+impl Descriptor {
pub(crate) fn apply_builder_settings(&mut self, builder: &DescriptorBuilder) {
self.desc32.apply_builder_settings(builder);
@@ -87,9 +87,9 @@ impl LdtDescriptorBuilder<u64> for DescriptorBuilder {
}
}
-impl BuildDescriptor<Descriptor64> for DescriptorBuilder {
- fn finish(&self) -> Descriptor64 {
- let mut desc: Descriptor64 = Default::default();
+impl BuildDescriptor<Descriptor> for DescriptorBuilder {
+ fn finish(&self) -> Descriptor {
+ let mut desc: Descriptor = Default::default();
desc.apply_builder_settings(self);
desc.desc32.set_l(); // 64-bit descriptor
@@ -97,7 +97,6 @@ impl BuildDescriptor<Descriptor64> for DescriptorBuilder {
Some(DescriptorType::System64(typ)) => {
if typ == SystemDescriptorTypes64::LDT || typ == SystemDescriptorTypes64::TssAvailable || typ == SystemDescriptorTypes64::TssBusy {
assert!(!self.db);
- assert!(!self.db);
}
typ as u8
},