pub trait GuestCpu {
type IrContext;
fn get_pc(&self) -> u64;
fn get_flags(&self) -> u32;
fn gen_code(
&mut self,
ir: &mut Self::IrContext,
pc: u64,
max_insns: u32,
) -> u32;
fn env_ptr(&mut self) -> *mut u8;
fn pending_interrupt(&self) -> bool {
false
}
fn pending_wfi_wakeup(&self) -> bool {
self.pending_interrupt()
}
fn is_halted(&self) -> bool {
false
}
fn set_halted(&mut self, _halted: bool) {}
fn privilege_level(&self) -> u8 {
0
}
fn handle_interrupt(&mut self) {}
fn handle_exception(&mut self, _cause: u64, _tval: u64) {}
fn execute_mret(&mut self) {}
fn execute_sret(&mut self) -> bool {
true
}
fn set_jmp_env(&mut self, _ptr: u64) {}
fn clear_jmp_env(&mut self) {}
fn tlb_flush(&mut self) {}
fn tlb_flush_page(&mut self, _vpn: u64) {}
fn handle_priv_csr(&mut self) -> bool {
false
}
fn should_exit(&self) -> bool {
false
}
fn check_monitor_pause(&self) -> bool {
false
}
fn check_mem_fault(&mut self) -> bool {
false
}
fn take_tb_flush_pending(&mut self) -> bool {
false
}
fn last_phys_pc(&self) -> u64 {
0
}
fn translate_pc(&self, _vpc: u64) -> u64 {
u64::MAX
}
fn take_dirty_pages(&mut self) -> Vec<u64> {
Vec::new()
}
fn wait_for_interrupt(&self) -> bool {
false
}
fn gdb_read_registers(&self, _buf: &mut [u8]) -> usize {
0
}
fn gdb_write_registers(&mut self, _buf: &[u8]) -> usize {
0
}
fn gdb_read_register(&self, _reg: usize, _buf: &mut [u8]) -> usize {
0
}
fn gdb_write_register(&mut self, _reg: usize, _buf: &[u8]) -> usize {
0
}
}