Implement svcBreak

merge-requests/60/head
archshift 2015-05-16 22:06:59 +07:00
parent 9fb9750411
commit 11057488f9
2 changed files with 17 additions and 1 deletions

@ -166,6 +166,10 @@ template<void func(const char*)> void Wrap() {
func((char*)Memory::GetPointer(PARAM(0))); func((char*)Memory::GetPointer(PARAM(0)));
} }
template<void func(u8)> void Wrap() {
func((u8)PARAM(0));
}
#undef PARAM #undef PARAM
#undef FuncReturn #undef FuncReturn

@ -296,6 +296,18 @@ static ResultCode ArbitrateAddress(Handle handle, u32 address, u32 type, u32 val
return res; return res;
} }
static void Break(u8 break_reason) {
LOG_CRITICAL(Debug_Emulated, "Emulated program broke execution!");
std::string reason_str;
switch (break_reason) {
case 0: reason_str = "PANIC"; break;
case 1: reason_str = "ASSERT"; break;
case 2: reason_str = "USER"; break;
default: reason_str = "UNKNOWN"; break;
}
LOG_CRITICAL(Debug_Emulated, "Break reason: %s", reason_str.c_str());
}
/// Used to output a message on a debug hardware unit - does nothing on a retail unit /// Used to output a message on a debug hardware unit - does nothing on a retail unit
static void OutputDebugString(const char* string) { static void OutputDebugString(const char* string) {
LOG_DEBUG(Debug_Emulated, "%s", string); LOG_DEBUG(Debug_Emulated, "%s", string);
@ -737,7 +749,7 @@ static const FunctionDef SVC_Table[] = {
{0x39, HLE::Wrap<GetResourceLimitLimitValues>, "GetResourceLimitLimitValues"}, {0x39, HLE::Wrap<GetResourceLimitLimitValues>, "GetResourceLimitLimitValues"},
{0x3A, HLE::Wrap<GetResourceLimitCurrentValues>, "GetResourceLimitCurrentValues"}, {0x3A, HLE::Wrap<GetResourceLimitCurrentValues>, "GetResourceLimitCurrentValues"},
{0x3B, nullptr, "GetThreadContext"}, {0x3B, nullptr, "GetThreadContext"},
{0x3C, nullptr, "Break"}, {0x3C, HLE::Wrap<Break>, "Break"},
{0x3D, HLE::Wrap<OutputDebugString>, "OutputDebugString"}, {0x3D, HLE::Wrap<OutputDebugString>, "OutputDebugString"},
{0x3E, nullptr, "ControlPerformanceCounter"}, {0x3E, nullptr, "ControlPerformanceCounter"},
{0x3F, nullptr, "Unknown"}, {0x3F, nullptr, "Unknown"},