Added logger flags, for selectively disabling categories of logging (cpu, apu, kernel). Need to make more log messages make use of these flags.
The "close window" keyboard hotkey (Guide-B) now toggles between loglevel -1 and the loglevel set in your config. Added LoggerBatch class, which accumulates strings into the threads scratch buffer. This is only intended to be used for very high frequency debug logging. if it exhausts the thread buffer, it just silently stops. Cleaned nearly 8 years of dust off of the pm4 packet disassembler code, now supports all packets that the command processor supports. Added extremely verbose logging for gpu register writes. This is not compiled in outside of debug builds, requires LogLevel::Debug and log_guest_driven_gpu_register_written_values = true. Added full logging of all PM4 packets in the cp. This is not compiled in outside of debug builds, requires LogLevel::Debug and disassemble_pm4. Piggybacked an implementation of guest callstack backtraces using the stackpoints from enable_host_guest_stack_synchronization. If enable_host_guest_stack_synchronization = false, no backtraces can be obtained. Added log_ringbuffer_kickoff_initiator_bts. when a thread updates the cp's read pointer, it dumps the backtrace of that thread Changed the names of the gpu registers CALLBACK_ADDRESS and CALLBACK_CONTEXT to the correct names. Added a note about CP_PROG_COUNTER Added CP_RB_WPTR to the gpu register table Added notes about CP_RB_CNTL and CP_RB_RPTR_ADDR. Both aren't necessary for HLE Changed name of UNKNOWN_0E00 gpu register to TC_CNTL_STATUS. Games only seem to write 1 to it (L2 invalidate)
This commit is contained in:
@@ -28,7 +28,14 @@ class Processor;
|
||||
namespace xe {
|
||||
namespace cpu {
|
||||
namespace backend {
|
||||
static constexpr uint32_t MAX_GUEST_PSEUDO_STACKTRACE_ENTRIES = 32;
|
||||
|
||||
struct GuestPseudoStackTrace {
|
||||
uint32_t count;
|
||||
uint32_t truncated_flag; // set to 1 if there were more than
|
||||
// MAX_GUEST_PSEUDO_STACKTRACE_ENTRIES entries.
|
||||
uint32_t return_addrs[MAX_GUEST_PSEUDO_STACKTRACE_ENTRIES];
|
||||
};
|
||||
class Assembler;
|
||||
class CodeCache;
|
||||
|
||||
@@ -84,6 +91,10 @@ class Backend {
|
||||
* */
|
||||
virtual void PrepareForReentry(void* ctx) {}
|
||||
|
||||
// returns true if populated st
|
||||
virtual bool PopulatePseudoStacktrace(GuestPseudoStackTrace* st) {
|
||||
return false;
|
||||
}
|
||||
protected:
|
||||
Processor* processor_ = nullptr;
|
||||
MachineInfo machine_info_;
|
||||
|
||||
@@ -1131,6 +1131,40 @@ void X64Backend::SetGuestRoundingMode(void* ctx, unsigned int mode) {
|
||||
((ppc::PPCContext*)ctx)->fpscr.bits.rn = control;
|
||||
}
|
||||
|
||||
bool X64Backend::PopulatePseudoStacktrace(GuestPseudoStackTrace* st) {
|
||||
if (!cvars::enable_host_guest_stack_synchronization) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ThreadState* thrd_state = ThreadState::Get();
|
||||
if (!thrd_state) {
|
||||
return false; // we're not a guest!
|
||||
}
|
||||
ppc::PPCContext* ctx = thrd_state->context();
|
||||
|
||||
X64BackendContext* backend_ctx = BackendContextForGuestContext(ctx);
|
||||
|
||||
uint32_t depth = backend_ctx->current_stackpoint_depth - 1;
|
||||
if (static_cast<int32_t>(depth) < 1) {
|
||||
return false;
|
||||
}
|
||||
uint32_t num_entries_to_populate =
|
||||
std::min(MAX_GUEST_PSEUDO_STACKTRACE_ENTRIES, depth);
|
||||
|
||||
st->count = num_entries_to_populate;
|
||||
st->truncated_flag = num_entries_to_populate < depth ? 1 : 0;
|
||||
|
||||
X64BackendStackpoint* current_stackpoint =
|
||||
&backend_ctx->stackpoints[backend_ctx->current_stackpoint_depth - 1];
|
||||
|
||||
for (uint32_t stp_index = 0; stp_index < num_entries_to_populate;
|
||||
++stp_index) {
|
||||
st->return_addrs[stp_index] = current_stackpoint->guest_return_address_;
|
||||
current_stackpoint--;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#if XE_X64_PROFILER_AVAILABLE == 1
|
||||
uint64_t* X64Backend::GetProfilerRecordForFunction(uint32_t guest_address) {
|
||||
// who knows, we might want to compile different versions of a function one
|
||||
|
||||
@@ -145,7 +145,7 @@ class X64Backend : public Backend {
|
||||
reinterpret_cast<intptr_t>(ctx) - sizeof(X64BackendContext));
|
||||
}
|
||||
virtual void SetGuestRoundingMode(void* ctx, unsigned int mode) override;
|
||||
|
||||
virtual bool PopulatePseudoStacktrace(GuestPseudoStackTrace* st) override;
|
||||
void RecordMMIOExceptionForGuestInstruction(void* host_address);
|
||||
#if XE_X64_PROFILER_AVAILABLE == 1
|
||||
uint64_t* GetProfilerRecordForFunction(uint32_t guest_address);
|
||||
|
||||
@@ -34,11 +34,12 @@ bool trace_enabled = true;
|
||||
#define IFLUSH()
|
||||
#define IPRINT(s) \
|
||||
if (trace_enabled && THREAD_MATCH) \
|
||||
xe::logging::AppendLogLine(xe::LogLevel::Debug, 't', s)
|
||||
xe::logging::AppendLogLine(xe::LogLevel::Debug, 't', s, xe::LogSrc::Cpu)
|
||||
#define DFLUSH()
|
||||
#define DPRINT(...) \
|
||||
if (trace_enabled && THREAD_MATCH) \
|
||||
xe::logging::AppendLogLineFormat(xe::LogLevel::Debug, 't', __VA_ARGS__)
|
||||
xe::logging::AppendLogLineFormat(xe::LogSrc::Cpu, xe::LogLevel::Debug, 't', \
|
||||
__VA_ARGS__)
|
||||
|
||||
uint32_t GetTracingMode() {
|
||||
uint32_t mode = 0;
|
||||
|
||||
Reference in New Issue
Block a user