1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00

logs: remove legacy MEMORY channel

Add channels vm_log, sig_log.
This commit is contained in:
Nekotekina 2020-01-31 14:20:54 +03:00
parent e6f7467f67
commit 26cccead6e
3 changed files with 39 additions and 35 deletions

View File

@ -107,7 +107,6 @@ namespace logs
inline channel GENERAL("");
inline channel LOADER("LDR");
inline channel MEMORY("MEM");
LOG_CHANNEL(RSX);
LOG_CHANNEL(HLE);
LOG_CHANNEL(PPU);

View File

@ -45,6 +45,9 @@
#include "sync.h"
#include "Log.h"
LOG_CHANNEL(sig_log);
LOG_CHANNEL(vm_log);
thread_local u64 g_tls_fault_all = 0;
thread_local u64 g_tls_fault_rsx = 0;
thread_local u64 g_tls_fault_spu = 0;
@ -185,7 +188,7 @@ void decode_x64_reg_op(const u8* code, x64_op_t& out_op, x64_reg_t& out_reg, siz
{
if (lock)
{
LOG_ERROR(MEMORY, "decode_x64_reg_op(%016llxh): LOCK prefix found twice", code - out_length);
sig_log.error("decode_x64_reg_op(%016llxh): LOCK prefix found twice", code - out_length);
}
lock = true;
@ -195,7 +198,7 @@ void decode_x64_reg_op(const u8* code, x64_op_t& out_op, x64_reg_t& out_reg, siz
{
if (repne)
{
LOG_ERROR(MEMORY, "decode_x64_reg_op(%016llxh): REPNE/REPNZ prefix found twice", code - out_length);
sig_log.error("decode_x64_reg_op(%016llxh): REPNE/REPNZ prefix found twice", code - out_length);
}
repne = true;
@ -205,7 +208,7 @@ void decode_x64_reg_op(const u8* code, x64_op_t& out_op, x64_reg_t& out_reg, siz
{
if (repe)
{
LOG_ERROR(MEMORY, "decode_x64_reg_op(%016llxh): REP/REPE/REPZ prefix found twice", code - out_length);
sig_log.error("decode_x64_reg_op(%016llxh): REP/REPE/REPZ prefix found twice", code - out_length);
}
repe = true;
@ -221,7 +224,7 @@ void decode_x64_reg_op(const u8* code, x64_op_t& out_op, x64_reg_t& out_reg, siz
{
if (pg2)
{
LOG_ERROR(MEMORY, "decode_x64_reg_op(%016llxh): 0x%02x (group 2 prefix) found after 0x%02x", code - out_length, prefix, pg2);
sig_log.error("decode_x64_reg_op(%016llxh): 0x%02x (group 2 prefix) found after 0x%02x", code - out_length, prefix, pg2);
}
else
{
@ -234,7 +237,7 @@ void decode_x64_reg_op(const u8* code, x64_op_t& out_op, x64_reg_t& out_reg, siz
{
if (oso)
{
LOG_ERROR(MEMORY, "decode_x64_reg_op(%016llxh): operand-size override prefix found twice", code - out_length);
sig_log.error("decode_x64_reg_op(%016llxh): operand-size override prefix found twice", code - out_length);
}
oso = true;
@ -243,7 +246,7 @@ void decode_x64_reg_op(const u8* code, x64_op_t& out_op, x64_reg_t& out_reg, siz
case 0x67: // group 4
{
LOG_ERROR(MEMORY, "decode_x64_reg_op(%016llxh): address-size override prefix found", code - out_length, prefix);
sig_log.error("decode_x64_reg_op(%016llxh): address-size override prefix found", code - out_length, prefix);
out_op = X64OP_NONE;
out_reg = X64_NOT_SET;
out_size = 0;
@ -257,7 +260,7 @@ void decode_x64_reg_op(const u8* code, x64_op_t& out_op, x64_reg_t& out_reg, siz
{
if (rex)
{
LOG_ERROR(MEMORY, "decode_x64_reg_op(%016llxh): 0x%02x (REX prefix) found after 0x%02x", code - out_length, prefix, rex);
sig_log.error("decode_x64_reg_op(%016llxh): 0x%02x (REX prefix) found after 0x%02x", code - out_length, prefix, rex);
}
else
{
@ -757,7 +760,7 @@ uint64_t* darwin_x64reg(x64_context *context, int reg)
case 15: return &state->__r15;
case 16: return &state->__rip;
default:
LOG_ERROR(GENERAL, "Invalid register index: %d", reg);
sig_log.error("Invalid register index: %d", reg);
return nullptr;
}
}
@ -795,7 +798,7 @@ register_t* freebsd_x64reg(x64_context *context, int reg)
case 15: return &state->mc_r15;
case 16: return &state->mc_rip;
default:
LOG_ERROR(GENERAL, "Invalid register index: %d", reg);
sig_log.error("Invalid register index: %d", reg);
return nullptr;
}
}
@ -829,7 +832,7 @@ long* openbsd_x64reg(x64_context *context, int reg)
case 15: return &state->sc_r15;
case 16: return &state->sc_rip;
default:
LOG_ERROR(GENERAL, "Invalid register index: %d", reg);
sig_log.error("Invalid register index: %d", reg);
return nullptr;
}
}
@ -964,7 +967,7 @@ bool get_x64_reg_value(x64_context* context, x64_reg_t reg, size_t d_size, size_
return true;
}
LOG_ERROR(MEMORY, "get_x64_reg_value(): invalid arguments (reg=%d, d_size=%lld, i_size=%lld)", +reg, d_size, i_size);
sig_log.error("get_x64_reg_value(): invalid arguments (reg=%d, d_size=%lld, i_size=%lld)", +reg, d_size, i_size);
return false;
}
@ -983,7 +986,7 @@ bool put_x64_reg_value(x64_context* context, x64_reg_t reg, size_t d_size, u64 v
}
}
LOG_ERROR(MEMORY, "put_x64_reg_value(): invalid destination (reg=%d, d_size=%lld, value=0x%llx)", +reg, d_size, value);
sig_log.error("put_x64_reg_value(): invalid destination (reg=%d, d_size=%lld, value=0x%llx)", +reg, d_size, value);
return false;
}
@ -995,7 +998,7 @@ bool set_x64_cmp_flags(x64_context* context, size_t d_size, u64 x, u64 y, bool c
case 2: break;
case 4: break;
case 8: break;
default: LOG_ERROR(MEMORY, "set_x64_cmp_flags(): invalid d_size (%lld)", d_size); return false;
default: sig_log.error("set_x64_cmp_flags(): invalid d_size (%lld)", d_size); return false;
}
const u64 sign = 1ull << (d_size * 8 - 1); // sign mask
@ -1159,13 +1162,13 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
{
if (op == X64OP_NONE)
{
LOG_ERROR(MEMORY, "decode_x64_reg_op(%p): unsupported opcode: %s", code, *reinterpret_cast<const be_t<v128, 1>*>(code));
sig_log.error("decode_x64_reg_op(%p): unsupported opcode: %s", code, *reinterpret_cast<const be_t<v128, 1>*>(code));
}
};
if ((d_size | (d_size + addr)) >= 0x100000000ull)
{
LOG_ERROR(MEMORY, "Invalid d_size (0x%llx)", d_size);
sig_log.error("Invalid d_size (0x%llx)", d_size);
report_opcode();
return false;
}
@ -1175,7 +1178,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
if ((a_size | (a_size + addr)) >= 0x100000000ull)
{
LOG_ERROR(MEMORY, "Invalid a_size (0x%llx)", a_size);
sig_log.error("Invalid a_size (0x%llx)", a_size);
report_opcode();
return false;
}
@ -1192,7 +1195,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
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);
sig_log.error("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;
}
@ -1265,7 +1268,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
case X64OP_STOS:
default:
{
LOG_ERROR(MEMORY, "Invalid or unsupported operation (op=%d, reg=%d, d_size=%lld, i_size=%lld)", +op, +reg, d_size, i_size);
sig_log.error("Invalid or unsupported operation (op=%d, reg=%d, d_size=%lld, i_size=%lld)", +op, +reg, d_size, i_size);
report_opcode();
return false;
}
@ -1357,7 +1360,7 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
pf_events->events.emplace(static_cast<u32>(data2), addr);
}
LOG_ERROR(MEMORY, "Page_fault %s location 0x%x because of %s memory", is_writing ? "writing" : "reading",
sig_log.error("Page_fault %s location 0x%x because of %s memory", is_writing ? "writing" : "reading",
addr, data3 == SYS_MEMORY_PAGE_FAULT_CAUSE_READ_ONLY ? "writing read-only" : "using unmapped");
error_code sending_error = sys_event_port_send(pf_port_id, data1, data2, data3);
@ -1415,8 +1418,8 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
if (cpu->id_type() != 1)
{
LOG_NOTICE(GENERAL, "\n%s", cpu->dump());
LOG_FATAL(MEMORY, "Access violation %s location 0x%x", is_writing ? "writing" : "reading", addr);
vm_log.notice("\n%s", cpu->dump());
vm_log.fatal("Access violation %s location 0x%x", is_writing ? "writing" : "reading", addr);
// TODO:
// RawSPU: Send appropriate interrupt
@ -1455,10 +1458,10 @@ bool handle_access_violation(u32 addr, bool is_writing, x64_context* context)
if (cpu)
{
LOG_NOTICE(GENERAL, "\n%s", cpu->dump());
vm_log.notice("\n%s", cpu->dump());
}
LOG_FATAL(MEMORY, "Access violation %s location 0x%x", is_writing ? "writing" : "reading", addr);
vm_log.fatal("Access violation %s location 0x%x", is_writing ? "writing" : "reading", addr);
while (Emu.IsPaused())
{
@ -1724,7 +1727,7 @@ void thread_base::initialize(bool(*wait_cb)(const void*))
m_timer = timerfd_create(CLOCK_MONOTONIC, 0);
if (m_timer == -1)
{
LOG_ERROR(GENERAL, "Linux timer allocation failed, use wait_unlock() only");
sig_log.error("Linux timer allocation failed, use wait_unlock() only");
}
#endif
}
@ -1770,7 +1773,7 @@ bool thread_base::finalize(int) noexcept
return thread_ctrl::g_tls_this_thread->m_name.get();
};
LOG_NOTICE(GENERAL, "Thread time: %fs (%fGc); Faults: %u [rsx:%u, spu:%u];",
sig_log.notice("Thread time: %fs (%fGc); Faults: %u [rsx:%u, spu:%u];",
time / 1000000000.,
cycles / 1000000000.,
g_tls_fault_all,
@ -1808,7 +1811,7 @@ void thread_ctrl::_wait_for(u64 usec, bool alert /* true */)
timeout.it_interval.tv_nsec = 0;
timerfd_settime(_this->m_timer, 0, &timeout, NULL);
if (read(_this->m_timer, &missed, sizeof(missed)) != sizeof(missed))
LOG_ERROR(GENERAL, "timerfd: read() failed");
sig_log.error("timerfd: read() failed");
return;
}
#endif
@ -1949,13 +1952,13 @@ void thread_ctrl::detect_cpu_layout()
// If buffer size is set to 0 bytes, it will be overwritten with the required size
if (GetLogicalProcessorInformationEx(relationship, nullptr, &buffer_size))
{
LOG_ERROR(GENERAL, "GetLogicalProcessorInformationEx returned 0 bytes");
sig_log.error("GetLogicalProcessorInformationEx returned 0 bytes");
return;
}
DWORD error_code = GetLastError();
if (error_code != ERROR_INSUFFICIENT_BUFFER)
{
LOG_ERROR(GENERAL, "Unexpected windows error code when detecting CPU layout: %u", error_code);
sig_log.error("Unexpected windows error code when detecting CPU layout: %u", error_code);
return;
}
@ -1964,7 +1967,7 @@ void thread_ctrl::detect_cpu_layout()
if (!GetLogicalProcessorInformationEx(relationship,
reinterpret_cast<SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *>(buffer.data()), &buffer_size))
{
LOG_ERROR(GENERAL, "GetLogicalProcessorInformationEx failed (size=%u, error=%u)", buffer_size, GetLastError());
sig_log.error("GetLogicalProcessorInformationEx failed (size=%u, error=%u)", buffer_size, GetLastError());
}
else
{
@ -1984,7 +1987,7 @@ void thread_ctrl::detect_cpu_layout()
}
}
#else
LOG_TODO(GENERAL, "Thread scheduler is not implemented for Intel and this OS");
sig_log.todo("Thread scheduler is not implemented for Intel and this OS");
#endif
}
}
@ -2160,7 +2163,7 @@ void thread_ctrl::set_native_priority(int priority)
if (!SetThreadPriority(_this_thread, native_priority))
{
LOG_ERROR(GENERAL, "SetThreadPriority() failed: 0x%x", GetLastError());
sig_log.error("SetThreadPriority() failed: 0x%x", GetLastError());
}
#else
int policy;
@ -2175,7 +2178,7 @@ void thread_ctrl::set_native_priority(int priority)
if (int err = pthread_setschedparam(pthread_self(), policy, &param))
{
LOG_ERROR(GENERAL, "pthraed_setschedparam() failed: %d", err);
sig_log.error("pthraed_setschedparam() failed: %d", err);
}
#endif
}

View File

@ -17,6 +17,8 @@
#include <thread>
#include <deque>
LOG_CHANNEL(vm_log);
namespace vm
{
static u8* memory_reserve_4GiB(void* _addr, u64 size = 0x100000000)
@ -576,13 +578,13 @@ namespace vm
if (!block)
{
LOG_ERROR(MEMORY, "vm::dealloc(): invalid memory location (%u, addr=0x%x)\n", +location, addr);
vm_log.error("vm::dealloc(): invalid memory location (%u, addr=0x%x)\n", +location, addr);
return;
}
if (!block->dealloc(addr))
{
LOG_ERROR(MEMORY, "vm::dealloc(): deallocation failed (addr=0x%x)\n", addr);
vm_log.error("vm::dealloc(): deallocation failed (addr=0x%x)\n", addr);
return;
}
}