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 { ... }
}
Expand description
Settings common to SegmentDescriptor
s and GateDescriptor
s.
Provided Methods§
sourcefn system_type(&self) -> SystemDescriptorType
fn system_type(&self) -> SystemDescriptorType
If this is a system descriptor, indicates which type.
Only applies if is_application
is false.
sourcefn application_accessed(&self) -> bool
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.
sourcefn code_readable(&self) -> bool
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.
sourcefn data_writable(&self) -> bool
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.
sourcefn code_conforming(&self) -> bool
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.
sourcefn data_expand_down(&self) -> bool
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.
sourcefn is_code(&self) -> bool
fn is_code(&self) -> bool
Indicates whether this is a code (true) or data (false) descriptor.
Only applies if is_application
is true.
sourcefn is_application(&self) -> bool
fn is_application(&self) -> bool
S
: Indicates that this is an application section descriptor if true.
Otherwise, this is a system descriptor.
sourcefn privilege_level(&self) -> u8
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.
- If the segment is accessed through a call gate or
sourcefn code_mode_64(&self) -> bool
Available on x86-64 only.
fn code_mode_64(&self) -> bool
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:
sourcefn application_mode_32(&self) -> bool
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.
sourcefn set_system_type(&mut self, value: SystemDescriptorType)
fn set_system_type(&mut self, value: SystemDescriptorType)
If this is a system descriptor, indicates which type.
Only applies if is_application
is false.
sourcefn with_system_type(&self, value: SystemDescriptorType) -> Self
fn with_system_type(&self, value: SystemDescriptorType) -> Self
If this is a system descriptor, indicates which type.
Only applies if is_application
is false.
sourcefn set_application_accessed(&mut self, value: bool)
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.
sourcefn with_application_accessed(&mut self, value: bool) -> Self
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.
sourcefn set_code_readable(&mut self, value: bool)
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.
sourcefn with_code_readable(&mut self, value: bool) -> Self
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.
sourcefn set_data_writable(&mut self, value: bool)
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.
sourcefn with_data_writable(&mut self, value: bool) -> Self
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.
sourcefn set_code_conforming(&mut self, value: bool)
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.
sourcefn with_code_conforming(&mut self, value: bool) -> Self
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.
sourcefn set_data_expand_down(&mut self, value: bool)
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.
sourcefn with_data_expand_down(&mut self, value: bool) -> Self
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.
sourcefn set_is_code(&mut self, value: bool)
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.
sourcefn with_is_code(&mut self, value: bool) -> Self
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.
sourcefn set_is_application(&mut self, value: bool)
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.
sourcefn with_is_application(&mut self, value: bool) -> Self
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.
sourcefn set_privilege_level(&mut self, value: u8)
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.
- If the segment is accessed through a call gate or
sourcefn with_privilege_level(&self, value: u8) -> Self
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.
- If the segment is accessed through a call gate or
sourcefn set_present(&mut self, value: bool)
fn set_present(&mut self, value: bool)
P
: Indicates that the segment is defined.
sourcefn with_present(&mut self, value: bool) -> Self
fn with_present(&mut self, value: bool) -> Self
P
: Indicates that the segment is defined.
sourcefn set_code_mode_64(&mut self, value: bool)
Available on x86-64 only.
fn set_code_mode_64(&mut self, value: bool)
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:
sourcefn with_code_mode_64(&mut self, value: bool) -> Self
Available on x86-64 only.
fn with_code_mode_64(&mut self, value: bool) -> Self
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:
sourcefn set_application_mode_32(&mut self, value: bool)
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.
sourcefn with_application_mode_32(&mut self, value: bool) -> Self
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.
sourcefn fmt_fields(&self, f: &mut DebugStruct<'_, '_>)
fn fmt_fields(&self, f: &mut DebugStruct<'_, '_>)
Print this object’s bitfield values. Helper method for Debug
implementations.
sourcefn is_gate(&self) -> bool
fn is_gate(&self) -> bool
Indicates that this is a GateDescriptor
.