File tree Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Original file line number Diff line number Diff line change 11//! Provides a type for the task state segment structure.
22
33use crate :: VirtAddr ;
4- use core:: mem:: size_of;
4+ use core:: {
5+ fmt:: { self , Display } ,
6+ mem:: size_of,
7+ } ;
58
69/// In 64-bit mode the TSS holds information that is not
710/// directly related to the task-switch mechanism,
@@ -83,6 +86,34 @@ pub enum InvalidIoMap {
8386 } ,
8487}
8588
89+ impl Display for InvalidIoMap {
90+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
91+ match * self {
92+ InvalidIoMap :: IoMapBeforeTss => {
93+ write ! ( f, "the IO permissions bitmap is before the TSS" )
94+ }
95+ InvalidIoMap :: TooFarFromTss { distance } => write ! (
96+ f,
97+ "the IO permissions bitmap is too far from the TSS (distance {distance})"
98+ ) ,
99+ InvalidIoMap :: InvalidTerminatingByte { byte } => write ! (
100+ f,
101+ "The final byte of the IO permissions bitmap was not 0xff ({byte}"
102+ ) ,
103+ InvalidIoMap :: TooLong { len } => {
104+ write ! (
105+ f,
106+ "The IO permissions bitmap exceeds the maximum length ({len} > 8193)"
107+ )
108+ }
109+ InvalidIoMap :: InvalidBase { expected, got } => write ! (
110+ f,
111+ "the `iomap_base` in the `TaskStateSegment` struct was not what was expected (expected {expected}, got {got})"
112+ ) ,
113+ }
114+ }
115+ }
116+
86117#[ cfg( test) ]
87118mod tests {
88119 use super :: * ;
You can’t perform that action at this time.
0 commit comments