Struct bad64::Instruction [−][src]
pub struct Instruction { /* fields omitted */ }Expand description
A decoded instruction
Implementations
Returns the instruction address
Example
use bad64::decode;
// nop - "\x1f\x20\x03\xd5"
let decoded = decode(0xd503201f, 0x1000).unwrap();
assert_eq!(decoded.address(), 0x1000);Returns the instruction opcode
Example
use bad64::decode;
// nop - "\x1f\x20\x03\xd5"
let decoded = decode(0xd503201f, 0x1000).unwrap();
assert_eq!(decoded.opcode(), 0xd503201f);Returns the instruction operation
Example
use bad64::{decode, Op};
// nop - "\x1f\x20\x03\xd5"
let decoded = decode(0xd503201f, 0x1000).unwrap();
assert_eq!(decoded.op(), Op::NOP);Returns a slice of Operands
Example
use bad64::{decode, Operand, Reg};
// eor x0, x1, x2 - "\x20\x00\x02\xca"
let decoded = decode(0xca020020, 0x1000).unwrap();
let mut ops = decoded.operands();
assert_eq!(ops.len(), 3);
assert_eq!(ops[0], Operand::Reg { reg: Reg::X0, arrspec: None });
assert_eq!(ops[1], Operand::Reg { reg: Reg::X1, arrspec: None });
assert_eq!(ops[2], Operand::Reg { reg: Reg::X2, arrspec: None });Returns if the instruction updates the flags
Example
use bad64::decode;
// cmp x0, #0x41 - "\x1f\x04\x01\xf1"
let decoded = decode(0xf101041f, 0x1000).unwrap();
assert_eq!(decoded.flags_set(), true);
// nop - "\x1f\x20\x03\xd5"
let decoded = decode(0xd503201f, 0x1000).unwrap();
assert_eq!(decoded.flags_set(), false);Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Instruction
impl Send for Instruction
impl Sync for Instruction
impl Unpin for Instruction
impl UnwindSafe for Instruction
Blanket Implementations
Mutably borrows from an owned value. Read more
