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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.