aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2019-10-21 00:26:23 -0700
committeriximeow <me@iximeow.net>2020-01-12 16:10:13 -0800
commit0ce86c7aac1c226e7c7805de6d69df51b7980063 (patch)
tree185c1ff3e79f5fe9dbb3e3749acb56d430521e51 /src
parente76c95b1c47fd10e6bc620b59b638587e0579a88 (diff)
wtf i love speculation
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs48
1 files changed, 22 insertions, 26 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 42c8826..c855baa 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -2378,35 +2378,31 @@ pub fn read_instr<T: Iterator<Item=u8>>(mut bytes_iter: T, instruction: &mut Ins
match bytes_iter.next() {
Some(b) => {
let record = OPCODES[b as usize];
- if let Interpretation::Instruction(_) = record.0 {
+ if (b & 0xf0) == 0x40 {
+ prefixes.rex_mut().from(b);
+ } else if b == 0x0f {
+ if let Some(record) = match alternate_opcode_map {
+ Some(OpcodeMap::Map66) => {
+ read_opcode_660f_map(&mut bytes_iter, &mut length)
+ },
+ Some(OpcodeMap::MapF2) => {
+ read_opcode_f20f_map(&mut bytes_iter, &mut length)
+ },
+ Some(OpcodeMap::MapF3) => {
+ read_opcode_f30f_map(&mut bytes_iter, &mut length)
+ },
+ None => {
+ read_opcode_0f_map(&mut bytes_iter, &mut length)
+ }
+ } {
+ break record;
+ } else {
+ return Err(());
+ }
+ } else if let Interpretation::Instruction(_) = record.0 {
break record;
} else {
match b {
- x if (x & 0xf0 == 0x40) => {
- // x86_32 inc/dec
- // x86_64 rex
- prefixes.rex_mut().from(x);
- },
- 0x0f => {
- if let Some(record) = match alternate_opcode_map {
- Some(OpcodeMap::Map66) => {
- read_opcode_660f_map(&mut bytes_iter, &mut length)
- },
- Some(OpcodeMap::MapF2) => {
- read_opcode_f20f_map(&mut bytes_iter, &mut length)
- },
- Some(OpcodeMap::MapF3) => {
- read_opcode_f30f_map(&mut bytes_iter, &mut length)
- },
- None => {
- read_opcode_0f_map(&mut bytes_iter, &mut length)
- }
- } {
- break record;
- } else {
- return Err(());
- }
- },
0x26 => {
prefixes.set_es();
alternate_opcode_map = None;