Initial commit: xenia-rs workspace for Xbox 360 RE
Rust reimplementation of the xenia Xbox 360 emulator targeting reverse- engineering and preservation, initially scoped to Project Sylpheed. Includes: - XEX2 loader (LZX decompression, AES decryption, PE parsing) - XISO / XGD2 disc image VFS - PPC interpreter with 200+ opcodes and VMX128 decoding - Static analyzer: functions, cross-references, labels, asm + SQLite output - HLE kernel covering the xboxkrnl/xam subset used by Sylpheed init - Debugger with in-memory and SQLite-backed execution tracing - `xenia-rs` CLI with extract/dis/exec commands that produce cumulative, superset SQLite databases and opt-in instruction/import/branch traces Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
27
crates/xenia-memory/src/mmio.rs
Normal file
27
crates/xenia-memory/src/mmio.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
/// Represents a mapped MMIO region with read/write callbacks.
|
||||
/// Instead of trapping access violations (as the C++ JIT does), the interpreter
|
||||
/// explicitly checks each memory access against registered MMIO regions.
|
||||
pub struct MmioRegion {
|
||||
pub base_address: u32,
|
||||
pub mask: u32,
|
||||
pub size: u32,
|
||||
pub read_callback: Box<dyn Fn(u32) -> u32 + Send + Sync>,
|
||||
pub write_callback: Box<dyn Fn(u32, u32) + Send + Sync>,
|
||||
}
|
||||
|
||||
impl MmioRegion {
|
||||
pub fn contains(&self, addr: u32) -> bool {
|
||||
let masked = addr & self.mask;
|
||||
masked >= self.base_address && masked < self.base_address + self.size
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for MmioRegion {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("MmioRegion")
|
||||
.field("base_address", &format_args!("{:#010x}", self.base_address))
|
||||
.field("mask", &format_args!("{:#010x}", self.mask))
|
||||
.field("size", &format_args!("{:#x}", self.size))
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user