示例#1
0
inline void WriteToHardware(u32 address, const T data)
{
	// Could just do a base-relative write, too.... TODO

	if ((address & 0x3E000000) == 0x08000000) {
		*(T*)GetPointerUnchecked(address) = data;
	}
	else if ((address & 0x3F800000) == 0x04000000) {
		*(T*)&m_pVRAM[address & VRAM_MASK] = data;
	}
	else if ((address & 0xBFFF0000) == 0x00010000) {
		*(T*)&m_pScratchPad[address & SCRATCHPAD_MASK] = data;
	}
	else if ((address & 0x3F000000) >= 0x08000000 && (address & 0x3F000000) < 0x08000000 + g_MemorySize) {
		*(T*)GetPointerUnchecked(address) = data;
	}
	else
	{
		if (g_Config.bJit) {
			WARN_LOG(MEMMAP, "WriteToHardware: Invalid address %08x", address);
		} else {
			WARN_LOG(MEMMAP, "WriteToHardware: Invalid address %08x	PC %08x LR %08x", address, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]);
		}
		static bool reported = false;
		if (!reported) {
			Reporting::ReportMessage("WriteToHardware: Invalid address %08x near PC %08x LR %08x", address, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]);
			reported = true;
		}
		if (!g_Config.bIgnoreBadMemAccess) {
			Core_EnableStepping(true);
			host->SetDebugMode(true);
		}
	}
}
示例#2
0
u8 *GetPointer(const u32 address)
{
	if ((address & 0x3E000000) == 0x08000000) {
		return GetPointerUnchecked(address);
	}
	else if ((address & 0x3F800000) == 0x04000000) {
		return m_pVRAM + (address & VRAM_MASK);
	}
	else if ((address & 0xBFFF0000) == 0x00010000) {
		return m_pScratchPad + (address & SCRATCHPAD_MASK);
	}
	else if ((address & 0x3F000000) >= 0x08000000 && (address & 0x3F000000) < 0x08000000 + g_MemorySize) {
		return GetPointerUnchecked(address);
	}
	else {
		ERROR_LOG(MEMMAP, "Unknown GetPointer %08x PC %08x LR %08x", address, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]);
		static bool reported = false;
		if (!reported) {
			Reporting::ReportMessage("Unknown GetPointer %08x PC %08x LR %08x", address, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]);
			reported = true;
		}
		if (!g_Config.bIgnoreBadMemAccess) {
			Core_EnableStepping(true);
			host->SetDebugMode(true);
		}
		return 0;
	}
}
示例#3
0
文件: MemMap.cpp 项目: Orphis/ppsspp
void Clear() {
	if (m_pPhysicalRAM)
		memset(GetPointerUnchecked(PSP_GetKernelMemoryBase()), 0, g_MemorySize);
	if (m_pPhysicalScratchPad)
		memset(m_pPhysicalScratchPad, 0, SCRATCHPAD_SIZE);
	if (m_pPhysicalVRAM1)
		memset(m_pPhysicalVRAM1, 0, VRAM_SIZE);
}
示例#4
0
inline void ReadFromHardware(T &var, const u32 address)
{
	// TODO: Figure out the fastest order of tests for both read and write (they are probably different).
	// TODO: Make sure this represents the mirrors in a correct way.

	// Could just do a base-relative read, too.... TODO

	if ((address & 0x3E000000) == 0x08000000) {
		var = *((const T*)GetPointerUnchecked(address));
	}
	else if ((address & 0x3F800000) == 0x04000000) {
		var = *((const T*)&m_pVRAM[address & VRAM_MASK]);
	}
	else if ((address & 0xBFFF0000) == 0x00010000) {
		// Scratchpad
		var = *((const T*)&m_pScratchPad[address & SCRATCHPAD_MASK]);
	}
	else if ((address & 0x3F000000) >= 0x08000000 && (address & 0x3F000000) < 0x08000000 + g_MemorySize) {
		var = *((const T*)GetPointerUnchecked(address));
	}
	else
	{
		if (g_Config.bJit) {
			WARN_LOG(MEMMAP, "ReadFromHardware: Invalid address %08x", address);
		} else {
			WARN_LOG(MEMMAP, "ReadFromHardware: Invalid address %08x PC %08x LR %08x", address, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]);
		}
		static bool reported = false;
		if (!reported) {
			Reporting::ReportMessage("ReadFromHardware: Invalid address %08x near PC %08x LR %08x", address, currentMIPS->pc, currentMIPS->r[MIPS_REG_RA]);
			reported = true;
		}
		if (!g_Config.bIgnoreBadMemAccess) {
			Core_EnableStepping(true);
			host->SetDebugMode(true);
		}
		var = 0;
	}
}