Remove printf usage.

This commit is contained in:
Jean-Philip Desjardins 2017-12-21 22:59:05 -05:00
parent 844f5ca4b5
commit faf2f4873b

View File

@ -1,5 +1,8 @@
#include "MemoryUtils.h"
#include "Integer64.h"
#include "Log.h"
#define LOG_NAME "MemoryMap"
uint32 MemoryUtils_GetByteProxy(CMIPS* pCtx, uint32 nAddress)
{
@ -19,12 +22,12 @@ uint32 MemoryUtils_GetWordProxy(CMIPS* pCtx, uint32 nAddress)
uint64 MemoryUtils_GetDoubleProxy(CMIPS* context, uint32 address)
{
assert((address & 0x07) == 0);
const CMemoryMap::MEMORYMAPELEMENT* e = context->m_pMemoryMap->GetReadMap(address);
auto e = context->m_pMemoryMap->GetReadMap(address);
INTEGER64 result;
#ifdef _DEBUG
result.q = 0xCCCCCCCCCCCCCCCCull;
#endif
if(e != NULL)
if(e)
{
switch(e->nType)
{
@ -48,12 +51,12 @@ uint64 MemoryUtils_GetDoubleProxy(CMIPS* context, uint32 address)
uint128 MemoryUtils_GetQuadProxy(CMIPS* context, uint32 address)
{
address &= ~0x0F;
const CMemoryMap::MEMORYMAPELEMENT* e = context->m_pMemoryMap->GetReadMap(address);
auto e = context->m_pMemoryMap->GetReadMap(address);
uint128 result;
#ifdef _DEBUG
memset(&result, 0xCC, sizeof(result));
#endif
if(e != NULL)
if(e)
{
switch(e->nType)
{
@ -94,10 +97,10 @@ void MemoryUtils_SetDoubleProxy(CMIPS* context, uint64 value64, uint32 address)
assert((address & 0x07) == 0);
INTEGER64 value;
value.q = value64;
const CMemoryMap::MEMORYMAPELEMENT* e = context->m_pMemoryMap->GetWriteMap(address);
if(e == NULL)
auto e = context->m_pMemoryMap->GetWriteMap(address);
if(!e)
{
printf("MemoryMap: Wrote to unmapped memory (0x%08X, [0x%08X, 0x%08X]).\r\n",
CLog::GetInstance().Print(LOG_NAME, "Wrote to unmapped memory (0x%08X, [0x%08X, 0x%08X]).\r\n",
address, value.d0, value.d1);
return;
}
@ -121,10 +124,10 @@ void MemoryUtils_SetDoubleProxy(CMIPS* context, uint64 value64, uint32 address)
void MemoryUtils_SetQuadProxy(CMIPS* context, const uint128& value, uint32 address)
{
address &= ~0x0F;
const CMemoryMap::MEMORYMAPELEMENT* e = context->m_pMemoryMap->GetWriteMap(address);
if(e == NULL)
auto e = context->m_pMemoryMap->GetWriteMap(address);
if(!e)
{
printf("MemoryMap: Wrote to unmapped memory (0x%08X, [0x%08X, 0x%08X, 0x%08X, 0x%08X]).\r\n",
CLog::GetInstance().Print(LOG_NAME, "Wrote to unmapped memory (0x%08X, [0x%08X, 0x%08X, 0x%08X, 0x%08X]).\r\n",
address, value.nV0, value.nV1, value.nV2, value.nV3);
return;
}