Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ description = "ia64 decoder for the yaxpeax project"
readme = "README.md"

[dependencies]
yaxpeax-arch = { version = "0.2.2", default-features = false, features = [] }
bitvec = "0.19"
yaxpeax-arch = { version = "0.3.2", default-features = false, features = [] }
bitvec = "1.0"

[features]
default = ["std"]
Expand Down
30 changes: 15 additions & 15 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1728,7 +1728,7 @@ impl Decoder<IA64> for InstDecoder {
fn decode_into<T: Reader<<IA64 as Arch>::Address, <IA64 as Arch>::Word>>(&self, inst: &mut InstructionBundle, bytes: &mut T) -> Result<(), <IA64 as Arch>::DecodeError> {
let mut ia64_word = [0u8; 16];
bytes.next_n(&mut ia64_word)?;
let mut instruction_bytes = bitarr![Lsb0, u8; 0u8; 128];
let mut instruction_bytes = bitarr![u8, Lsb0; 0u8; 128];
for i in 0..0u64.wrapping_offset(InstructionBundle::min_size()).to_linear() {
instruction_bytes[(i * 8)..(i * 8 + 8)].store(ia64_word[i]);
}
Expand All @@ -1742,7 +1742,7 @@ impl Decoder<IA64> for InstDecoder {
];
let (instruction_types, _) = BUNDLE_TAGS[bundle_tag as usize].ok_or(DecodeError::BadBundle)?;

fn decode_l_instruction(word2: &BitSlice<Lsb0, u8>, word: &BitSlice<Lsb0, u8>) -> Instruction {
fn decode_l_instruction(word2: &BitSlice<u8, Lsb0>, word: &BitSlice<u8, Lsb0>) -> Instruction {
let tag = word[37..41].load::<u8>();

let (opcode, operand_encoding) = get_l_opcode_and_encoding(tag, word);
Expand All @@ -1761,7 +1761,7 @@ impl Decoder<IA64> for InstDecoder {
}
}

fn decode_instruction(word: &BitSlice<Lsb0, u8>, ty: InstructionType) -> Instruction {
fn decode_instruction(word: &BitSlice<u8, Lsb0>, ty: InstructionType) -> Instruction {
let tag = word[37..41].load::<u8>();

let ty = if tag >= 8 && (ty == InstructionType::M || ty == InstructionType::I) {
Expand Down Expand Up @@ -2001,7 +2001,7 @@ fn four_op(dest: Option<u8>, op1: Operand, op2: Operand, op3: Operand, op4: Oper
(dest, [op1, op2, op3, op4, Operand::None])
}

fn read_l_operands(encoding: OperandEncodingX, word: &BitSlice<Lsb0, u8>, word2: &BitSlice<Lsb0, u8>) -> (Option<u8>, [Operand; 5]) {
fn read_l_operands(encoding: OperandEncodingX, word: &BitSlice<u8, Lsb0>, word2: &BitSlice<u8, Lsb0>) -> (Option<u8>, [Operand; 5]) {
use OperandEncodingX::*;
match encoding {
None => {
Expand Down Expand Up @@ -2079,7 +2079,7 @@ fn read_l_operands(encoding: OperandEncodingX, word: &BitSlice<Lsb0, u8>, word2:
}
}
}
fn read_b_operands(encoding: OperandEncodingB, word: &BitSlice<Lsb0, u8>) -> (Option<u8>, [Operand; 5]) {
fn read_b_operands(encoding: OperandEncodingB, word: &BitSlice<u8, Lsb0>) -> (Option<u8>, [Operand; 5]) {
use OperandEncodingB::*;
match encoding {
None => {
Expand Down Expand Up @@ -2191,7 +2191,7 @@ fn read_b_operands(encoding: OperandEncodingB, word: &BitSlice<Lsb0, u8>) -> (Op
}
}
}
fn read_f_operands(encoding: OperandEncodingF, word: &BitSlice<Lsb0, u8>) -> (Option<u8>, [Operand; 5]) {
fn read_f_operands(encoding: OperandEncodingF, word: &BitSlice<u8, Lsb0>) -> (Option<u8>, [Operand; 5]) {
use OperandEncodingF::*;
match encoding {
None => {
Expand Down Expand Up @@ -2319,7 +2319,7 @@ fn read_f_operands(encoding: OperandEncodingF, word: &BitSlice<Lsb0, u8>) -> (Op
},
}
}
fn read_i_operands(encoding: OperandEncodingI, word: &BitSlice<Lsb0, u8>) -> (Option<u8>, [Operand; 5]) {
fn read_i_operands(encoding: OperandEncodingI, word: &BitSlice<u8, Lsb0>) -> (Option<u8>, [Operand; 5]) {
use OperandEncodingI::*;
match encoding {
None => {
Expand Down Expand Up @@ -2666,7 +2666,7 @@ fn read_i_operands(encoding: OperandEncodingI, word: &BitSlice<Lsb0, u8>) -> (Op
}
}
}
fn read_m_operands(encoding: OperandEncodingM, word: &BitSlice<Lsb0, u8>) -> (Option<u8>, [Operand; 5]) {
fn read_m_operands(encoding: OperandEncodingM, word: &BitSlice<u8, Lsb0>) -> (Option<u8>, [Operand; 5]) {
use OperandEncodingM::*;
match encoding {
None => { unreachable!("none operand encoding"); }
Expand Down Expand Up @@ -3177,7 +3177,7 @@ fn read_m_operands(encoding: OperandEncodingM, word: &BitSlice<Lsb0, u8>) -> (Op
}
}

fn read_a_operands(encoding: OperandEncodingA, word: &BitSlice<Lsb0, u8>) -> (Option<u8>, [Operand; 5]) {
fn read_a_operands(encoding: OperandEncodingA, word: &BitSlice<u8, Lsb0>) -> (Option<u8>, [Operand; 5]) {
use OperandEncodingA::*;
match encoding {
None => { unreachable!("none operand encoding"); }
Expand Down Expand Up @@ -3309,7 +3309,7 @@ fn read_a_operands(encoding: OperandEncodingA, word: &BitSlice<Lsb0, u8>) -> (Op
}
}

fn get_l_opcode_and_encoding(tag: u8, word: &BitSlice<Lsb0, u8>) -> (Opcode, OperandEncodingX) {
fn get_l_opcode_and_encoding(tag: u8, word: &BitSlice<u8, Lsb0>) -> (Opcode, OperandEncodingX) {
use Opcode::*;
use OperandEncodingX::*;

Expand Down Expand Up @@ -3350,7 +3350,7 @@ fn get_l_opcode_and_encoding(tag: u8, word: &BitSlice<Lsb0, u8>) -> (Opcode, Ope
}
}

fn get_b_opcode_and_encoding(tag: u8, word: &BitSlice<Lsb0, u8>) -> (Opcode, OperandEncodingB) {
fn get_b_opcode_and_encoding(tag: u8, word: &BitSlice<u8, Lsb0>) -> (Opcode, OperandEncodingB) {
use Opcode::*;
use OperandEncodingB::*;

Expand Down Expand Up @@ -3424,7 +3424,7 @@ fn get_b_opcode_and_encoding(tag: u8, word: &BitSlice<Lsb0, u8>) -> (Opcode, Ope
}
}

fn get_f_opcode_and_encoding(tag: u8, word: &BitSlice<Lsb0, u8>) -> (Opcode, OperandEncodingF) {
fn get_f_opcode_and_encoding(tag: u8, word: &BitSlice<u8, Lsb0>) -> (Opcode, OperandEncodingF) {
use Opcode::*;
use OperandEncodingF::*;

Expand Down Expand Up @@ -3592,7 +3592,7 @@ fn get_f_opcode_and_encoding(tag: u8, word: &BitSlice<Lsb0, u8>) -> (Opcode, Ope
}
}

fn get_i_opcode_and_encoding(tag: u8, word: &BitSlice<Lsb0, u8>) -> (Opcode, OperandEncodingI) {
fn get_i_opcode_and_encoding(tag: u8, word: &BitSlice<u8, Lsb0>) -> (Opcode, OperandEncodingI) {
use Opcode::*;
use OperandEncodingI::*;

Expand Down Expand Up @@ -3811,7 +3811,7 @@ fn get_i_opcode_and_encoding(tag: u8, word: &BitSlice<Lsb0, u8>) -> (Opcode, Ope
}
}

fn get_m_opcode_and_encoding(tag: u8, word: &BitSlice<Lsb0, u8>) -> (Opcode, OperandEncodingM) {
fn get_m_opcode_and_encoding(tag: u8, word: &BitSlice<u8, Lsb0>) -> (Opcode, OperandEncodingM) {
use Opcode::*;
use OperandEncodingM::*;

Expand Down Expand Up @@ -4121,7 +4121,7 @@ fn get_m_opcode_and_encoding(tag: u8, word: &BitSlice<Lsb0, u8>) -> (Opcode, Ope
}
}

fn get_a_opcode_and_encoding(tag: u8, word: &BitSlice<Lsb0, u8>) -> (Opcode, OperandEncodingA) {
fn get_a_opcode_and_encoding(tag: u8, word: &BitSlice<u8, Lsb0>) -> (Opcode, OperandEncodingA) {
use Opcode::*;
use OperandEncodingA::*;

Expand Down