Skip to main content

CpuOps

Trait CpuOps 

Source
pub trait CpuOps {
    // Required methods
    fn read_reg(&self, reg: Register) -> u32;
    fn write_reg(&mut self, reg: Register, value: u32);
    fn get_ccr(&self) -> u8;
    fn set_ccr(&mut self, ccr: u8);

    // Provided methods
    fn capture_extended_context(&self) -> Option<M68kExtendedContext> { ... }
    fn restore_extended_context(&mut self, _context: &M68kExtendedContext) { ... }
}
Expand description

Register interface used by the trap dispatcher.

Keeping handlers generic over this subset lets them operate on both the production M68kCpu backend and test doubles without exposing the full m68k architectural state.

Required Methods§

Source

fn read_reg(&self, reg: Register) -> u32

Read the current value of a single register.

Source

fn write_reg(&mut self, reg: Register, value: u32)

Write a value into a single register.

Source

fn get_ccr(&self) -> u8

Read the condition code register (CCR) byte.

Source

fn set_ccr(&mut self, ccr: u8)

Set the condition code register (CCR).

The low five bits are X(4), N(3), Z(2), V(1), and C(0).

Provided Methods§

Source

fn capture_extended_context(&self) -> Option<M68kExtendedContext>

Capture additional architectural task state when this adapter has it. Register-only adapters retain their existing integer/CCR behavior.

Source

fn restore_extended_context(&mut self, _context: &M68kExtendedContext)

Restore state captured by this adapter before installing A7: restoring SR can change the selected stack bank. Register-only adapters have no additional state; backends returning Some must implement this method.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§