aboutsummaryrefslogtreecommitdiff
path: root/src/long_mode/mod.rs
diff options
context:
space:
mode:
authoriximeow <me@iximeow.net>2026-02-14 18:33:39 +0000
committeriximeow <me@iximeow.net>2026-02-14 18:33:39 +0000
commitb7de8016c51f8d48bb3f91eb6d7be191d6b46d55 (patch)
tree6f9ca49ac868444563446394f8aa84777be770da /src/long_mode/mod.rs
parentd12452b098f90e214e8be0b638b7faea42f42b24 (diff)
type aliases make some of these signatures less egregious..
Diffstat (limited to 'src/long_mode/mod.rs')
-rw-r--r--src/long_mode/mod.rs47
1 files changed, 24 insertions, 23 deletions
diff --git a/src/long_mode/mod.rs b/src/long_mode/mod.rs
index 823221e..5163ba6 100644
--- a/src/long_mode/mod.rs
+++ b/src/long_mode/mod.rs
@@ -5,6 +5,7 @@ mod display;
pub mod uarch;
pub use crate::MemoryAccessSize;
+use crate::{Address, Word};
#[cfg(feature = "fmt")]
pub use self::display::{DisplayStyle, InstructionDisplayer};
@@ -2842,14 +2843,14 @@ impl Default for InstDecoder {
}
impl Decoder<Arch> for InstDecoder {
- fn decode<T: Reader<<Arch as yaxpeax_arch::Arch>::Address, <Arch as yaxpeax_arch::Arch>::Word>>(&self, words: &mut T) -> Result<Instruction, <Arch as yaxpeax_arch::Arch>::DecodeError> {
+ fn decode<T: Reader<Address<Arch>, Word<Arch>>>(&self, words: &mut T) -> Result<Instruction, <Arch as yaxpeax_arch::Arch>::DecodeError> {
let mut instr = Instruction::invalid();
self.decode_into(&mut instr, words)?;
Ok(instr)
}
#[inline(always)]
- fn decode_into<T: Reader<<Arch as yaxpeax_arch::Arch>::Address, <Arch as yaxpeax_arch::Arch>::Word>>(&self, instr: &mut Instruction, words: &mut T) -> Result<(), <Arch as yaxpeax_arch::Arch>::DecodeError> {
+ fn decode_into<T: Reader<Address<Arch>, Word<Arch>>>(&self, instr: &mut Instruction, words: &mut T) -> Result<(), <Arch as yaxpeax_arch::Arch>::DecodeError> {
self.decode_with_annotation(instr, words, &mut NullSink)
}
}
@@ -2859,7 +2860,7 @@ impl AnnotatingDecoder<Arch> for InstDecoder {
#[inline(always)]
fn decode_with_annotation<
- T: Reader<<Arch as yaxpeax_arch::Arch>::Address, <Arch as yaxpeax_arch::Arch>::Word>,
+ T: Reader<Address<Arch>, Word<Arch>>,
S: DescriptionSink<Self::FieldDescription>
>(&self, instr: &mut Instruction, words: &mut T, sink: &mut S) -> Result<(), <Arch as yaxpeax_arch::Arch>::DecodeError> {
decode_with_annotation(self, instr, words, sink)
@@ -2868,7 +2869,7 @@ impl AnnotatingDecoder<Arch> for InstDecoder {
#[inline(always)]
fn decode_with_annotation<
- T: Reader<<Arch as yaxpeax_arch::Arch>::Address, <Arch as yaxpeax_arch::Arch>::Word>,
+ T: Reader<Address<Arch>, Word<Arch>>,
S: DescriptionSink<FieldDescription>
>(decoder: &InstDecoder, instr: &mut Instruction, words: &mut T, sink: &mut S) -> Result<(), <Arch as yaxpeax_arch::Arch>::DecodeError> {
DecodeCtx::new().read_with_annotations(decoder, words, instr, sink)?;
@@ -4677,7 +4678,7 @@ const OPCODES: [OpcodeRecord; 256] = [
#[cfg_attr(feature="profiling", inline(never))]
#[cfg_attr(not(feature="profiling"), inline(always))]
pub(self) fn read_E<
- T: Reader<<Arch as yaxpeax_arch::Arch>::Address, <Arch as yaxpeax_arch::Arch>::Word>,
+ T: Reader<Address<Arch>, Word<Arch>>,
S: DescriptionSink<FieldDescription>,
>(words: &mut T, instr: &mut Instruction, modrm: u8, bank: RegisterBank, sink: &mut S) -> Result<OperandSpec, DecodeError> {
if modrm >= 0b11000000 {
@@ -4688,7 +4689,7 @@ pub(self) fn read_E<
}
#[allow(non_snake_case)]
pub(self) fn read_E_st<
- T: Reader<<Arch as yaxpeax_arch::Arch>::Address, <Arch as yaxpeax_arch::Arch>::Word>,
+ T: Reader<Address<Arch>, Word<Arch>>,
S: DescriptionSink<FieldDescription>,
>(words: &mut T, instr: &mut Instruction, modrm: u8, sink: &mut S) -> Result<OperandSpec, DecodeError> {
if modrm >= 0b11000000 {
@@ -4700,7 +4701,7 @@ pub(self) fn read_E_st<
}
#[allow(non_snake_case)]
pub(self) fn read_E_xmm<
- T: Reader<<Arch as yaxpeax_arch::Arch>::Address, <Arch as yaxpeax_arch::Arch>::Word>,
+ T: Reader<Address<Arch>, Word<Arch>>,
S: DescriptionSink<FieldDescription>,
>(words: &mut T, instr: &mut Instruction, modrm: u8, sink: &mut S) -> Result<OperandSpec, DecodeError> {
if modrm >= 0b11000000 {
@@ -4711,7 +4712,7 @@ pub(self) fn read_E_xmm<
}
#[allow(non_snake_case)]
pub(self) fn read_E_ymm<
- T: Reader<<Arch as yaxpeax_arch::Arch>::Address, <Arch as yaxpeax_arch::Arch>::Word>,
+ T: Reader<Address<Arch>, Word<Arch>>,
S: DescriptionSink<FieldDescription>,
>(words: &mut T, instr: &mut Instruction, modrm: u8, sink: &mut S) -> Result<OperandSpec, DecodeError> {
if modrm >= 0b11000000 {
@@ -4722,7 +4723,7 @@ pub(self) fn read_E_ymm<
}
#[allow(non_snake_case)]
pub(self) fn read_E_vex<
- T: Reader<<Arch as yaxpeax_arch::Arch>::Address, <Arch as yaxpeax_arch::Arch>::Word>,
+ T: Reader<Address<Arch>, Word<Arch>>,
S: DescriptionSink<FieldDescription>,
>(words: &mut T, instr: &mut Instruction, modrm: u8, bank: RegisterBank, sink: &mut S) -> Result<OperandSpec, DecodeError> {
if modrm >= 0b11000000 {
@@ -4739,7 +4740,7 @@ pub(self) fn read_E_vex<
#[allow(non_snake_case)]
#[inline(always)]
fn read_modrm_reg<
- T: Reader<<Arch as yaxpeax_arch::Arch>::Address, <Arch as yaxpeax_arch::Arch>::Word>,
+ T: Reader<Address<Arch>, Word<Arch>>,
S: DescriptionSink<FieldDescription>,
>(instr: &mut Instruction, words: &mut T, modrm: u8, reg_bank: RegisterBank, sink: &mut S) -> Result<OperandSpec, DecodeError> {
instr.regs[1] = RegSpec::from_parts(modrm & 7, instr.prefixes.rex_unchecked().b(), reg_bank);
@@ -4754,7 +4755,7 @@ fn read_modrm_reg<
#[inline(always)]
fn read_sib_disp<
- T: Reader<<Arch as yaxpeax_arch::Arch>::Address, <Arch as yaxpeax_arch::Arch>::Word>,
+ T: Reader<Address<Arch>, Word<Arch>>,
S: DescriptionSink<FieldDescription>,
>(instr: &Instruction, words: &mut T, modrm: u8, sibbyte: u8, sink: &mut S) -> Result<i32, DecodeError> {
let sib_start = words.offset() as u32 * 8 - 8;
@@ -4801,7 +4802,7 @@ fn read_sib_disp<
#[allow(non_snake_case)]
#[inline(always)]
fn read_sib<
- T: Reader<<Arch as yaxpeax_arch::Arch>::Address, <Arch as yaxpeax_arch::Arch>::Word>,
+ T: Reader<Address<Arch>, Word<Arch>>,
S: DescriptionSink<FieldDescription>,
>(words: &mut T, instr: &mut Instruction, modrm: u8, sink: &mut S) -> Result<OperandSpec, DecodeError> {
let modrm_start = words.offset() as u32 * 8 - 8;
@@ -4997,7 +4998,7 @@ fn read_sib<
#[allow(non_snake_case)]
#[inline(always)]
fn read_M<
- T: Reader<<Arch as yaxpeax_arch::Arch>::Address, <Arch as yaxpeax_arch::Arch>::Word>,
+ T: Reader<Address<Arch>, Word<Arch>>,
S: DescriptionSink<FieldDescription>
>(words: &mut T, instr: &mut Instruction, modrm: u8, sink: &mut S) -> Result<OperandSpec, DecodeError> {
let modrm_start = words.offset() as u32 * 8 - 8;
@@ -5250,7 +5251,7 @@ impl fmt::Display for FieldDescription {
#[inline(always)]
fn record_opcode_record_found<
- T: Reader<<Arch as yaxpeax_arch::Arch>::Address, <Arch as yaxpeax_arch::Arch>::Word>,
+ T: Reader<Address<Arch>, Word<Arch>>,
S: DescriptionSink<FieldDescription>,
>(words: &mut T, sink: &mut S, opc: Opcode, code: OperandCode, opc_length: u32) {
let offset = words.offset() as u32;
@@ -5306,7 +5307,7 @@ impl DecodeCtx {
#[cfg_attr(feature="profiling", inline(never))]
fn read_opc_hotpath<
- T: Reader<<Arch as yaxpeax_arch::Arch>::Address, <Arch as yaxpeax_arch::Arch>::Word>,
+ T: Reader<Address<Arch>, Word<Arch>>,
S: DescriptionSink<FieldDescription>,
>(&mut self, mut b: u8, nextb: &mut u8, record: &mut OpcodeRecord, words: &mut T, instruction: &mut Instruction, sink: &mut S) -> Result<bool, DecodeError> {
if b >= 0x40 && b < 0x50 {
@@ -5364,7 +5365,7 @@ fn read_opc_hotpath<
#[cfg_attr(feature="profiling", inline(never))]
#[cfg_attr(not(feature="profiling"), inline(always))]
fn read_with_annotations<
- T: Reader<<Arch as yaxpeax_arch::Arch>::Address, <Arch as yaxpeax_arch::Arch>::Word>,
+ T: Reader<Address<Arch>, Word<Arch>>,
S: DescriptionSink<FieldDescription>,
>(mut self, decoder: &InstDecoder, words: &mut T, instruction: &mut Instruction, sink: &mut S) -> Result<(), DecodeError> {
words.mark();
@@ -5527,7 +5528,7 @@ fn read_with_annotations<
#[inline(never)]
fn read_avx_prefixed<
- T: Reader<<Arch as yaxpeax_arch::Arch>::Address, <Arch as yaxpeax_arch::Arch>::Word>,
+ T: Reader<Address<Arch>, Word<Arch>>,
S: DescriptionSink<FieldDescription>,
>(self, b: u8, words: &mut T, instruction: &mut Instruction, sink: &mut S) -> Result<(), DecodeError> {
if instruction.prefixes.vex_invalid() {
@@ -5583,7 +5584,7 @@ fn read_avx_prefixed<
#[cfg_attr(feature="profiling", inline(never))]
#[cfg_attr(not(feature="profiling"), inline(always))]
fn read_operands<
- T: Reader<<Arch as yaxpeax_arch::Arch>::Address, <Arch as yaxpeax_arch::Arch>::Word>,
+ T: Reader<Address<Arch>, Word<Arch>>,
S: DescriptionSink<FieldDescription>
>(&mut self, decoder: &InstDecoder, words: &mut T, instruction: &mut Instruction, operand_code: OperandCode, sink: &mut S) -> Result<(), DecodeError> {
sink.record(
@@ -9196,7 +9197,7 @@ fn read_0f3a_opcode(&mut self, opcode: u8, prefixes: &mut Prefixes) -> Result<Op
}
fn decode_x87<
- T: Reader<<Arch as yaxpeax_arch::Arch>::Address, <Arch as yaxpeax_arch::Arch>::Word>,
+ T: Reader<Address<Arch>, Word<Arch>>,
S: DescriptionSink<FieldDescription>,
>(words: &mut T, instruction: &mut Instruction, operand_code: OperandCase, sink: &mut S) -> Result<(), DecodeError> {
sink.record(
@@ -9725,7 +9726,7 @@ fn decode_x87<
}
#[inline(always)]
-fn read_num<T: Reader<<Arch as yaxpeax_arch::Arch>::Address, <Arch as yaxpeax_arch::Arch>::Word>>(bytes: &mut T, width: u8) -> Result<u64, DecodeError> {
+fn read_num<T: Reader<Address<Arch>, Word<Arch>>>(bytes: &mut T, width: u8) -> Result<u64, DecodeError> {
match width {
1 => { bytes.next().ok().ok_or(DecodeError::ExhaustedInput).map(|x| x as u64) }
2 => {
@@ -9750,7 +9751,7 @@ fn read_num<T: Reader<<Arch as yaxpeax_arch::Arch>::Address, <Arch as yaxpeax_ar
}
#[inline(always)]
-fn read_imm_signed<T: Reader<<Arch as yaxpeax_arch::Arch>::Address, <Arch as yaxpeax_arch::Arch>::Word>>(bytes: &mut T, num_width: u8) -> Result<i64, DecodeError> {
+fn read_imm_signed<T: Reader<Address<Arch>, Word<Arch>>>(bytes: &mut T, num_width: u8) -> Result<i64, DecodeError> {
if num_width == 1 {
Ok(read_num(bytes, 1)? as i8 as i64)
} else if num_width == 2 {
@@ -9762,7 +9763,7 @@ fn read_imm_signed<T: Reader<<Arch as yaxpeax_arch::Arch>::Address, <Arch as yax
}
#[inline]
-fn read_imm_unsigned<T: Reader<<Arch as yaxpeax_arch::Arch>::Address, <Arch as yaxpeax_arch::Arch>::Word>>(bytes: &mut T, width: u8) -> Result<u64, DecodeError> {
+fn read_imm_unsigned<T: Reader<Address<Arch>, Word<Arch>>>(bytes: &mut T, width: u8) -> Result<u64, DecodeError> {
read_num(bytes, width)
}
@@ -9793,7 +9794,7 @@ fn bank_from_prefixes_64(interpretation: SizeCode, prefixes: Prefixes) -> Regist
}
#[inline]
-fn read_modrm<T: Reader<<Arch as yaxpeax_arch::Arch>::Address, <Arch as yaxpeax_arch::Arch>::Word>>(words: &mut T) -> Result<u8, DecodeError> {
+fn read_modrm<T: Reader<Address<Arch>, Word<Arch>>>(words: &mut T) -> Result<u8, DecodeError> {
words.next().ok().ok_or(DecodeError::ExhaustedInput)
}