pub struct Cpu { /* private fields */ }
Expand description
An emulated CPU which implements the ARMv4T instruction set.
Implementations§
Source§impl Cpu
impl Cpu
Sourcepub fn new() -> Cpu
pub fn new() -> Cpu
Construct a new ARMv4T Cpu
, with registers set to default “cold-boot”
values.
Specifically, PC
is set to 0x00000000
, and CPSR
is set to 0xd3
(ARM state, Supervisor mode, FIQ and IRQ mask bits set). Technically,
the ARM spec states that all other registers can have undefined values
on-boot, but in this emulator, all registers are set to 0 on-boot.
Sourcepub fn step(&mut self, mem: &mut impl Memory) -> bool
pub fn step(&mut self, mem: &mut impl Memory) -> bool
Step the CPU a single instruction with the given memory object.
As a testing convenience, this method returns false if a undefined instruction exception is triggered.
Sourcepub fn thumb_mode(&self) -> bool
pub fn thumb_mode(&self) -> bool
Check if CPU is currently in Thumb mode.
Sourcepub fn irq_enable(&self) -> bool
pub fn irq_enable(&self) -> bool
Check if IRQs are enabled.
Sourcepub fn fiq_enable(&self) -> bool
pub fn fiq_enable(&self) -> bool
Check if FIQs are enabled.
Trait Implementations§
impl Copy for Cpu
impl Eq for Cpu
impl StructuralPartialEq for Cpu
Auto Trait Implementations§
impl Freeze for Cpu
impl RefUnwindSafe for Cpu
impl Send for Cpu
impl Sync for Cpu
impl Unpin for Cpu
impl UnwindSafe for Cpu
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more