aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2019-10-19 22:51:44 -0700
committeriximeow <me@iximeow.net>2020-01-12 16:10:13 -0800
commit3c9597a105670c91a6c11493204a4828ed54d235 (patch)
tree58a7c3e1712e9f46404acb85dc6205d144a60f31
parent02fd73fbc22d3abfc876cf21fa6322e815e940c7 (diff)
add more regspec helpers, some allcaps to lowercase
-rw-r--r--src/lib.rs32
1 files changed, 29 insertions, 3 deletions
diff --git a/src/lib.rs b/src/lib.rs
index c2cd016..7dcd0a2 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -55,7 +55,7 @@ impl RegSpec {
}
#[inline]
- pub fn RIP() -> RegSpec {
+ pub fn rip() -> RegSpec {
RegSpec {
num: 0,
bank: RegisterBank::RIP
@@ -63,7 +63,7 @@ impl RegSpec {
}
#[inline]
- pub fn EIP() -> RegSpec {
+ pub fn eip() -> RegSpec {
RegSpec {
num: 0,
bank: RegisterBank::EIP
@@ -128,6 +128,26 @@ impl RegSpec {
}
#[inline]
+ pub fn rsi() -> RegSpec {
+ RegSpec { bank: RegisterBank::Q, num: 6 }
+ }
+
+ #[inline]
+ pub fn rdi() -> RegSpec {
+ RegSpec { bank: RegisterBank::Q, num: 7 }
+ }
+
+ #[inline]
+ pub fn r8() -> RegSpec {
+ RegSpec { bank: RegisterBank::Q, num: 8 }
+ }
+
+ #[inline]
+ pub fn r9() -> RegSpec {
+ RegSpec { bank: RegisterBank::Q, num: 9 }
+ }
+
+ #[inline]
pub fn eax() -> RegSpec {
RegSpec { bank: RegisterBank::D, num: 0 }
}
@@ -141,6 +161,11 @@ impl RegSpec {
pub fn al() -> RegSpec {
RegSpec { bank: RegisterBank::B, num: 0 }
}
+
+ #[inline]
+ pub fn cl() -> RegSpec {
+ RegSpec { bank: RegisterBank::B, num: 1 }
+ }
}
#[allow(non_camel_case_types)]
@@ -217,6 +242,7 @@ impl Operand {
}
}
+#[allow(non_camel_case_types)]
#[cfg(feature="use-serde")]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)]
pub enum RegisterBank {
@@ -2070,7 +2096,7 @@ fn read_E_anybank<T: Iterator<Item=u8>>(bytes_iter: &mut T, instr: &mut Instruct
} else if (modrm & 7) == 5 && modbits == 0b00 {
let disp = read_num(bytes_iter, 4, &mut instr.length);
instr.operands[result] = Operand::RegDisp(
- if addr_width == 8 { RegSpec::RIP() } else { RegSpec::EIP() },
+ if addr_width == 8 { RegSpec::rip() } else { RegSpec::eip() },
disp as i32
);
} else if (modrm & 7) == 4 {