mirror of
https://github.com/zeldaret/tww.git
synced 2026-07-11 14:38:38 -04:00
m_Do_printf match, JUTException errorHandler match
This commit is contained in:
+1
-1
@@ -251,7 +251,7 @@ config.libs = [
|
||||
"objects": [
|
||||
# machine
|
||||
Object(Matching, "m_Do/m_Do_main.cpp"),
|
||||
Object(NonMatching, "m_Do/m_Do_printf.cpp"),
|
||||
Object(Matching, "m_Do/m_Do_printf.cpp"),
|
||||
Object(NonMatching, "m_Do/m_Do_audio.cpp"),
|
||||
Object(NonMatching, "m_Do/m_Do_controller_pad.cpp"),
|
||||
Object(NonMatching, "m_Do/m_Do_graphic.cpp"),
|
||||
|
||||
@@ -121,7 +121,6 @@ u32 JUTException::fpscr;
|
||||
|
||||
/* 802C4CEC-802C5084 .text errorHandler__12JUTExceptionFUsP9OSContextUlUl */
|
||||
void JUTException::errorHandler(OSError error, OSContext* context, u32 param_3, u32 param_4) {
|
||||
/* Nonmatching */
|
||||
if (error == 0x10) {
|
||||
OSReport("\x1b[41;37m");
|
||||
OSReport(" FPE: 浮動小数点例外が発生しました。アドレスは %08x fpscr=%08x\n", context->srr0, context->fpscr);
|
||||
@@ -134,9 +133,10 @@ void JUTException::errorHandler(OSError error, OSContext* context, u32 param_3,
|
||||
search_name_part((u8*)stack_3c, stack_38, 0x20);
|
||||
OSReport("%s:%x section:%d\n", stack_38, stack_48, stack_44);
|
||||
}
|
||||
u32 r31 = context->fpscr;
|
||||
r31 &= ((context->fpscr & 0xf8) << 22) | 0x01f80700;
|
||||
if (r31 & 0x20000000) {
|
||||
u32 ctx_fpcsr = context->fpscr;
|
||||
ctx_fpcsr &= ((ctx_fpcsr & 0xf8) << 22) | 0x01f80700;
|
||||
|
||||
if (ctx_fpcsr & 0x20000000) {
|
||||
context->fpscr &= ~0x80;
|
||||
OSReport(" FPE: Invalid operation(無効な演算)\n");
|
||||
if (fpscr & 0x01000000) {
|
||||
@@ -167,19 +167,19 @@ void JUTException::errorHandler(OSError error, OSContext* context, u32 param_3,
|
||||
OSReport(" Invalid integer convert\n");
|
||||
}
|
||||
}
|
||||
if (r31 & 0x10000000) {
|
||||
if (ctx_fpcsr & 0x10000000) {
|
||||
context->fpscr &= ~0x40;
|
||||
OSReport(" FPE: Overflow(オーバーフロー)\n");
|
||||
}
|
||||
if (r31 & 0x08000000) {
|
||||
if (ctx_fpcsr & 0x08000000) {
|
||||
context->fpscr &= ~0x20;
|
||||
OSReport(" FPE: Underflow(アンダーフロー)\n");
|
||||
}
|
||||
if (r31 & 0x04000000) {
|
||||
if (ctx_fpcsr & 0x04000000) {
|
||||
context->fpscr &= ~0x10;
|
||||
OSReport(" FPE: Zero division(0による割り算)\n");
|
||||
}
|
||||
if (r31 & 0x02000000) {
|
||||
if (ctx_fpcsr & 0x02000000) {
|
||||
context->fpscr &= ~0x08;
|
||||
OSReport(" FPE: Inexact result(不正確な結果)\n");
|
||||
}
|
||||
@@ -264,11 +264,11 @@ bool JUTException::searchPartialModule(u32 address, u32* module_id, u32* section
|
||||
}
|
||||
|
||||
OSModuleInfo* module = *(OSModuleInfo**)0x800030C8;
|
||||
while (module) {
|
||||
for (; module != NULL; module = (OSModuleInfo*)module->mNext) {
|
||||
OSSectionInfo* section = (OSSectionInfo*)module->info.sectionInfoOffset;
|
||||
for (u32 i = 0; i < module->mNumSections; section = section + 1, i++) {
|
||||
if (section->mSize) {
|
||||
u32 addr = ALIGN_PREV(section->mOffset, 2);
|
||||
for (u32 i = 0; i < module->mNumSections; section++, i++) {
|
||||
if (section->mSize != 0) {
|
||||
u32 addr = section->mOffset & ~0x01;
|
||||
if ((addr <= address) && (address < addr + section->mSize)) {
|
||||
if (module_id)
|
||||
*module_id = module->mId;
|
||||
@@ -282,8 +282,6 @@ bool JUTException::searchPartialModule(u32 address, u32* module_id, u32* section
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module = (OSModuleInfo*)module->mNext;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -40,13 +40,46 @@ extern "C" int OSGetActiveThreadID(OSThread* thread) {
|
||||
}
|
||||
|
||||
/* 800066B0-80006770 .text search_partial_address */
|
||||
extern "C" int search_partial_address(void* param_0, int* param_1, int* param_2, int* param_3, int* param_4) {
|
||||
/* Nonmatching */
|
||||
extern "C" int search_partial_address(void* address, int* module_id, int* section_id, int* section_offset, int* name_offset) {
|
||||
if (address == NULL)
|
||||
return 0xFFFFFFFF;
|
||||
|
||||
OSModuleInfo* module = *(OSModuleInfo**)0x800030C8;
|
||||
for (; module != NULL; module = (OSModuleInfo*)module->mNext) {
|
||||
u32 i, addr;
|
||||
OSSectionInfo* section = (OSSectionInfo*)module->info.sectionInfoOffset;
|
||||
|
||||
for (i = 0; i < module->mNumSections; section++, i++) {
|
||||
if (section->mSize != 0) {
|
||||
addr = section->mOffset & ~0x01;
|
||||
if ((addr <= (u32)address) && (u32)address < (addr + section->mSize)) {
|
||||
if (module_id != NULL)
|
||||
*module_id = module->mId;
|
||||
if (section_id != NULL)
|
||||
*section_id = i;
|
||||
if (section_offset)
|
||||
*section_offset = (u32)address - addr;
|
||||
if (name_offset)
|
||||
*name_offset = module->mModuleNameOffset;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
/* 80006770-800067D0 .text convert_partial_address */
|
||||
extern "C" int convert_partial_address(void* param_0) {
|
||||
/* Nonmatching */
|
||||
extern "C" u32 convert_partial_address(void* param_0) {
|
||||
int param_1;
|
||||
int param_2;
|
||||
int param_3;
|
||||
if (search_partial_address(param_0, ¶m_1, ¶m_2, ¶m_3, NULL) == 0) {
|
||||
return (param_2 << 28) + (param_3 & 0x01FFFFFF);
|
||||
} else {
|
||||
return (u32)param_0;
|
||||
}
|
||||
}
|
||||
|
||||
/* 800067D0-800067DC .text OSReportDisable */
|
||||
|
||||
Reference in New Issue
Block a user