Struct machina::cache::Cache
[−]
[src]
pub struct Cache { /* fields omitted */ }
Manages the instructions.
Methods
impl Cache
[src]
fn new() -> Cache
[src]
fn set_stub(&mut self, stub: usize)
[src]
Sets the stub.
stub
- The new stub
Examples
use machina::cache::Cache; let mut cache = Cache::new(); cache.set_stub(0x31313131);
fn insert(&mut self, name: String, asm: Vec<u8>)
[src]
Insert without stub
name
- The identifierasm
- The bytes
Examples
use machina::cache::Cache; let mut cache = Cache::new(); cache.insert("inc_rax".to_string(), vec![0x48, 0xff, 0xc0]);
fn insert_with_stub(&mut self, name: String, asm: Vec<u8>)
[src]
Insert with stub
name
- The identifierasm
- 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)
fn get(&self, name: String) -> Vec<u8>
[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());
fn get_stub(&mut self, name: String, value: usize) -> Vec<u8>
[src]
Get with loading the stub
name
- The identifiervalue
- 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