Skip to content

Commit 25ce9aa

Browse files
committed
fmt (i always forget this...)
1 parent 780a8d6 commit 25ce9aa

File tree

2 files changed

+10
-22
lines changed

2 files changed

+10
-22
lines changed

src/structures/gdt.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
//! Types for the Global Descriptor Table and segment selectors.
22
3+
use crate::structures::tss::InvalidIoMap;
34
use crate::structures::{tss::TaskStateSegment, DescriptorTablePointer};
45
use crate::PrivilegeLevel;
56
use bit_field::BitField;
67
use bitflags::bitflags;
78
use core::{cmp, fmt, mem};
8-
use crate::structures::tss::InvalidIoMap;
99

1010
/// Specifies which element to load into a segment from
1111
/// descriptor tables (i.e., is a index to LDT or GDT table
@@ -317,23 +317,23 @@ impl Descriptor {
317317
iomap: &'static [u8],
318318
) -> Result<Descriptor, InvalidIoMap> {
319319
if iomap.len() > 8193 {
320-
return Err(InvalidIoMap::TooLong { len: iomap.len() })
320+
return Err(InvalidIoMap::TooLong { len: iomap.len() });
321321
}
322322

323323
let base = iomap.as_ptr() as usize - tss as *const _ as usize;
324324
if base > 0xdfff {
325-
return Err(InvalidIoMap::TooFarFromTss { distance: base })
325+
return Err(InvalidIoMap::TooFarFromTss { distance: base });
326326
}
327327

328328
let last_byte = *iomap.last().unwrap_or(&0xff);
329329
if last_byte != 0xff {
330-
return Err(InvalidIoMap::InvalidTerminatingByte { byte: last_byte })
330+
return Err(InvalidIoMap::InvalidTerminatingByte { byte: last_byte });
331331
}
332332

333333
if tss.iomap_base != base as u16 {
334334
return Err(InvalidIoMap::InvalidBase {
335335
expected: base as u16,
336-
got: tss.iomap_base
336+
got: tss.iomap_base,
337337
});
338338
}
339339

@@ -348,10 +348,7 @@ impl Descriptor {
348348
/// There must be a valid IO map at `(tss as *const u8).offset(tss.iomap_base)`
349349
/// of length `iomap_size`, with the terminating `0xFF` byte. Additionally, `iomap_base` must
350350
/// not exceed `0xDFFF`.
351-
unsafe fn tss_segment_raw(
352-
tss: &'static TaskStateSegment,
353-
iomap_size: u16,
354-
) -> Descriptor {
351+
unsafe fn tss_segment_raw(tss: &'static TaskStateSegment, iomap_size: u16) -> Descriptor {
355352
use self::DescriptorFlags as Flags;
356353

357354
let ptr = tss as *const _ as u64;

src/structures/tss.rs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,11 @@ impl TaskStateSegment {
4444
pub enum InvalidIoMap {
4545
/// The IO permissions bitmap is too far from the TSS. It must be within `0xdfff` bytes of the
4646
/// start of the TSS.
47-
TooFarFromTss {
48-
distance: usize,
49-
},
47+
TooFarFromTss { distance: usize },
5048
/// The final byte of the IO permissions bitmap was not 0xff
51-
InvalidTerminatingByte {
52-
byte: u8,
53-
},
49+
InvalidTerminatingByte { byte: u8 },
5450
/// The IO permissions bitmap exceeds the maximum length (8193).
55-
TooLong {
56-
len: usize
57-
},
51+
TooLong { len: usize },
5852
/// The `iomap_base` in the `TaskStateSegment` struct was not what was expected.
59-
InvalidBase {
60-
expected: u16,
61-
got: u16,
62-
}
53+
InvalidBase { expected: u16, got: u16 },
6354
}

0 commit comments

Comments
 (0)