@@ -19,7 +19,7 @@ pub struct FullSegmentSelector {
1919}
2020
2121/// A segment descriptor.
22- #[ bitfield]
22+ #[ bitfield( bits = 64 ) ]
2323#[ derive( Debug , Clone , Copy ) ]
2424#[ repr( u64 ) ]
2525pub struct SegmentDescriptor {
@@ -41,7 +41,7 @@ pub struct Gdt {
4141}
4242
4343/// The basic, visible part of a segment selector.
44- #[ bitfield]
44+ #[ bitfield( bits = 16 ) ]
4545#[ derive( Debug , Clone , Copy , Default ) ]
4646#[ repr( u16 ) ]
4747pub struct SegmentSelector {
@@ -130,24 +130,30 @@ impl SegmentDescriptor {
130130 const ACCESS_DPL_1 : u8 = 0b01 << 5 ;
131131 const ACCESS_P : u8 = 1 << 7 ; // present
132132
133- const _FLAGS_RESERVED: u8 = 1 << ( 4 + 0 ) ;
133+ const _FLAGS_RESERVED: u8 = 1 << 4 ;
134134 const FLAGS_G : u8 = 1 << ( 4 + 1 ) ; // granuality
135135 const FLAGS_DB : u8 = 1 << ( 4 + 2 ) ; // size. 0-> 16 bit protected mode 1-> 32 bit protected
136136 const FLAGS_L : u8 = 1 << ( 4 + 3 ) ; // segment is 64 long mode. when set, DB shouldn't be
137137
138138 #[ inline]
139- fn get_base ( & self ) -> u32 {
139+ fn get_base ( self ) -> u32 {
140140 ( u32:: from ( self . base_1 ( ) ) << 24 ) | u32:: from ( self . base_0 ( ) )
141141 }
142142
143143 // TODO: Make this function const
144144 /// NOTE: The size of the limit is actually 20 bits, not 32
145145 #[ inline]
146- fn get_limit ( & self ) -> u32 {
146+ fn get_limit ( self ) -> u32 {
147147 ( u32:: from ( self . limit_1 ( ) ) << 16 ) | u32:: from ( self . limit_0 ( ) )
148148 }
149149}
150150
151+ impl Default for SegmentDescriptor {
152+ fn default ( ) -> Self {
153+ Self :: new ( )
154+ }
155+ }
156+
151157impl Register for Cs {
152158 #[ inline]
153159 unsafe fn read ( ) -> Self {
0 commit comments