Skip to content

armgit / gecko

Public Imported from GitHub
0

A GameCube/Wii emulator and debugger written in Rust.

prepare for psq and bump chipi (fix for newtype gen)

Laylee5ea4acc4f55
diff --git a/Cargo.lock b/Cargo.lock
index 9cc4a16..3fe282c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -324,9 +324,9 @@ dependencies = [
[[package]]
name = "chipi"
-version = "0.5.2"
+version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d6f9cba4e5437c22ff9f898fb06bfa88c616cc908ea69b634c53497b2d5b50e8"
+checksum = "a7d2ab3ac8eccf8652db81b52914ee4822e03efb764d16e72791a46366071032"
[[package]]
name = "clap"
diff --git a/crates/disasm/Cargo.toml b/crates/disasm/Cargo.toml
index 1818c30..095f718 100644
--- a/crates/disasm/Cargo.toml
+++ b/crates/disasm/Cargo.toml
@@ -4,4 +4,4 @@ version = "0.1.0"
edition = "2024"
[build-dependencies]
-chipi = "0.5.2"
\ No newline at end of file
+chipi = "0.5.3"
\ No newline at end of file
diff --git a/crates/gekko/Cargo.toml b/crates/gekko/Cargo.toml
index 44e1afc..553a532 100644
--- a/crates/gekko/Cargo.toml
+++ b/crates/gekko/Cargo.toml
@@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2024"
[build-dependencies]
-chipi = "0.5.1"
+chipi = "0.5.3"
[dependencies]
chapa = { git = "https://github.com/ioncodes/chapa.git" }
diff --git a/crates/gekko/build.rs b/crates/gekko/build.rs
index 470d2ab..b049f86 100644
--- a/crates/gekko/build.rs
+++ b/crates/gekko/build.rs
@@ -63,6 +63,12 @@ fn main() {
"stfsx", "stfsux", "stfdx", "stfdux",
],
)
+ .group(
+ "store_load_psq",
+ [
+ "psq_l", "psq_lu", "psq_st", "psq_stu", "psq_lx", "psq_lux", "psq_stx", "psq_stux",
+ ],
+ )
.group("compare", ["cmp", "cmpi", "cmpli", "cmpl"])
.group(
"nop",
diff --git a/crates/gekko/src/cpu/interpreter.rs b/crates/gekko/src/cpu/interpreter.rs
index be4ef9c..ed798a8 100644
--- a/crates/gekko/src/cpu/interpreter.rs
+++ b/crates/gekko/src/cpu/interpreter.rs
@@ -14,6 +14,6 @@ pub use compare::compare;
pub use cr_ops::cr_ops;
pub use fp_ops::fp_ops;
pub use rotate::rotate;
-pub use store_load::{lwarx, store_load, store_load_fp, stwcx_dot};
+pub use store_load::{lwarx, store_load, store_load_fp, store_load_psq, stwcx_dot};
pub use stubs::*;
pub use system::{mftb, msr, nop, segment, spr};
diff --git a/crates/gekko/src/cpu/interpreter/store_load.rs b/crates/gekko/src/cpu/interpreter/store_load.rs
index b3f25e0..5cdd0f7 100644
--- a/crates/gekko/src/cpu/interpreter/store_load.rs
+++ b/crates/gekko/src/cpu/interpreter/store_load.rs
@@ -252,3 +252,16 @@ pub fn store_load_fp<const OP: u32>(ctx: &mut crate::gekko::Gekko, instr: crate:
_ => todo!("FP Store/Load instruction with OP = {OP:#x}"),
}
}
+
+pub fn store_load_psq<const OP: u32>(ctx: &mut crate::gekko::Gekko, instr: crate::cpu::semantics::Instruction) {
+ match OP {
+ crate::cpu::lut::OP_PSQ_L => {
+ let addr = ctx
+ .cpu
+ .read_gpr_or_zero(instr.ra())
+ .wrapping_add_signed(instr.disp_psq());
+
+ }
+ _ => todo!("PSQ Store/Load instruction with OP = {OP:#x}"),
+ }
+}
diff --git a/crates/gekko/src/cpu/semantics.rs b/crates/gekko/src/cpu/semantics.rs
index d3fbd56..ecfca6e 100644
--- a/crates/gekko/src/cpu/semantics.rs
+++ b/crates/gekko/src/cpu/semantics.rs
@@ -3,12 +3,12 @@ include!(concat!(env!("OUT_DIR"), "/gekko_instr.rs"));
impl Instruction {
#[inline]
pub fn disp(&self) -> i32 {
- self.d_15_0()
+ self.d_16_31()
}
#[inline]
- pub fn d_psq(&self) -> i32 {
- self.d_11_0()
+ pub fn disp_psq(&self) -> i32 {
+ self.d_20_31()
}
/// The SPR field in PowerPC instructions has a special encoding where