Trait tartan_arch::x86_common::protection::DescriptorFlags

source ·
pub trait DescriptorFlags: Bitfield<u32> {
Show 38 methods // Provided methods fn system_type(&self) -> SystemDescriptorType { ... } fn application_accessed(&self) -> bool { ... } fn code_readable(&self) -> bool { ... } fn data_writable(&self) -> bool { ... } fn code_conforming(&self) -> bool { ... } fn data_expand_down(&self) -> bool { ... } fn is_code(&self) -> bool { ... } fn is_application(&self) -> bool { ... } fn privilege_level(&self) -> u8 { ... } fn present(&self) -> bool { ... } fn code_mode_64(&self) -> bool { ... } fn application_mode_32(&self) -> bool { ... } fn set_system_type(&mut self, value: SystemDescriptorType) { ... } fn with_system_type(&self, value: SystemDescriptorType) -> Self { ... } fn set_application_accessed(&mut self, value: bool) { ... } fn with_application_accessed(&mut self, value: bool) -> Self { ... } fn set_code_readable(&mut self, value: bool) { ... } fn with_code_readable(&mut self, value: bool) -> Self { ... } fn set_data_writable(&mut self, value: bool) { ... } fn with_data_writable(&mut self, value: bool) -> Self { ... } fn set_code_conforming(&mut self, value: bool) { ... } fn with_code_conforming(&mut self, value: bool) -> Self { ... } fn set_data_expand_down(&mut self, value: bool) { ... } fn with_data_expand_down(&mut self, value: bool) -> Self { ... } fn set_is_code(&mut self, value: bool) { ... } fn with_is_code(&mut self, value: bool) -> Self { ... } fn set_is_application(&mut self, value: bool) { ... } fn with_is_application(&mut self, value: bool) -> Self { ... } fn set_privilege_level(&mut self, value: u8) { ... } fn with_privilege_level(&self, value: u8) -> Self { ... } fn set_present(&mut self, value: bool) { ... } fn with_present(&mut self, value: bool) -> Self { ... } fn set_code_mode_64(&mut self, value: bool) { ... } fn with_code_mode_64(&mut self, value: bool) -> Self { ... } fn set_application_mode_32(&mut self, value: bool) { ... } fn with_application_mode_32(&mut self, value: bool) -> Self { ... } fn fmt_fields(&self, f: &mut DebugStruct<'_, '_>) { ... } fn is_gate(&self) -> bool { ... }
}
Available on x86 or x86-64 only.
Expand description

Settings common to SegmentDescriptors and GateDescriptors.

Provided Methods§

source

fn system_type(&self) -> SystemDescriptorType

If this is a system descriptor, indicates which type.

Only applies if is_application is false.

source

fn application_accessed(&self) -> bool

The processor sets this bit whenever a segment register points to this segment.

The process never resets this itself, but it can be cleared manually.

Only applies if is_application is true.

source

fn code_readable(&self) -> bool

If this is a code descriptor, indicates that the segment can be read. Otherwise, it is execute-only.

Only applies if is_application and is_code are true.

source

fn data_writable(&self) -> bool

If this is a data descriptor, indicates that this segment is writable.

Required for stack segments.

Only applies if is_application is true and code_descriptor is false.

source

fn code_conforming(&self) -> bool

If this is a code descriptor, indicates that this segment can be executed with lower privileges than privilege_level.

Only applies if is_application and is_code are true.

source

fn data_expand_down(&self) -> bool

If this is a data descriptor, indicates that the segment expands toward lower addresses (stack-like) if its limit is changed.

Only applies if is_application is true and is_code is false.

source

fn is_code(&self) -> bool

Indicates whether this is a code (true) or data (false) descriptor.

Only applies if is_application is true.

source

fn is_application(&self) -> bool

S: Indicates that this is an application section descriptor if true. Otherwise, this is a system descriptor.

source

fn privilege_level(&self) -> u8

DPL: The privilege level associated with the segment.

This has several meanings depending on the segment type:

  • For stack segments, this is the exact privilege level required to use the segment as a stack.
  • For data segments, this is the minimum privilege (maximum number) required to access the segment.
  • For call gates, this is the minimum privilege (maximum number) required to use the gate.
  • For code segments:
    • If the segment is accessed through a call gate or code_conforming is true, this is the maximum privilege level (minimum number) that can execute the code.
    • Otherwise, it is the exact privilege level required to execute the code.
source

fn present(&self) -> bool

P: Indicates that the segment is defined.

source

fn code_mode_64(&self) -> bool

Available on x86-64 only.

L: If this is a code segment, indicates that it should be executed in 64-bit mode.

Mutually exclusive with mode_32.

Only applies if all of the following are true:

source

fn application_mode_32(&self) -> bool

D/B: Indicates that the segment uses 32-bit mode. Otherwise, it is 16-bit, unless code_mode_64 is set.

Besides the address/operand sizes for instructions in code segments, this also affects the upper bound of stack-like data segments with the data_expand_down flag set.

Only applies if is_application is true.

source

fn set_system_type(&mut self, value: SystemDescriptorType)

If this is a system descriptor, indicates which type.

Only applies if is_application is false.

source

fn with_system_type(&self, value: SystemDescriptorType) -> Self

If this is a system descriptor, indicates which type.

Only applies if is_application is false.

source

fn set_application_accessed(&mut self, value: bool)

The processor sets this bit whenever a segment register points to this segment.

The process never resets this itself, but it can be cleared manually.

Only applies if is_application is true.

source

fn with_application_accessed(&mut self, value: bool) -> Self

The processor sets this bit whenever a segment register points to this segment.

The process never resets this itself, but it can be cleared manually.

Only applies if is_application is true.

source

fn set_code_readable(&mut self, value: bool)

If this is a code descriptor, indicates that the segment can be read. Otherwise, it is execute-only.

Only applies if is_application and is_code are true.

source

fn with_code_readable(&mut self, value: bool) -> Self

If this is a code descriptor, indicates that the segment can be read. Otherwise, it is execute-only.

Only applies if is_application and is_code are true.

source

fn set_data_writable(&mut self, value: bool)

If this is a data descriptor, indicates that this segment is writable.

Required for stack segments.

Only applies if is_application is true and code_descriptor is false.

source

fn with_data_writable(&mut self, value: bool) -> Self

If this is a data descriptor, indicates that this segment is writable.

Required for stack segments.

Only applies if is_application is true and code_descriptor is false.

source

fn set_code_conforming(&mut self, value: bool)

If this is a code descriptor, indicates that this segment can be executed with lower privileges than privilege_level.

Only applies if is_application and is_code are true.

source

fn with_code_conforming(&mut self, value: bool) -> Self

If this is a code descriptor, indicates that this segment can be executed with lower privileges than privilege_level.

Only applies if is_application and is_code are true.

source

fn set_data_expand_down(&mut self, value: bool)

If this is a data descriptor, indicates that the segment expands toward lower addresses (stack-like) if its limit is changed.

Only applies if is_application is true and is_code is false.

source

fn with_data_expand_down(&mut self, value: bool) -> Self

If this is a data descriptor, indicates that the segment expands toward lower addresses (stack-like) if its limit is changed.

Only applies if is_application is true and is_code is false.

source

fn set_is_code(&mut self, value: bool)

Indicates whether this is a code (true) or data (false) descriptor.

Only applies if is_application is true.

source

fn with_is_code(&mut self, value: bool) -> Self

Indicates whether this is a code (true) or data (false) descriptor.

Only applies if is_application is true.

source

fn set_is_application(&mut self, value: bool)

S: Indicates that this is an application section descriptor if true. Otherwise, this is a system descriptor.

source

fn with_is_application(&mut self, value: bool) -> Self

S: Indicates that this is an application section descriptor if true. Otherwise, this is a system descriptor.

source

fn set_privilege_level(&mut self, value: u8)

DPL: The privilege level associated with the segment.

This has several meanings depending on the segment type:

  • For stack segments, this is the exact privilege level required to use the segment as a stack.
  • For data segments, this is the minimum privilege (maximum number) required to access the segment.
  • For call gates, this is the minimum privilege (maximum number) required to use the gate.
  • For code segments:
    • If the segment is accessed through a call gate or code_conforming is true, this is the maximum privilege level (minimum number) that can execute the code.
    • Otherwise, it is the exact privilege level required to execute the code.
source

fn with_privilege_level(&self, value: u8) -> Self

DPL: The privilege level associated with the segment.

This has several meanings depending on the segment type:

  • For stack segments, this is the exact privilege level required to use the segment as a stack.
  • For data segments, this is the minimum privilege (maximum number) required to access the segment.
  • For call gates, this is the minimum privilege (maximum number) required to use the gate.
  • For code segments:
    • If the segment is accessed through a call gate or code_conforming is true, this is the maximum privilege level (minimum number) that can execute the code.
    • Otherwise, it is the exact privilege level required to execute the code.
source

fn set_present(&mut self, value: bool)

P: Indicates that the segment is defined.

source

fn with_present(&mut self, value: bool) -> Self

P: Indicates that the segment is defined.

source

fn set_code_mode_64(&mut self, value: bool)

Available on x86-64 only.

L: If this is a code segment, indicates that it should be executed in 64-bit mode.

Mutually exclusive with mode_32.

Only applies if all of the following are true:

source

fn with_code_mode_64(&mut self, value: bool) -> Self

Available on x86-64 only.

L: If this is a code segment, indicates that it should be executed in 64-bit mode.

Mutually exclusive with mode_32.

Only applies if all of the following are true:

source

fn set_application_mode_32(&mut self, value: bool)

D/B: Indicates that the segment uses 32-bit mode. Otherwise, it is 16-bit, unless code_mode_64 is set.

Besides the address/operand sizes for instructions in code segments, this also affects the upper bound of stack-like data segments with the data_expand_down flag set.

Only applies if is_application is true.

source

fn with_application_mode_32(&mut self, value: bool) -> Self

D/B: Indicates that the segment uses 32-bit mode. Otherwise, it is 16-bit, unless code_mode_64 is set.

Besides the address/operand sizes for instructions in code segments, this also affects the upper bound of stack-like data segments with the data_expand_down flag set.

Only applies if is_application is true.

source

fn fmt_fields(&self, f: &mut DebugStruct<'_, '_>)

Print this object’s bitfield values. Helper method for Debug implementations.

source

fn is_gate(&self) -> bool

Indicates that this is a GateDescriptor.

Object Safety§

This trait is not object safe.

Implementors§