Expand description
Rust bindings for the libloong LoongArch emulator
This crate provides safe Rust bindings to the libloong C++ library, a high-performance LoongArch 64-bit emulator.
§Example
use libloong::{Machine, MachineOptions};
use std::fs;
// Load a LoongArch ELF binary
let binary = fs::read("program.elf").expect("Failed to read ELF");
// Create machine with default options
let mut machine = Machine::new(&binary, MachineOptions::default())
.expect("Failed to create machine");
// Setup Linux environment
machine.setup_linux(&["program"], &[])
.expect("Failed to setup Linux");
// Execute the program
machine.simulate(u64::MAX)
.expect("Failed to simulate");
println!("Instructions executed: {}", machine.instruction_counter());Structs§
- Machine
- The main LoongArch emulator machine
- Machine
Options - Machine options for configuring the emulator
Enums§
- Error
- Error type for libloong operations
- Exception
Type - Exception details from the guest
- Function
Ref - Represents either a function address or function name for vmcall operations
Functions§
- set_
stdout_ callback - Set a global stdout callback for all machines