ME: sceSysreg_driver's ME reset and clock calls, MMIO copies in sysclib

The calls homebrew starts the ME with (1.50's NIDs, and 3.71's for the
ME's reset and bus clock) set or clear a bit of the reset or bus clock
register the way the firmware's driver does, returning whether it was
set. Only those NIDs, so a later firmware's lowio.prx keeps its own
exports under --vsh.

Kernel modules copy their ME code to the boot page with SysclibForKernel's
memcpy, which now goes through MMIO for hardware addresses like the
replaced memcpy already did (MMIO::Copy, shared).

pspsdk's mebasic, MElib's test, PSP Bunny, snes9xTYL and ProTrekkr's test
now start their ME.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-21 12:06:11 +02:00
1 parent 5bc6dcdc72
commit 8af7643efa
14 files changed
+174 -34

No files matched your search

+9 -4
View File
@@ -31,6 +31,7 @@
#include "Core/HLE/ErrorCodes.h"
#include "Core/MIPS/MIPS.h"
#include "Core/MIPS/MeCore.h"
#include "Core/HW/MMIO.h"
#include "Core/Debugger/MemBlockInfo.h"
#include "Core/HLE/sceKernel.h"
@@ -812,8 +813,10 @@ const HLEFunction Kernel_Library[] =
{0X4AC57943, &WrapI_I<sceKernelRegisterExitCallback>, "sceKernelRegisterExitCallback", 'i', "i" },
};
static u32 sysclib_memcpy(u32 dst, u32 src, u32 size) {
if (Memory::IsValidRange(dst, size) && Memory::IsValidRange(src, size)) {
static u32 sysclib_memcpy(MIPSState *mips, u32 dst, u32 src, u32 size) {
if (MMIO::Copy(mips, dst, src, size)) {
// To or from hardware registers.
} else if (Memory::IsValidRange(dst, size) && Memory::IsValidRange(src, size)) {
memcpy(Memory::GetPointerWriteUnchecked(dst), Memory::GetPointerUnchecked(src), size);
}
if (MemBlockInfoDetailed(size)) {
@@ -957,8 +960,10 @@ static int sysclib_strncmp(u32 s1, u32 s2, u32 size) {
return hleLogError(Log::sceKernel, 0, "Bad addresses");
}
static u32 sysclib_memmove(u32 dst, u32 src, u32 size) {
if (Memory::IsValidRange(dst, size) && Memory::IsValidRange(src, size)) {
static u32 sysclib_memmove(MIPSState *mips, u32 dst, u32 src, u32 size) {
if (MMIO::Copy(mips, dst, src, size)) {
// To or from hardware registers.
} else if (Memory::IsValidRange(dst, size) && Memory::IsValidRange(src, size)) {
memmove(Memory::GetPointerWriteUnchecked(dst), Memory::GetPointerUnchecked(src), size);
}
if (MemBlockInfoDetailed(size)) {