diff --git a/src/xenia/kernel/util/shim_utils.h b/src/xenia/kernel/util/shim_utils.h index 460ef93b9..2b3845d1e 100644 --- a/src/xenia/kernel/util/shim_utils.h +++ b/src/xenia/kernel/util/shim_utils.h @@ -366,6 +366,32 @@ inline void AppendParam(StringBuffer* string_buffer, lpdouble_t param) { string_buffer->AppendFormat("(%G)", param.value()); } } +void AppendParam(StringBuffer* string_buffer, + pointer_t record) { + string_buffer->AppendFormat("%.8X", record.guest_address()); + if (record) { + auto name_string = + kernel_memory()->TranslateVirtual(record->name_ptr); + std::string name = + name_string == nullptr + ? "(null)" + : name_string->to_string(kernel_memory()->virtual_membase()); + string_buffer->AppendFormat("(%.8X,%s,%.8X)", + uint32_t(record->root_directory), name.c_str(), + uint32_t(record->attributes)); + } +} +void AppendParam(StringBuffer* string_buffer, + pointer_t reg) { + string_buffer->AppendFormat("%.8X(%.8X, %.8X)", reg.guest_address(), + static_cast(reg->notification_routine), + static_cast(reg->priority)); +} +void AppendParam(StringBuffer* string_buffer, + pointer_t record) { + string_buffer->AppendFormat("%.8X(%.8X)", record.guest_address(), + uint32_t(record->exception_code)); +} template void AppendParam(StringBuffer* string_buffer, pointer_t param) { string_buffer->AppendFormat("%.8X", param.guest_address()); diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_debug.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_debug.cc index 454038e88..f69a812b9 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_debug.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_debug.cc @@ -31,22 +31,6 @@ typedef struct { } X_THREADNAME_INFO; static_assert_size(X_THREADNAME_INFO, 0x10); -// https://msdn.microsoft.com/en-us/library/windows/desktop/aa363082.aspx -typedef struct { - xe::be exception_code; - xe::be exception_flags; - xe::be exception_record; - xe::be exception_address; - xe::be number_parameters; - xe::be exception_information[15]; -} X_EXCEPTION_RECORD; -static_assert_size(X_EXCEPTION_RECORD, 0x50); -void AppendParam(StringBuffer* string_buffer, - pointer_t record) { - string_buffer->AppendFormat("%.8X(%.8X)", record.guest_address(), - uint32_t(record->exception_code)); -} - void RtlRaiseException(pointer_t record) { if (record->exception_code == 0x406D1388) { // SetThreadName. FFS. diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_modules.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_modules.cc index 614962081..8bc83374e 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_modules.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_modules.cc @@ -320,13 +320,6 @@ SHIM_CALL XexGetProcedureAddress_shim(PPCContext* ppc_context, SHIM_SET_RETURN_32(result); } -void AppendParam(StringBuffer* string_buffer, - pointer_t reg) { - string_buffer->AppendFormat("%.8X(%.8X, %.8X)", reg.guest_address(), - static_cast(reg->notification_routine), - static_cast(reg->priority)); -} - void ExRegisterTitleTerminateNotification( pointer_t reg, dword_t create) { if (create) { diff --git a/src/xenia/xbox.h b/src/xenia/xbox.h index 5e6dfb5d8..5a687aa74 100644 --- a/src/xenia/xbox.h +++ b/src/xenia/xbox.h @@ -385,6 +385,17 @@ struct X_OBJECT_ATTRIBUTES { xe::be attributes; // 0xC }; +// https://msdn.microsoft.com/en-us/library/windows/desktop/aa363082.aspx +typedef struct { + xe::be exception_code; + xe::be exception_flags; + xe::be exception_record; + xe::be exception_address; + xe::be number_parameters; + xe::be exception_information[15]; +} X_EXCEPTION_RECORD; +static_assert_size(X_EXCEPTION_RECORD, 0x50); + #pragma pack(pop) } // namespace xe