Fix a crash on invalid memory accesses
This commit is contained in:
parent
1102133475
commit
b8889b6857
|
@ -119,6 +119,8 @@ void EmuX86_IOWrite(xbaddr addr, uint32_t value, int size)
|
||||||
|
|
||||||
uint32_t EmuX86_Mem_Read(xbaddr addr, int size)
|
uint32_t EmuX86_Mem_Read(xbaddr addr, int size)
|
||||||
{
|
{
|
||||||
|
__try {
|
||||||
|
|
||||||
switch (size) {
|
switch (size) {
|
||||||
case sizeof(uint32_t) :
|
case sizeof(uint32_t) :
|
||||||
return *(uint32_t*)addr;
|
return *(uint32_t*)addr;
|
||||||
|
@ -130,10 +132,15 @@ uint32_t EmuX86_Mem_Read(xbaddr addr, int size)
|
||||||
// UNREACHABLE(size);
|
// UNREACHABLE(size);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
__except (true) {
|
||||||
|
EmuLog(LOG_PREFIX, LOG_LEVEL::WARNING, "EmuX86_Mem_Read Failed (0x%08X, %d)", addr, size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmuX86_Mem_Write(xbaddr addr, uint32_t value, int size)
|
void EmuX86_Mem_Write(xbaddr addr, uint32_t value, int size)
|
||||||
{
|
{
|
||||||
|
__try {
|
||||||
switch (size) {
|
switch (size) {
|
||||||
case sizeof(uint32_t) :
|
case sizeof(uint32_t) :
|
||||||
*(uint32_t*)addr = (uint32_t)value;
|
*(uint32_t*)addr = (uint32_t)value;
|
||||||
|
@ -148,6 +155,10 @@ void EmuX86_Mem_Write(xbaddr addr, uint32_t value, int size)
|
||||||
// UNREACHABLE(size);
|
// UNREACHABLE(size);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
__except (true) {
|
||||||
|
EmuLog(LOG_PREFIX, LOG_LEVEL::WARNING, "EmuX86_Mem_Write Failed (0x%08X, 0x%08X, %d)", addr, value, size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t EmuFlash_Read32(xbaddr addr) // TODO : Move to EmuFlash.cpp
|
uint32_t EmuFlash_Read32(xbaddr addr) // TODO : Move to EmuFlash.cpp
|
||||||
|
@ -1179,8 +1190,12 @@ bool EmuX86_DecodeException(LPEXCEPTION_POINTERS e)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case I_RET:
|
case I_CALL: case I_RET:
|
||||||
// RET always signifies the end of a code block
|
// RET and CALL always signify the end of a code block
|
||||||
|
return true;
|
||||||
|
case I_PUSH: case I_POP:
|
||||||
|
// TODO: Implement these instructions
|
||||||
|
// currently stubbed to prevent firing the unimplemented instruction handler
|
||||||
return true;
|
return true;
|
||||||
case I_ADD:
|
case I_ADD:
|
||||||
if (EmuX86_Opcode_ADD(e, info)) break;
|
if (EmuX86_Opcode_ADD(e, info)) break;
|
||||||
|
|
Loading…
Reference in New Issue