11//! Types for the Global Descriptor Table and segment selectors.
22
3+ use crate :: structures:: tss:: InvalidIoMap ;
34use crate :: structures:: { tss:: TaskStateSegment , DescriptorTablePointer } ;
45use crate :: PrivilegeLevel ;
56use bit_field:: BitField ;
67use bitflags:: bitflags;
78use 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 ;
0 commit comments