mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Debugger: Notate Memcpys directly as well.
This commit is contained in:
1 parent
88e2b9b740
commit
e7b968be73
13 files changed
+31
-33
No files matched your search
+3
-2
@@ -11,6 +11,7 @@
|
||||
#include "Core/CwCheat.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/MemMapHelpers.h"
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
#include "Core/ELF/ParamSFO.h"
|
||||
#include "Core/System.h"
|
||||
@@ -924,7 +925,7 @@ void CWCheatEngine::ExecuteOp(const CheatOperation &op, const CheatCode &cheat,
|
||||
InvalidateICache(op.addr, op.val);
|
||||
InvalidateICache(op.copyBytesFrom.destAddr, op.val);
|
||||
|
||||
Memory::MemcpyUnchecked(op.copyBytesFrom.destAddr, op.addr, op.val);
|
||||
Memory::Memcpy(op.copyBytesFrom.destAddr, op.addr, op.val, "CwCheat");
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1106,7 +1107,7 @@ void CWCheatEngine::ExecuteOp(const CheatOperation &op, const CheatCode &cheat,
|
||||
if (Memory::IsValidRange(dstAddr, val) && Memory::IsValidRange(srcAddr, val)) {
|
||||
InvalidateICache(dstAddr, val);
|
||||
InvalidateICache(srcAddr, val);
|
||||
Memory::MemcpyUnchecked(dstAddr, srcAddr, val);
|
||||
Memory::Memcpy(dstAddr, srcAddr, val, "CwCheat");
|
||||
}
|
||||
// Don't perform any further action.
|
||||
type = -1;
|
||||
|
||||
@@ -344,7 +344,7 @@ int PSPMsgDialog::Update(int animSpeed) {
|
||||
messageDialog.result = 0;
|
||||
}
|
||||
|
||||
Memory::Memcpy(messageDialogAddr, &messageDialog ,messageDialog.common.size);
|
||||
Memory::Memcpy(messageDialogAddr, &messageDialog, messageDialog.common.size, "MsgDialogParam");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -465,7 +465,7 @@ int PSPNetconfDialog::Update(int animSpeed) {
|
||||
}
|
||||
|
||||
if (GetStatus() == SCE_UTILITY_STATUS_FINISHED || pendingStatus == SCE_UTILITY_STATUS_FINISHED)
|
||||
Memory::Memcpy(requestAddr, &request, request.common.size);
|
||||
Memory::Memcpy(requestAddr, &request, request.common.size, "NetConfDialogParam");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1032,7 +1032,7 @@ int PSPSaveDialog::Update(int animSpeed)
|
||||
}
|
||||
|
||||
if (ReadStatus() == SCE_UTILITY_STATUS_FINISHED || pendingStatus == SCE_UTILITY_STATUS_FINISHED)
|
||||
Memory::Memcpy(requestAddr, &request, request.common.size);
|
||||
Memory::Memcpy(requestAddr, &request, request.common.size, "SaveDialogParam");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ HLEHelperThread::HLEHelperThread(const char *threadName, u32 instructions[], u32
|
||||
u32 instrBytes = instrCount * sizeof(u32);
|
||||
u32 totalBytes = instrBytes + sizeof(u32) * 2;
|
||||
AllocEntry(totalBytes);
|
||||
Memory::Memcpy(entry_, instructions, instrBytes);
|
||||
Memory::Memcpy(entry_, instructions, instrBytes, "HelperMIPS");
|
||||
|
||||
// Just to simplify things, we add the return here.
|
||||
Memory::Write_U32(MIPS_MAKE_JR_RA(), entry_ + instrBytes + 0);
|
||||
|
||||
@@ -50,7 +50,8 @@ static int __DmacMemcpy(u32 dst, u32 src, u32 size) {
|
||||
skip = gpu->PerformMemoryCopy(dst, src, size);
|
||||
}
|
||||
if (!skip) {
|
||||
Memory::Memcpy(dst, Memory::GetPointer(src), size);
|
||||
// TODO: InvalidateICache src before copy?
|
||||
Memory::Memcpy(dst, Memory::GetPointer(src), size, "DmacMemcpy");
|
||||
currentMIPS->InvalidateICache(dst, size);
|
||||
}
|
||||
|
||||
|
||||
@@ -1738,13 +1738,13 @@ bool __KernelLoadExec(const char *filename, u32 paramPtr, std::string *error_str
|
||||
if (param.args > 0) {
|
||||
u32 argpAddr = param.argp;
|
||||
param_argp = new u8[param.args];
|
||||
Memory::Memcpy(param_argp, argpAddr, param.args);
|
||||
Memory::Memcpy(param_argp, argpAddr, param.args, "KernelLoadParam");
|
||||
}
|
||||
if (param.keyp != 0) {
|
||||
u32 keyAddr = param.keyp;
|
||||
size_t keylen = strlen(Memory::GetCharPointer(keyAddr))+1;
|
||||
param_key = new u8[keylen];
|
||||
Memory::Memcpy(param_key, keyAddr, (u32)keylen);
|
||||
Memory::Memcpy(param_key, keyAddr, (u32)keylen, "KernelLoadParam");
|
||||
}
|
||||
|
||||
__KernelLoadReset();
|
||||
|
||||
@@ -105,7 +105,7 @@ struct MsgPipeWaitingThread
|
||||
|
||||
void ReadBuffer(u32 destPtr, u32 len)
|
||||
{
|
||||
Memory::Memcpy(destPtr, bufAddr + bufSize - freeSize, len);
|
||||
Memory::Memcpy(destPtr, bufAddr + bufSize - freeSize, len, "MsgPipeReadBuffer");
|
||||
freeSize -= len;
|
||||
if (transferredBytes.IsValid())
|
||||
*transferredBytes += len;
|
||||
@@ -113,7 +113,7 @@ struct MsgPipeWaitingThread
|
||||
|
||||
void WriteBuffer(u32 srcPtr, u32 len)
|
||||
{
|
||||
Memory::Memcpy(bufAddr + (bufSize - freeSize), srcPtr, len);
|
||||
Memory::Memcpy(bufAddr + (bufSize - freeSize), srcPtr, len, "MsgPipeWriteBuffer");
|
||||
freeSize -= len;
|
||||
if (transferredBytes.IsValid())
|
||||
*transferredBytes += len;
|
||||
@@ -399,7 +399,7 @@ static int __KernelSendMsgPipe(MsgPipe *m, u32 sendBufAddr, u32 sendSize, int wa
|
||||
|
||||
if (bytesToSend != 0)
|
||||
{
|
||||
Memory::Memcpy(m->buffer + (m->nmp.bufSize - m->nmp.freeSize), sendBufAddr, bytesToSend);
|
||||
Memory::Memcpy(m->buffer + (m->nmp.bufSize - m->nmp.freeSize), sendBufAddr, bytesToSend, "MsgPipeSend");
|
||||
m->nmp.freeSize -= bytesToSend;
|
||||
curSendAddr += bytesToSend;
|
||||
sendSize -= bytesToSend;
|
||||
@@ -492,7 +492,7 @@ static int __KernelReceiveMsgPipe(MsgPipe *m, u32 receiveBufAddr, u32 receiveSiz
|
||||
u32 bytesToReceive = std::min(receiveSize, m->GetUsedSize());
|
||||
if (bytesToReceive != 0)
|
||||
{
|
||||
Memory::Memcpy(curReceiveAddr, m->buffer, bytesToReceive);
|
||||
Memory::Memcpy(curReceiveAddr, m->buffer, bytesToReceive, "MsgPipeReceive");
|
||||
m->nmp.freeSize += bytesToReceive;
|
||||
memmove(Memory::GetPointer(m->buffer), Memory::GetPointer(m->buffer) + bytesToReceive, m->GetUsedSize());
|
||||
curReceiveAddr += bytesToReceive;
|
||||
|
||||
@@ -940,7 +940,7 @@ void __KernelThreadingInit()
|
||||
lastSwitchCycles = 0;
|
||||
idleThreadHackAddr = kernelMemory.Alloc(blockSize, false, "threadrethack");
|
||||
|
||||
Memory::Memcpy(idleThreadHackAddr, idleThreadCode, sizeof(idleThreadCode));
|
||||
Memory::Memcpy(idleThreadHackAddr, idleThreadCode, sizeof(idleThreadCode), "ThreadMIPS");
|
||||
|
||||
u32 pos = idleThreadHackAddr + sizeof(idleThreadCode);
|
||||
for (size_t i = 0; i < ARRAY_SIZE(threadHacks); ++i) {
|
||||
@@ -1288,7 +1288,7 @@ u32 sceKernelReferThreadStatus(u32 threadID, u32 statusPtr)
|
||||
|
||||
t->nt.nativeSize = THREADINFO_SIZE_AFTER_260;
|
||||
if (wantedSize != 0)
|
||||
Memory::Memcpy(statusPtr, &t->nt, std::min(wantedSize, (u32)sizeof(t->nt)));
|
||||
Memory::Memcpy(statusPtr, &t->nt, std::min(wantedSize, (u32)sizeof(t->nt)), "ThreadStatus");
|
||||
// TODO: What is this value? Basic tests show 0...
|
||||
if (wantedSize > sizeof(t->nt))
|
||||
Memory::Memset(statusPtr + sizeof(t->nt), 0, wantedSize - sizeof(t->nt), "ThreadStatus");
|
||||
@@ -1296,7 +1296,7 @@ u32 sceKernelReferThreadStatus(u32 threadID, u32 statusPtr)
|
||||
t->nt.nativeSize = THREADINFO_SIZE;
|
||||
u32 sz = std::min(THREADINFO_SIZE, wantedSize);
|
||||
if (sz != 0)
|
||||
Memory::Memcpy(statusPtr, &t->nt, sz);
|
||||
Memory::Memcpy(statusPtr, &t->nt, sz, "ThreadStatus");
|
||||
}
|
||||
|
||||
hleEatCycles(1400);
|
||||
@@ -1939,7 +1939,7 @@ SceUID __KernelSetupRootThread(SceUID moduleID, int args, const char *argp, int
|
||||
u32 location = currentMIPS->r[MIPS_REG_SP];
|
||||
currentMIPS->r[MIPS_REG_A1] = location;
|
||||
if (argp)
|
||||
Memory::Memcpy(location, argp, args);
|
||||
Memory::Memcpy(location, argp, args, "ThreadParam");
|
||||
// Let's assume same as starting a new thread, 64 bytes for safety/kernel.
|
||||
currentMIPS->r[MIPS_REG_SP] -= 64;
|
||||
|
||||
@@ -2044,8 +2044,7 @@ int __KernelStartThread(SceUID threadToStartID, int argSize, u32 argBlockPtr, bo
|
||||
|
||||
// Now copy argument to stack.
|
||||
if (!forceArgs && Memory::IsValidAddress(argBlockPtr)) {
|
||||
Memory::Memcpy(sp, argBlockPtr, argSize);
|
||||
NotifyMemInfo(MemBlockFlags::WRITE, argBlockPtr, argSize, "ThreadStartArgs");
|
||||
Memory::Memcpy(sp, argBlockPtr, argSize, "ThreadStartArgs");
|
||||
}
|
||||
|
||||
// On the PSP, there's an extra 64 bytes of stack eaten after the args.
|
||||
|
||||
@@ -514,7 +514,7 @@ u32 sceKernelReferVTimerStatus(SceUID uid, u32 statusAddr) {
|
||||
NativeVTimer status = vt->nvt;
|
||||
u32 size = Memory::Read_U32(statusAddr);
|
||||
status.current = __getVTimerCurrentTime(vt);
|
||||
Memory::Memcpy(statusAddr, &status, std::min(size, (u32)sizeof(status)));
|
||||
Memory::Memcpy(statusAddr, &status, std::min(size, (u32)sizeof(status)), "VTimerStatus");
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -524,8 +524,8 @@ static u32 sceMpegCreate(u32 mpegAddr, u32 dataPtr, u32 size, u32 ringbufferAddr
|
||||
Memory::Write_U32(mpegHandle, mpegAddr);
|
||||
|
||||
// Initialize fake mpeg struct.
|
||||
Memory::Memcpy(mpegHandle, "LIBMPEG\0", 8);
|
||||
Memory::Memcpy(mpegHandle + 8, "001\0", 4);
|
||||
Memory::Memcpy(mpegHandle, "LIBMPEG\0", 8, "Mpeg");
|
||||
Memory::Memcpy(mpegHandle + 8, "001\0", 4, "Mpeg");
|
||||
Memory::Write_U32(-1, mpegHandle + 12);
|
||||
if (ringbuffer.IsValid()) {
|
||||
Memory::Write_U32(ringbufferAddr, mpegHandle + 16);
|
||||
|
||||
+7
-10
@@ -28,31 +28,28 @@ extern MIPSState *currentMIPS;
|
||||
namespace Memory
|
||||
{
|
||||
|
||||
inline void Memcpy(const u32 to_address, const void *from_data, const u32 len)
|
||||
{
|
||||
inline void Memcpy(const u32 to_address, const void *from_data, const u32 len, const std::string &tag = "Memcpy") {
|
||||
u8 *to = GetPointer(to_address);
|
||||
if (to) {
|
||||
memcpy(to, from_data, len);
|
||||
NotifyMemInfo(MemBlockFlags::WRITE, to_address, len, "Memcpy");
|
||||
NotifyMemInfo(MemBlockFlags::WRITE, to_address, len, tag);
|
||||
}
|
||||
// if not, GetPointer will log.
|
||||
}
|
||||
|
||||
inline void Memcpy(void *to_data, const u32 from_address, const u32 len)
|
||||
{
|
||||
inline void Memcpy(void *to_data, const u32 from_address, const u32 len, const std::string &tag = "Memcpy") {
|
||||
const u8 *from = GetPointer(from_address);
|
||||
if (from) {
|
||||
memcpy(to_data, from, len);
|
||||
NotifyMemInfo(MemBlockFlags::READ, from_address, len, "Memcpy");
|
||||
NotifyMemInfo(MemBlockFlags::READ, from_address, len, tag);
|
||||
}
|
||||
// if not, GetPointer will log.
|
||||
}
|
||||
|
||||
inline void Memcpy(const u32 to_address, const u32 from_address, const u32 len)
|
||||
{
|
||||
inline void Memcpy(const u32 to_address, const u32 from_address, const u32 len, const std::string &tag = "Memcpy") {
|
||||
Memcpy(GetPointer(to_address), from_address, len);
|
||||
NotifyMemInfo(MemBlockFlags::READ, from_address, len, "Memcpy");
|
||||
NotifyMemInfo(MemBlockFlags::WRITE, to_address, len, "Memcpy");
|
||||
NotifyMemInfo(MemBlockFlags::READ, from_address, len, tag);
|
||||
NotifyMemInfo(MemBlockFlags::WRITE, to_address, len, tag);
|
||||
}
|
||||
|
||||
void Memset(const u32 _Address, const u8 _Data, const u32 _iLength, const std::string &tag = "Memset");
|
||||
|
||||
@@ -1260,7 +1260,7 @@ bool PPGeImage::Load() {
|
||||
return false;
|
||||
}
|
||||
|
||||
Memory::Memcpy(texture_, textureData, dataSize);
|
||||
Memory::Memcpy(texture_, textureData, dataSize, "PPGeTex");
|
||||
Memory::Memset(texture_ + dataSize, 0, texSize - dataSize, "PPGeTexClear");
|
||||
free(textureData);
|
||||
|
||||
|
||||
Reference in new issue
Block a user