pub struct SegmentDescriptor {
pub base: u64,
pub limit: u32,
pub selector: Selector,
pub access: SegmentAccess,
}arch-amd64 only.Expand description
A segment descriptor is a data structure in a GDT or LDT that provides the processor with the size and location of a segment, as well as access control and status information. Segment descriptors are typically created by compilers, linkers, loaders, or the operating system or executive, but not application programs.
Fields§
§base: u64Defines the location of byte 0 of the segment within the 4-GByte linear address space. Segment base addresses should be aligned to 16-byte boundaries. Although 16-byte alignment is not required, this alignment allows programs to maximize performance by aligning code and data on 16-byte boundaries.
limit: u32Specifies the size of the segment. The processor interprets the segment limit in one of two ways, depending on the setting of the G (granularity) flag:
-
If the granularity flag is clear, the segment size can range from 1 byte to 1 MByte, in byte increments.
-
If the granularity flag is set, the segment size can range from 4 KBytes to 4 GBytes, in 4-KByte increments.
The processor uses the segment limit in two different ways, depending on whether the segment is an expand-up or an expand-down segment. For expand-up segments, the offset in a logical address can range from 0 to the segment limit. Offsets greater than the segment limit generate general-protection exceptions (#GP, for all segments other than SS) or stack-fault exceptions (#SS for the SS segment). For expand-down segments, the segment limit has the reverse function; the offset can range from the segment limit plus 1 to FFFFFFFFH or FFFFH, depending on the setting of the B flag. Offsets less than or equal to the segment limit generate general-protection exceptions or stack-fault exceptions. Decreasing the value in the segment limit field for an expanddown segment allocates new memory at the bottom of the segment’s address space, rather than at the top. IA-32 architecture stacks always grow downwards, making this mechanism convenient for expandable stacks.
selector: SelectorThe selector of the segment.
access: SegmentAccessThe access rights of the segment.
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§fn default() -> SegmentDescriptor
fn default() -> 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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.