Skip to main content

Cop0Access

Enum Cop0Access 

Source
pub enum Cop0Access {
    Read {
        src: u8,
        dest: u8,
        wide: bool,
    },
    Cop1(Cop1Access),
    Tlb(TlbOp),
    Eret,
    Write {
        dest: u8,
        value: u64,
        wide: bool,
    },
}
Expand description

A coprocessor access that EX resolved but must not itself perform.

Despite the name this now covers COP0, the TLB and COP1 control (Cop1). They share a variant because they share the stage split below, not because they are the same unit — the name is kept for churn reasons and this note exists so it does not mislead as COP1 grows in Sprint 3.

The stage split is the manual’s, not a convenience: UM §4.6.9 describes the CP0 bypass interlock as firing when “an instruction which caused an exception reaches the WB stage and the subsequent instruction in the DC stage requests a read of any CP0 register” — so a coprocessor read happens in DC and a write happens in WB. Performing both in EX would make that interlock unexpressible, which is the same mistake ADR 0007 exists to prevent one level up.

Variants§

§

Read

Read COP0 register src into GPR dest, in DC.

Fields

§src: u8

COP0 register number.

§dest: u8

GPR destination.

§wide: bool

64-bit (DMFC0) rather than 32-bit sign-extended (MFC0).

§

Cop1(Cop1Access)

A COP1 control access, performed where the state lives.

§

Tlb(TlbOp)

A TLB instruction. Performed where the TLB lives, not in EX.

§

Eret

ERET — restore PC from EPC/ErrorEPC, clear EXL/ERL, clear the link bit.

Cannot be resolved in EX like an ordinary redirect, because the target comes out of COP0 rather than out of the instruction.

§

Write

Write value to COP0 register dest, in WB.

Fields

§dest: u8

COP0 register number.

§value: u64

Value from rt.

§wide: bool

64-bit (DMTC0) rather than 32-bit (MTC0).

Trait Implementations§

Source§

impl Clone for Cop0Access

Source§

fn clone(&self) -> Cop0Access

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Cop0Access

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Cop0Access

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Cop0Access

Source§

fn eq(&self, other: &Cop0Access) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Cop0Access

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for Cop0Access

Source§

impl Eq for Cop0Access

Source§

impl StructuralPartialEq for Cop0Access

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,