Minor fixes

This commit is contained in:
Nekotekina 2015-07-28 19:01:07 +03:00
parent 02c0b69adb
commit badeb29901
2 changed files with 16 additions and 3 deletions

View file

@ -481,7 +481,6 @@ void decode_x64_reg_op(const u8* code, x64_op_t& out_op, x64_reg_t& out_reg, siz
} }
} }
LOG_WARNING(MEMORY, "decode_x64_reg_op(%016llxh): unsupported opcode found (%016llX%016llX)", (size_t)code - out_length, *(be_t<u64>*)(code - out_length), *(be_t<u64>*)(code - out_length + 8));
out_op = X64OP_NONE; out_op = X64OP_NONE;
out_reg = X64_NOT_SET; out_reg = X64_NOT_SET;
out_size = 0; out_size = 0;
@ -800,9 +799,18 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
// decode single x64 instruction that causes memory access // decode single x64 instruction that causes memory access
decode_x64_reg_op(code, op, reg, d_size, i_size); decode_x64_reg_op(code, op, reg, d_size, i_size);
auto report_opcode = [=]()
{
if (op == X64OP_NONE)
{
LOG_ERROR(MEMORY, "decode_x64_reg_op(%016llxh): unsupported opcode found (%016llX%016llX)", code, *(be_t<u64>*)(code), *(be_t<u64>*)(code + 8));
}
};
if ((d_size | d_size + addr) >= 0x100000000ull) if ((d_size | d_size + addr) >= 0x100000000ull)
{ {
LOG_ERROR(MEMORY, "Invalid d_size (0x%llx)", d_size); LOG_ERROR(MEMORY, "Invalid d_size (0x%llx)", d_size);
report_opcode();
return false; return false;
} }
@ -812,6 +820,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
if ((a_size | a_size + addr) >= 0x100000000ull) if ((a_size | a_size + addr) >= 0x100000000ull)
{ {
LOG_ERROR(MEMORY, "Invalid a_size (0x%llx)", a_size); LOG_ERROR(MEMORY, "Invalid a_size (0x%llx)", a_size);
report_opcode();
return false; return false;
} }
@ -828,6 +837,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
if (a_size != 4 || !d_size || !i_size) if (a_size != 4 || !d_size || !i_size)
{ {
LOG_ERROR(MEMORY, "Invalid or unsupported instruction (op=%d, reg=%d, d_size=%lld, a_size=0x%llx, i_size=%lld)", op, reg, d_size, a_size, i_size); LOG_ERROR(MEMORY, "Invalid or unsupported instruction (op=%d, reg=%d, d_size=%lld, a_size=0x%llx, i_size=%lld)", op, reg, d_size, a_size, i_size);
report_opcode();
return false; return false;
} }
@ -858,6 +868,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
default: default:
{ {
LOG_ERROR(MEMORY, "Invalid or unsupported operation (op=%d, reg=%d, d_size=%lld, i_size=%lld)", op, reg, d_size, i_size); LOG_ERROR(MEMORY, "Invalid or unsupported operation (op=%d, reg=%d, d_size=%lld, i_size=%lld)", op, reg, d_size, i_size);
report_opcode();
return false; return false;
} }
} }
@ -874,6 +885,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
if (!d_size || !i_size) if (!d_size || !i_size)
{ {
LOG_ERROR(MEMORY, "Invalid or unsupported instruction (op=%d, reg=%d, d_size=%lld, a_size=0x%llx, i_size=%lld)", op, reg, d_size, a_size, i_size); LOG_ERROR(MEMORY, "Invalid or unsupported instruction (op=%d, reg=%d, d_size=%lld, a_size=0x%llx, i_size=%lld)", op, reg, d_size, a_size, i_size);
report_opcode();
return false; return false;
} }
@ -1085,6 +1097,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
default: default:
{ {
LOG_ERROR(MEMORY, "Invalid or unsupported operation (op=%d, reg=%d, d_size=%lld, a_size=0x%llx, i_size=%lld)", op, reg, d_size, a_size, i_size); LOG_ERROR(MEMORY, "Invalid or unsupported operation (op=%d, reg=%d, d_size=%lld, a_size=0x%llx, i_size=%lld)", op, reg, d_size, a_size, i_size);
report_opcode();
return false; return false;
} }
} }

View file

@ -81,7 +81,7 @@ static const g_module_list[] =
{ 0x000a, "cellSpurs", &cellSpurs }, { 0x000a, "cellSpurs", &cellSpurs },
{ 0x000b, "cellOvis", &cellOvis }, { 0x000b, "cellOvis", &cellOvis },
{ 0x000c, "cellSheap", nullptr }, { 0x000c, "cellSheap", nullptr },
{ 0x000d, "sys_sync", &cellSync }, { 0x000d, "cellSync", &cellSync },
{ 0x000e, "sys_fs", &cellFs }, { 0x000e, "sys_fs", &cellFs },
{ 0x000f, "cellJpgDec", &cellJpgDec }, { 0x000f, "cellJpgDec", &cellJpgDec },
{ 0x0010, "cellGcmSys", &cellGcmSys }, { 0x0010, "cellGcmSys", &cellGcmSys },
@ -148,7 +148,7 @@ static const g_module_list[] =
{ 0x0056, "sceNpUtil", &sceNpUtil }, { 0x0056, "sceNpUtil", &sceNpUtil },
{ 0x0057, "cellRudp", &cellRudp }, { 0x0057, "cellRudp", &cellRudp },
{ 0x0059, "sceNpSns", &sceNpSns }, { 0x0059, "sceNpSns", &sceNpSns },
{ 0x005a, "cellGem", &cellGem }, { 0x005a, "libgem", &cellGem },
{ 0xf00a, "cellCelpEnc", nullptr }, { 0xf00a, "cellCelpEnc", nullptr },
{ 0xf010, "cellGifDec", &cellGifDec }, { 0xf010, "cellGifDec", &cellGifDec },
{ 0xf019, "cellAdecCelp", nullptr }, { 0xf019, "cellAdecCelp", nullptr },