Struct tartan_arch::x86_common::protection::SegmentDescriptor
source · #[repr(C)]pub struct SegmentDescriptor {
pub flags: SegmentDescriptorFlags,
/* private fields */
}
Expand description
An entry in a segment descriptor table that defines a new segment. This includes code, data, task state (TSS), and local descriptor table (LDT) segments.
Notes on the size of this structure:
- In 32-bit mode, this structure is always 8 bytes and contains a 32-bit base address.
- In 64-bit mode:
- Task state and local descriptor table segment descriptors are expanded to 16 bytes with 64-bit base addresses.
- From the processor’s perspective, code and data segments remain 8 bytes and the address and limit are both ignored. However, this structure is still defined as 16 bytes. This is fine, since the first 8 bytes are compatible and the rest will be ignored.
Fields§
§flags: SegmentDescriptorFlags
Common segment descriptor settings.
Implementations§
source§impl SegmentDescriptor
impl SegmentDescriptor
sourcepub const LIMIT_MAX: u32 = 1_048_575u32
pub const LIMIT_MAX: u32 = 1_048_575u32
The maximum supported value of the limit
field (20 bits).
sourcepub fn address(self) -> usize
pub fn address(self) -> usize
Base virtual address of the segment, to which offsets are added.
In 64-bit mode, this is ignored and assumed to be 0 for code and data segments, but it still applies to task state and local descriptor table segments.
sourcepub fn set_address(&mut self, address: usize)
pub fn set_address(&mut self, address: usize)
Update the base address.
sourcepub fn limit(self) -> u32
pub fn limit(self) -> u32
The “limit” of the segment, which is a maximum or minimum offset from the base address.
If this is a stack-like data segment
(data_expand_down
), then this value is the
exclusive minimum offset value. Otherwise, this is the inclusive maximum
offset value (i.e., size - 1).
This value may be in bytes or in 4KB units, depending on
flags.granularity
.
In 64-bit mode, this is ignored (all limit checks are disabled) for code and data segments, but it still applies to task state and local descriptor table segments.
Trait Implementations§
source§impl Clone for SegmentDescriptor
impl Clone for SegmentDescriptor
source§fn clone(&self) -> SegmentDescriptor
fn clone(&self) -> SegmentDescriptor
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SegmentDescriptor
impl Debug for SegmentDescriptor
source§impl Default for SegmentDescriptor
impl Default for SegmentDescriptor
source§impl PartialEq for SegmentDescriptor
impl PartialEq for SegmentDescriptor
impl Copy for SegmentDescriptor
impl Eq for SegmentDescriptor
impl StructuralPartialEq for SegmentDescriptor
Auto Trait Implementations§
impl Freeze for SegmentDescriptor
impl RefUnwindSafe for SegmentDescriptor
impl Send for SegmentDescriptor
impl Sync for SegmentDescriptor
impl Unpin for SegmentDescriptor
impl UnwindSafe for SegmentDescriptor
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)