#[repr(C)]
pub struct SegmentDescriptor { pub flags: SegmentDescriptorFlags, /* private fields */ }
Available on x86 or x86-64 only.
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§

The maximum supported value of the limit field (20 bits).

Create a zero-initialized descriptor

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.

Update the base address.

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.

Update the segment limit.

Panics

Panics if the limit is greater than LIMIT_MAX.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.