Struct machina::cache::Cache [] [src]

pub struct Cache { /* fields omitted */ }

Manages the instructions.

Methods

impl Cache
[src]

[src]

Constructs a new Cache.

Examples

use machina::cache::Cache;

let cache = Cache::new();

[src]

Sets the stub.

  • stub - The new stub

Examples

use machina::cache::Cache;

let mut cache = Cache::new();
cache.set_stub(0x31313131);

[src]

Insert without stub

  • name - The identifier
  • asm - The bytes

Examples

use machina::cache::Cache;

let mut cache = Cache::new();
cache.insert("inc_rax".to_string(), vec![0x48, 0xff, 0xc0]);

[src]

Insert with stub

  • name - The identifier
  • asm - The bytes

Examples

use machina::cache::{Cache,STUB};

let mut cache = Cache::new();
cache.insert_with_stub("mov_rax_x".to_string(), vec![0x48, 0xc7, 0xc0, 0x37, 0x13, 0x37, 0x13]); // bytes with `STUB` (default: 0x13371337)

[src]

Get without loading the stub

  • name - The identifier

Examples

use machina::cache::Cache;

let mut cache = Cache::new();
cache.insert("inc_rax".to_string(), vec![0x48, 0xff, 0xc0]);
let _ = cache.get("inc_rax".to_string());

[src]

Get with loading the stub

  • name - The identifier
  • value - The stub replacement

Examples

use machina::cache::{Cache,STUB};

let mut cache = Cache::new();
cache.insert_with_stub("mov_rax_x".to_string(), vec![0x48, 0xc7, 0xc0, 0x37, 0x13, 0x37, 0x13]); // bytes with STUB (default: 0x13371337)
let _ = cache.get_stub("mov_rax_x".to_string(), 0x69696969); // replace STUB with 0x69696969