Skip to content

Commit

Permalink
Merge pull request #373 from prinzdezibel/master
Browse files Browse the repository at this point in the history
 Provide null segment selector as associated constant on SegmentSelector
  • Loading branch information
Freax13 authored Apr 12, 2022
2 parents 8922d8d + 3959a0b commit 3cae23e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/registers/segmentation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ impl SegmentSelector {
SegmentSelector(index << 3 | (rpl as u16))
}

/// Can be used as a selector into a non-existent segment and assigned to segment registers,
/// e.g. data segment register in ring 0
pub const NULL: Self = Self::new(0, PrivilegeLevel::Ring0);

/// Returns the GDT index.
#[inline]
pub fn index(self) -> u16 {
Expand Down

0 comments on commit 3cae23e

Please sign in to comment.