Skip to content

Fixing accesses to the pcsx IO system. #1946

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/mips/common/hardware/pcsxhw.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,28 @@ static __inline__ void pcsx_initMsan() { *((volatile char* const)0x1f802089) = 0
static __inline__ void pcsx_resetMsan() { *((volatile char* const)0x1f802089) = 1; }
static __inline__ void* pcsx_msanAlloc(uint32_t size) {
register uint32_t a0 asm("a0") = size;
return *((void* volatile* const)0x1f80208c);
void* ret;
__asm__ volatile("lw %0, 0x208c(%1)" : "=r"(ret) : "r"(0x1f800000), "r"(a0));
return ret;
}
static __inline__ void pcsx_msanFree(void* ptr) { *((void* volatile* const)0x1f80208c) = ptr; }
static __inline__ void* pcsx_msanRealloc(void* ptr, uint32_t size) {
register void* a0 asm("a0") = ptr;
register uint32_t a1 asm("a1") = size;
return *((void* volatile* const)0x1f802090);
void* ret;
__asm__ volatile("lw %0, 0x2090(%1)" : "=r"(ret) : "r"(0x1f800000), "r"(a0), "r"(a1));
return ret;
}
static __inline__ void pcsx_msanSetChainPtr(void* headerAddr, void* ptrToNext, uint32_t wordCount) {
register void* a0 asm("a0") = ptrToNext;
register uint32_t a1 asm("a1") = wordCount;
*((void* volatile* const)0x1f802094) = headerAddr;
__asm__ volatile("sw %0, 0x2094(%1)" : : "r"(a0), "r"(0x1f800000), "r"(a1));
}
static __inline__ void* pcsx_msanGetChainPtr(void* headerAddr) {
register void* a0 asm("a0") = headerAddr;
return *((void* volatile* const)0x1f802094);
void* ret;
__asm__ volatile("lw %0, 0x2094(%1)" : "=r"(ret) : "r"(0x1f800000), "r"(a0));
return ret;
}

static __inline__ int pcsx_present() { return *((volatile uint32_t* const)0x1f802080) == 0x58534350; }
3 changes: 1 addition & 2 deletions src/mips/psyqo/examples/pcsxlua/pcsxlua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ PCSXLuaScene pcsxLuaScene;
void pcsxRegisterVariable(void* address, const char* name) {
register void* a0 asm("a0") = address;
register const char* a1 asm("a1") = name;
__asm__ volatile("" : : "r"(a0), "r"(a1));
*((volatile uint8_t* const)0x1f802081) = 255;
__asm__ volatile("sw %0, 0x2081(%1)" : : "r"(255), "r"(0x1f800000), "r"(a0), "r"(a1));
}

} // namespace
Expand Down
Loading