aboutsummaryrefslogtreecommitdiff
path: root/src/long_mode/mod.rs
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2026-05-25 17:53:38 +0000
committeriximeow <me@iximeow.net>2026-05-25 18:00:30 +0000
commitb9819eb973208e9998a87cc54473efbcf281f4ad (patch)
tree5a1305be45dd861ada737a7c601412dc5f860e26 /src/long_mode/mod.rs
parentf2a2a09688421f2c532ab6f02527bf68f095407a (diff)
and some prefix helpers should be pub
Diffstat (limited to 'src/long_mode/mod.rs')
-rw-r--r--src/long_mode/mod.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/long_mode/mod.rs b/src/long_mode/mod.rs
index f2fac5b..bfe67c3 100644
--- a/src/long_mode/mod.rs
+++ b/src/long_mode/mod.rs
@@ -3498,8 +3498,12 @@ impl Prefixes {
fn set_repnz(&mut self) { self.bits = (self.bits & 0xcf) | 0x30 }
#[inline]
pub fn rep_any(&self) -> bool { self.bits & 0x30 != 0x00 }
+ /// return `true` if an operand-size (`66`) prefix is active for the instruction.
+ ///
+ /// this interacts in subtle ways with a REX prefix, if both are present. if you are tempted to
+ /// refine decode logic based the result of this function, please report that as an issue.
#[inline]
- fn operand_size(&self) -> bool { self.bits & 0x1 == 1 }
+ pub fn operand_size(&self) -> bool { self.bits & 0x1 == 1 }
#[inline]
fn set_operand_size(&mut self) {
self.bits = self.bits | 0x1;
@@ -3508,14 +3512,18 @@ impl Prefixes {
fn unset_operand_size(&mut self) {
self.bits = self.bits & !0x1;
}
+ /// return `true` if an operand-size (67) prefix is active for the instruction.
#[inline]
- fn address_size(&self) -> bool { self.bits & 0x2 == 2 }
+ pub fn address_size(&self) -> bool { self.bits & 0x2 == 2 }
#[inline]
fn set_address_size(&mut self) { self.bits = self.bits | 0x2 }
#[inline]
fn set_lock(&mut self) { self.bits |= 0x4 }
#[inline]
pub fn lock(&self) -> bool { self.bits & 0x4 == 4 }
+ /// return the instruction's selected data segment.
+ #[inline]
+ pub fn segment(&self) -> Segment { self.segment }
#[inline]
pub fn cs(&self) -> bool { self.segment == Segment::CS }
#[inline]