mirror of
https://github.com/encounter/tp.git
synced 2026-07-11 06:18:46 -07:00
JKRThread & JKRThreadSwitch (#147)
* OK __ct__15JKRThreadSwitchFP7JKRHeap * OK createManager__15JKRThreadSwitchFP7JKRHeap * OK enter__15JKRThreadSwitchFP9JKRThreadi * OK callback__15JKRThreadSwitchFP8OSThreadP8OSThread * OK draw__15JKRThreadSwitchFP14JKRThreadName_P10JUTConsole * OK draw__15JKRThreadSwitchFP14JKRThreadName_ * OK __dt__15JKRThreadSwitchFv * JKRThread.cpp cleanup * Fixed tp.py and libelf, changed JUT_ASSERT macro and removed unused .s files. * Changed JKRThread access specifiers Co-authored-by: Julgodis <>
This commit is contained in:
co-authored by
Julgodis <>
parent
7d271be857
commit
800047a854
@@ -4,6 +4,7 @@
|
||||
//
|
||||
|
||||
#include "JSystem/JKernel/JKRDvdFile.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "JSystem/JUtility/JUTException.h"
|
||||
#include "dol2asm.h"
|
||||
#include "global.h"
|
||||
@@ -100,7 +101,12 @@ void JKRDvdFile::close() {
|
||||
|
||||
/* 802D99B4-802D9A68 2D42F4 00B4+00 1/0 0/0 0/0 .text readData__10JKRDvdFileFPvll */
|
||||
s32 JKRDvdFile::readData(void* param_1, long length, long param_3) {
|
||||
JUT_ASSERT((length & 0x1f) == 0);
|
||||
/* clang-format off */
|
||||
// The assert condition gets stringified as "( length & 0x1f ) == 0",
|
||||
// with out disabling clang-format the spaces in the condition will
|
||||
// get removed and the string will be incorrect.
|
||||
JUT_ASSERT("JKRDvdFile.cpp", 0xee, ( length & 0x1f ) == 0);
|
||||
/* clang-format on */
|
||||
|
||||
OSLockMutex(&mMutex1);
|
||||
if (mOSThread) {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
//
|
||||
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "JSystem/JUtility/JUTException.h"
|
||||
#include "dol2asm.h"
|
||||
#include "global.h"
|
||||
@@ -604,14 +605,14 @@ void operator delete[](void* ptr) {
|
||||
/* 802CED84-802CED88 2C96C4 0004+00 1/0 1/0 0/0 .text
|
||||
* state_register__7JKRHeapCFPQ27JKRHeap6TStateUl */
|
||||
void JKRHeap::state_register(JKRHeap::TState* p, u32 id) const {
|
||||
JUT_ASSERT(p != 0);
|
||||
JUT_ASSERT(p->getHeap() == this);
|
||||
JUT_ASSERT("JKRHeap.cpp", 0x4bd, p != 0);
|
||||
JUT_ASSERT("JKRHeap.cpp", 0x4be, p->getHeap() == this);
|
||||
}
|
||||
|
||||
/* 802CED88-802CEDA0 2C96C8 0018+00 1/0 1/0 0/0 .text
|
||||
* state_compare__7JKRHeapCFRCQ27JKRHeap6TStateRCQ27JKRHeap6TState */
|
||||
bool JKRHeap::state_compare(JKRHeap::TState const& r1, JKRHeap::TState const& r2) const {
|
||||
JUT_ASSERT(r1.getHeap() == r2.getHeap());
|
||||
JUT_ASSERT("JKRHeap.cpp", 0x4c6, r1.getHeap() == r2.getHeap());
|
||||
return r1.getCheckCode() == r2.getCheckCode();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
//
|
||||
|
||||
#include "JSystem/JKernel/JKRSolidHeap.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "dol2asm.h"
|
||||
#include "global.h"
|
||||
#include "msl_c/math.h"
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
@@ -156,10 +158,14 @@ asm s32 JKRSolidHeap::adjustSize() {
|
||||
|
||||
/* 802D0CB0-802D0D58 2CB5F0 00A8+00 1/0 0/0 0/0 .text do_alloc__12JKRSolidHeapFUli */
|
||||
void* JKRSolidHeap::do_alloc(u32 size, int alignment) {
|
||||
#if DEBUG
|
||||
// TODO(Julgodis): JUTAssertion::setConfirmMessage
|
||||
if (alignment != 0) {
|
||||
JUT_ASSERT(abs(alignment));
|
||||
JUT_ASSERT(isPower2(alignment));
|
||||
int u = abs(alignment);
|
||||
JUT_ASSERT("JKRSolidHeap.cpp", 0xdb, u < 0x80);
|
||||
JUT_ASSERT("JKRSolidHeap.cpp", 0xdc, JGadget::binary::isPower2(u));
|
||||
}
|
||||
#endif
|
||||
|
||||
lock();
|
||||
|
||||
@@ -348,8 +354,8 @@ bool JKRSolidHeap::dump(void) {
|
||||
// full match expect using the wrong register
|
||||
#ifdef NONMATCHING
|
||||
void JKRSolidHeap::state_register(JKRHeap::TState* p, u32 id) const {
|
||||
JUT_ASSERT(p != 0);
|
||||
JUT_ASSERT(p->getHeap() == this);
|
||||
JUT_ASSERT("JKRSolidHeap.cpp", 0x25c, p != 0);
|
||||
JUT_ASSERT("JKRSolidHeap.cpp", 0x25d, p->getHeap() == this);
|
||||
|
||||
getState_(p);
|
||||
setState_u32ID_(p, id);
|
||||
@@ -370,7 +376,7 @@ asm void JKRSolidHeap::state_register(JKRHeap::TState* param_0, u32 param_1) con
|
||||
/* 802D1258-802D1288 2CBB98 0030+00 1/0 0/0 0/0 .text
|
||||
* state_compare__12JKRSolidHeapCFRCQ27JKRHeap6TStateRCQ27JKRHeap6TState */
|
||||
bool JKRSolidHeap::state_compare(JKRHeap::TState const& r1, JKRHeap::TState const& r2) const {
|
||||
JUT_ASSERT(r1.getHeap() == r2.getHeap());
|
||||
JUT_ASSERT("JKRSolidHeap.cpp", 0x278, r1.getHeap() == r2.getHeap());
|
||||
|
||||
bool result = true;
|
||||
if (r1.getCheckCode() != r2.getCheckCode()) {
|
||||
|
||||
+186
-185
@@ -5,8 +5,10 @@
|
||||
|
||||
#include "JSystem/JKernel/JKRThread.h"
|
||||
#include "JSystem/JKernel/JKRExpHeap.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "dol2asm.h"
|
||||
#include "dolphin/types.h"
|
||||
#include "msl_c/string.h"
|
||||
|
||||
//
|
||||
// Types:
|
||||
@@ -18,92 +20,40 @@ struct JUTConsole {
|
||||
/* 802E7C38 */ void print(char const*);
|
||||
};
|
||||
|
||||
//
|
||||
// Forward References:
|
||||
//
|
||||
|
||||
extern "C" void __ct__9JKRThreadFUlii();
|
||||
extern "C" void __ct__9JKRThreadFP7JKRHeapUlii();
|
||||
extern "C" void __ct__9JKRThreadFP8OSThreadi();
|
||||
extern "C" void __dt__9JKRThreadFv();
|
||||
extern "C" void setCommon_mesgQueue__9JKRThreadFP7JKRHeapi();
|
||||
extern "C" void setCommon_heapSpecified__9JKRThreadFP7JKRHeapUli();
|
||||
extern "C" void start__9JKRThreadFPv();
|
||||
extern "C" void searchThread__9JKRThreadFP8OSThread();
|
||||
extern "C" void __ct__15JKRThreadSwitchFP7JKRHeap();
|
||||
extern "C" void createManager__15JKRThreadSwitchFP7JKRHeap();
|
||||
extern "C" void enter__15JKRThreadSwitchFP9JKRThreadi();
|
||||
extern "C" void callback__15JKRThreadSwitchFP8OSThreadP8OSThread();
|
||||
extern "C" void draw__15JKRThreadSwitchFP14JKRThreadName_P10JUTConsole();
|
||||
extern "C" bool run__9JKRThreadFv();
|
||||
extern "C" void draw__15JKRThreadSwitchFP14JKRThreadName_();
|
||||
extern "C" void __dt__15JKRThreadSwitchFv();
|
||||
extern "C" void __sinit_JKRThread_cpp();
|
||||
extern "C" void func_802D1EFC(void* _this);
|
||||
extern "C" void func_802D1F50(void* _this);
|
||||
extern "C" extern char const* const JKRThread__stringBase0;
|
||||
extern "C" u8 sThreadList__9JKRThread[12];
|
||||
extern "C" u8 sTaskList__7JKRTask[12];
|
||||
extern "C" u8 sEndMesgQueue__7JKRTask[32];
|
||||
extern "C" u8 sManager__15JKRThreadSwitch[4];
|
||||
extern "C" u8 sTotalCount__15JKRThreadSwitch[4];
|
||||
extern "C" u8 sTotalStart__15JKRThreadSwitch[4];
|
||||
extern "C" u8 mUserPreCallback__15JKRThreadSwitch[4];
|
||||
extern "C" u8 mUserPostCallback__15JKRThreadSwitch[4];
|
||||
|
||||
//
|
||||
// External References:
|
||||
//
|
||||
|
||||
extern "C" void becomeCurrentHeap__7JKRHeapFv();
|
||||
extern "C" void alloc__7JKRHeapFUliP7JKRHeap();
|
||||
extern "C" void free__7JKRHeapFPvP7JKRHeap();
|
||||
extern "C" void findFromRoot__7JKRHeapFPv();
|
||||
extern "C" void isSubHeap__7JKRHeapCFP7JKRHeap();
|
||||
extern "C" void* __nw__FUlP7JKRHeapi();
|
||||
extern "C" void __dl__FPv();
|
||||
extern "C" void __ct__11JKRDisposerFv();
|
||||
extern "C" void __dt__11JKRDisposerFv();
|
||||
extern "C" void __ct__10JSUPtrLinkFPv();
|
||||
extern "C" void __dt__10JSUPtrLinkFv();
|
||||
extern "C" void __ct__10JSUPtrListFb();
|
||||
extern "C" void __dt__10JSUPtrListFv();
|
||||
extern "C" void initiate__10JSUPtrListFv();
|
||||
extern "C" void append__10JSUPtrListFP10JSUPtrLink();
|
||||
extern "C" void remove__10JSUPtrListFP10JSUPtrLink();
|
||||
extern "C" void clear__10JUTConsoleFv();
|
||||
extern "C" void print_f__10JUTConsoleFPCce();
|
||||
extern "C" void print__10JUTConsoleFPCc();
|
||||
extern "C" void JUTWarningConsole();
|
||||
extern "C" void __register_global_object();
|
||||
extern "C" void __cvt_fp2unsigned();
|
||||
extern "C" void _savegpr_25();
|
||||
extern "C" void _savegpr_27();
|
||||
extern "C" void _savegpr_28();
|
||||
extern "C" void _savegpr_29();
|
||||
extern "C" void _restgpr_25();
|
||||
extern "C" void _restgpr_27();
|
||||
extern "C" void _restgpr_28();
|
||||
extern "C" void _restgpr_29();
|
||||
extern "C" void __cvt_sll_flt();
|
||||
extern "C" void sprintf();
|
||||
extern "C" u8 sSystemHeap__7JKRHeap[4];
|
||||
extern "C" u8 sCurrentHeap__7JKRHeap[4];
|
||||
extern "C" u8 sRootHeap__7JKRHeap[4];
|
||||
extern "C" void* __vt__15JKRThreadSwitch;
|
||||
extern "C" void JUTWarningConsole(const char*);
|
||||
|
||||
//
|
||||
// Declarations:
|
||||
//
|
||||
|
||||
/* 8043428C-80434298 060FAC 000C+00 5/6 0/0 0/0 .bss sThreadList__9JKRThread */
|
||||
JSUList<JKRThread> JKRThread::sThreadList(0);
|
||||
|
||||
/* 804513B0-804513B4 0008B0 0004+00 2/2 1/1 0/0 .sbss sManager__15JKRThreadSwitch */
|
||||
JKRThreadSwitch* JKRThreadSwitch::sManager;
|
||||
|
||||
/* 804513B4-804513B8 0008B4 0004+00 3/3 0/0 0/0 .sbss sTotalCount__15JKRThreadSwitch */
|
||||
u32 JKRThreadSwitch::sTotalCount;
|
||||
|
||||
/* 804513B8-804513BC 0008B8 0004+00 1/1 0/0 0/0 .sbss sTotalStart__15JKRThreadSwitch */
|
||||
u32 JKRThreadSwitch::sTotalStart;
|
||||
|
||||
/* 804513BC-804513C0 0008BC 0004+00 1/1 0/0 0/0 .sbss None */
|
||||
static u32 data_804513BC;
|
||||
|
||||
/* 804513C0-804513C4 0008C0 0004+00 1/1 0/0 0/0 .sbss mUserPreCallback__15JKRThreadSwitch
|
||||
*/
|
||||
JKRThreadSwitch_PreCallback JKRThreadSwitch::mUserPreCallback;
|
||||
|
||||
/* 804513C4-804513C8 0008C4 0004+00 1/1 0/0 0/0 .sbss mUserPostCallback__15JKRThreadSwitch */
|
||||
JKRThreadSwitch_PostCallback JKRThreadSwitch::mUserPostCallback;
|
||||
|
||||
/* 802D1568-802D1610 2CBEA8 00A8+00 0/0 4/4 0/0 .text __ct__9JKRThreadFUlii */
|
||||
JKRThread::JKRThread(u32 stack_size, int message_count, int param_3) : mThreadListLink(this) {
|
||||
mSwitchCount = 0;
|
||||
mCost = 0;
|
||||
field_0x6c = 0;
|
||||
field_0x60 = 0;
|
||||
field_0x70 = 0;
|
||||
|
||||
JKRHeap* heap = JKRHeap::findFromRoot(this);
|
||||
if (heap == NULL) {
|
||||
heap = JKRHeap::getSystemHeap();
|
||||
@@ -116,12 +66,6 @@ JKRThread::JKRThread(u32 stack_size, int message_count, int param_3) : mThreadLi
|
||||
/* 802D1610-802D16B8 2CBF50 00A8+00 0/0 2/2 0/0 .text __ct__9JKRThreadFP7JKRHeapUlii */
|
||||
JKRThread::JKRThread(JKRHeap* heap, u32 stack_size, int message_count, int param_4)
|
||||
: mThreadListLink(this) {
|
||||
mSwitchCount = 0;
|
||||
mCost = 0;
|
||||
field_0x6c = 0;
|
||||
field_0x60 = 0;
|
||||
field_0x70 = 0;
|
||||
|
||||
if (heap == NULL) {
|
||||
heap = JKRHeap::getCurrentHeap();
|
||||
}
|
||||
@@ -132,11 +76,6 @@ JKRThread::JKRThread(JKRHeap* heap, u32 stack_size, int message_count, int param
|
||||
|
||||
/* 802D16B8-802D1758 2CBFF8 00A0+00 0/0 5/5 0/0 .text __ct__9JKRThreadFP8OSThreadi */
|
||||
JKRThread::JKRThread(OSThread* thread, int message_count) : mThreadListLink(this) {
|
||||
mSwitchCount = 0;
|
||||
mCost = 0;
|
||||
field_0x6c = 0;
|
||||
field_0x60 = 0;
|
||||
field_0x70 = 0;
|
||||
mHeap = NULL;
|
||||
mThreadRecord = thread;
|
||||
mStackSize = (u32)thread->stack_end - (u32)thread->stack_base;
|
||||
@@ -145,9 +84,6 @@ JKRThread::JKRThread(OSThread* thread, int message_count) : mThreadListLink(this
|
||||
setCommon_mesgQueue(JKRHeap::getSystemHeap(), message_count);
|
||||
}
|
||||
|
||||
/* 8043428C-80434298 060FAC 000C+00 5/6 0/0 0/0 .bss sThreadList__9JKRThread */
|
||||
JSUList<JKRThread> JKRThread::sThreadList(0);
|
||||
|
||||
/* 802D1758-802D1830 2CC098 00D8+00 1/0 9/9 0/0 .text __dt__9JKRThreadFv */
|
||||
JKRThread::~JKRThread() {
|
||||
getList().remove(&mThreadListLink);
|
||||
@@ -209,50 +145,52 @@ JKRThread* JKRThread::searchThread(OSThread* thread) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 804513B0-804513B4 0008B0 0004+00 2/2 1/1 0/0 .sbss sManager__15JKRThreadSwitch */
|
||||
u8 JKRThreadSwitch::sManager[4];
|
||||
|
||||
/* 804513B4-804513B8 0008B4 0004+00 3/3 0/0 0/0 .sbss sTotalCount__15JKRThreadSwitch */
|
||||
u8 JKRThreadSwitch::sTotalCount[4];
|
||||
|
||||
/* 804513B8-804513BC 0008B8 0004+00 1/1 0/0 0/0 .sbss sTotalStart__15JKRThreadSwitch */
|
||||
u8 JKRThreadSwitch::sTotalStart[4];
|
||||
|
||||
/* 804513BC-804513C0 0008BC 0004+00 1/1 0/0 0/0 .sbss None */
|
||||
static u8 data_804513BC[4];
|
||||
|
||||
/* 802D199C-802D1A14 2CC2DC 0078+00 1/1 0/0 0/0 .text __ct__15JKRThreadSwitchFP7JKRHeap
|
||||
*/
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm JKRThreadSwitch::JKRThreadSwitch(JKRHeap* param_0) {
|
||||
nofralloc
|
||||
#include "asm/JSystem/JKernel/JKRThread/__ct__15JKRThreadSwitchFP7JKRHeap.s"
|
||||
JKRThreadSwitch::JKRThreadSwitch(JKRHeap* param_0) {
|
||||
mHeap = param_0;
|
||||
OSSetSwitchThreadCallback(JKRThreadSwitch::callback);
|
||||
this->field_0xC = 0;
|
||||
this->field_0x10 = 1;
|
||||
this->field_0x18 = 0;
|
||||
sTotalCount = 0;
|
||||
data_804513BC = 0;
|
||||
sTotalStart = 0;
|
||||
this->field_0x20 = 0;
|
||||
this->field_0x24 = 0;
|
||||
mSetNextHeap = true;
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* 802D1A14-802D1A70 2CC354 005C+00 0/0 1/1 0/0 .text createManager__15JKRThreadSwitchFP7JKRHeap
|
||||
*/
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm JKRThreadSwitch* JKRThreadSwitch::createManager(JKRHeap* param_0) {
|
||||
nofralloc
|
||||
#include "asm/JSystem/JKernel/JKRThread/createManager__15JKRThreadSwitchFP7JKRHeap.s"
|
||||
JKRThreadSwitch* JKRThreadSwitch::createManager(JKRHeap* heap) {
|
||||
JUT_ASSERT("JKRThread.cpp", 0x157, sManager == 0);
|
||||
|
||||
if (!heap) {
|
||||
heap = JKRGetCurrentHeap();
|
||||
}
|
||||
|
||||
sManager = new (heap, 0) JKRThreadSwitch(heap);
|
||||
return sManager;
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* 802D1A70-802D1AE4 2CC3B0 0074+00 0/0 1/1 0/0 .text enter__15JKRThreadSwitchFP9JKRThreadi */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm JKRThread* JKRThreadSwitch::enter(JKRThread* param_0, int param_1) {
|
||||
nofralloc
|
||||
#include "asm/JSystem/JKernel/JKRThread/enter__15JKRThreadSwitchFP9JKRThreadi.s"
|
||||
JKRThread* JKRThreadSwitch::enter(JKRThread* thread, int thread_id) {
|
||||
if (!thread) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
JKRThread* found_thread = JKRThread::searchThread(thread->getThreadRecord());
|
||||
if (found_thread) {
|
||||
thread = found_thread;
|
||||
}
|
||||
|
||||
JKRThread::TLoad* loadInfo = thread->getLoadInfo();
|
||||
loadInfo->clear();
|
||||
loadInfo->setValid(true);
|
||||
loadInfo->setId(thread_id);
|
||||
return thread;
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 8039CFA8-8039CFA8 029608 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */
|
||||
@@ -262,61 +200,137 @@ SECTION_DEAD static char const* const stringBase_8039CFA8 = "on";
|
||||
SECTION_DEAD static char const* const stringBase_8039CFAB = "off";
|
||||
SECTION_DEAD static char const* const stringBase_8039CFAF =
|
||||
"JKRThread:%x OSThread:%x Load:ID:%d (%s)\n";
|
||||
SECTION_DEAD static char const* const stringBase_8039CFDC =
|
||||
"JKRThreadSwitch: currentHeap destroyed.\n";
|
||||
#pragma pop
|
||||
|
||||
/* 804513C0-804513C4 0008C0 0004+00 1/1 0/0 0/0 .sbss mUserPreCallback__15JKRThreadSwitch
|
||||
*/
|
||||
u8 JKRThreadSwitch::mUserPreCallback[4];
|
||||
|
||||
/* 804513C4-804513C8 0008C4 0004+00 1/1 0/0 0/0 .sbss mUserPostCallback__15JKRThreadSwitch */
|
||||
u8 JKRThreadSwitch::mUserPostCallback[4];
|
||||
|
||||
/* 802D1AE4-802D1C74 2CC424 0190+00 1/1 0/0 0/0 .text
|
||||
* callback__15JKRThreadSwitchFP8OSThreadP8OSThread */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm void JKRThreadSwitch::callback(OSThread* param_0, OSThread* param_1) {
|
||||
nofralloc
|
||||
#include "asm/JSystem/JKernel/JKRThread/callback__15JKRThreadSwitchFP8OSThreadP8OSThread.s"
|
||||
void JKRThreadSwitch::callback(OSThread* current, OSThread* next) {
|
||||
if (mUserPreCallback) {
|
||||
(*mUserPreCallback)(current, next);
|
||||
}
|
||||
|
||||
sTotalCount = sTotalCount + 1;
|
||||
|
||||
JKRHeap* next_heap = NULL;
|
||||
JSUList<JKRThread>& threadList = JKRThread::getList();
|
||||
JSUListIterator<JKRThread> iterator;
|
||||
for (iterator = threadList.getFirst(); iterator != threadList.getEnd(); ++iterator) {
|
||||
JKRThread* thread = iterator.getObject();
|
||||
|
||||
if (thread->getThreadRecord() == current) {
|
||||
thread->setCurrentHeap(JKRHeap::getCurrentHeap());
|
||||
JKRThread::TLoad* loadInfo = thread->getLoadInfo();
|
||||
if (loadInfo->isValid()) {
|
||||
loadInfo->addCurrentCost();
|
||||
}
|
||||
}
|
||||
|
||||
if (thread->getThreadRecord() == next) {
|
||||
JKRThread::TLoad* loadInfo = thread->getLoadInfo();
|
||||
if (loadInfo->isValid()) {
|
||||
loadInfo->setCurrentTime();
|
||||
loadInfo->incCount();
|
||||
}
|
||||
|
||||
if (sManager->mSetNextHeap) {
|
||||
next_heap = thread->getCurrentHeap();
|
||||
if (!next_heap) {
|
||||
next_heap = JKRHeap::getCurrentHeap();
|
||||
} else if (JKRHeap::getRootHeap()->isSubHeap(next_heap)) {
|
||||
continue;
|
||||
#if DEBUG
|
||||
} else if (!JKRHeap::getRootHeap2()->isSubHeap(next_heap)) {
|
||||
continue;
|
||||
#endif
|
||||
} else {
|
||||
switch (thread->getCurrentHeapError()) {
|
||||
case 0:
|
||||
JUT_PANIC("JKRThread.cpp", 0x1fc,
|
||||
"JKRThreadSwitch: currentHeap destroyed.");
|
||||
break;
|
||||
case 1:
|
||||
JUTWarningConsole("JKRThreadSwitch: currentHeap destroyed.\n");
|
||||
next_heap = JKRHeap::getCurrentHeap();
|
||||
break;
|
||||
case 2:
|
||||
next_heap = JKRHeap::getCurrentHeap();
|
||||
break;
|
||||
case 3:
|
||||
next_heap = JKRHeap::getSystemHeap();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (next_heap) {
|
||||
next_heap->becomeCurrentHeap();
|
||||
}
|
||||
|
||||
if (mUserPostCallback) {
|
||||
(*mUserPostCallback)(current, next);
|
||||
}
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 8039CFA8-8039CFA8 029608 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */
|
||||
#pragma push
|
||||
#pragma force_active on
|
||||
SECTION_DEAD static char const* const stringBase_8039D005 = " total: switch:%3d time:%d(%df)\n";
|
||||
SECTION_DEAD static char const* const stringBase_8039D027 =
|
||||
" -------------------------------------\n";
|
||||
SECTION_DEAD static char const* const stringBase_8039D04F = "%d";
|
||||
SECTION_DEAD static char const* const stringBase_8039D052 = " [%10s] switch:%5d cost:%2d.%d%%\n";
|
||||
/* @stringBase0 padding */
|
||||
SECTION_DEAD static char const* const pad_8039D075 = "\0\0";
|
||||
#pragma pop
|
||||
|
||||
/* 80455FC0-80455FC4 0045C0 0004+00 1/1 0/0 0/0 .sdata2 @934 */
|
||||
SECTION_SDATA2 static f32 lit_934 = 100.0f;
|
||||
|
||||
/* 80455FC4-80455FC8 0045C4 0004+00 1/1 0/0 0/0 .sdata2 @935 */
|
||||
SECTION_SDATA2 static f32 lit_935 = 1000.0f;
|
||||
|
||||
/* 80455FC8-80455FD0 0045C8 0008+00 1/1 0/0 0/0 .sdata2 @937 */
|
||||
SECTION_SDATA2 static f64 lit_937 = 4503599627370496.0 /* cast u32 to float */;
|
||||
|
||||
/* 802D1C74-802D1E14 2CC5B4 01A0+00 1/0 0/0 0/0 .text
|
||||
* draw__15JKRThreadSwitchFP14JKRThreadName_P10JUTConsole */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
#pragma force_active on
|
||||
asm void JKRThreadSwitch::draw(JKRThreadName_* param_0, JUTConsole* param_1) {
|
||||
nofralloc
|
||||
#include "asm/JSystem/JKernel/JKRThread/draw__15JKRThreadSwitchFP14JKRThreadName_P10JUTConsole.s"
|
||||
void JKRThreadSwitch::draw(JKRThreadName_* thread_name_list, JUTConsole* console) {
|
||||
const char* print_0 = " total: switch:%3d time:%d(%df)\n";
|
||||
const char* print_1 = " -------------------------------------\n";
|
||||
|
||||
if (!console) {
|
||||
#if DEBUG
|
||||
OSReport(print_0, getTotalCount(), (int)this->field_0x18, this->field_0x10);
|
||||
OSReport(print_1);
|
||||
#endif
|
||||
} else {
|
||||
console->clear();
|
||||
console->print_f(print_0, getTotalCount(), (int)this->field_0x18, this->field_0x10);
|
||||
console->print(print_1);
|
||||
}
|
||||
|
||||
JSUList<JKRThread>& threadList = JKRThread::getList();
|
||||
JSUListIterator<JKRThread> iterator;
|
||||
for (iterator = threadList.getFirst(); iterator != threadList.getEnd(); ++iterator) {
|
||||
JKRThread* thread = iterator.getObject();
|
||||
JKRThread::TLoad* loadInfo = thread->getLoadInfo();
|
||||
|
||||
if (loadInfo->isValid()) {
|
||||
char* thread_print_name = NULL;
|
||||
if (thread_name_list) {
|
||||
JKRThreadName_* thread_name = thread_name_list;
|
||||
for (; thread_name->name; thread_name++) {
|
||||
if (thread_name->id == loadInfo->getId()) {
|
||||
thread_print_name = thread_name->name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!thread_print_name) {
|
||||
char buffer[16];
|
||||
sprintf(buffer, "%d", loadInfo->getId());
|
||||
thread_print_name = buffer;
|
||||
}
|
||||
|
||||
u32 switch_count = loadInfo->getCount();
|
||||
float cost_per_0x18 = loadInfo->getCost() / (float)this->field_0x18;
|
||||
|
||||
u32 cost_int = (u32)(cost_per_0x18 * 100.0f);
|
||||
u32 cost_float = (u32)(cost_per_0x18 * 1000.0f) % 10;
|
||||
if (!console) {
|
||||
#if DEBUG
|
||||
OSReport(" [%10s] switch:%5d cost:%2d.%d%%\n", thread_print_name, switch_count,
|
||||
cost_int, cost_float);
|
||||
#endif
|
||||
} else {
|
||||
console->print_f(" [%10s] switch:%5d cost:%2d.%d%%\n", thread_print_name,
|
||||
switch_count, cost_int, cost_float);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* 802D1E14-802D1E1C 2CC754 0008+00 1/0 0/0 0/0 .text run__9JKRThreadFv */
|
||||
void* JKRThread::run() {
|
||||
@@ -324,25 +338,12 @@ void* JKRThread::run() {
|
||||
}
|
||||
|
||||
/* 802D1E1C-802D1E4C 2CC75C 0030+00 1/0 0/0 0/0 .text draw__15JKRThreadSwitchFP14JKRThreadName_ */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
#pragma force_active on
|
||||
asm void JKRThreadSwitch::draw(JKRThreadName_* param_0) {
|
||||
nofralloc
|
||||
#include "asm/JSystem/JKernel/JKRThread/draw__15JKRThreadSwitchFP14JKRThreadName_.s"
|
||||
void JKRThreadSwitch::draw(JKRThreadName_* thread_name_list) {
|
||||
draw(thread_name_list, NULL);
|
||||
}
|
||||
#pragma pop
|
||||
|
||||
/* 802D1E4C-802D1E94 2CC78C 0048+00 1/0 0/0 0/0 .text __dt__15JKRThreadSwitchFv */
|
||||
#pragma push
|
||||
#pragma optimization_level 0
|
||||
#pragma optimizewithasm off
|
||||
asm JKRThreadSwitch::~JKRThreadSwitch() {
|
||||
nofralloc
|
||||
#include "asm/JSystem/JKernel/JKRThread/__dt__15JKRThreadSwitchFv.s"
|
||||
}
|
||||
#pragma pop
|
||||
JKRThreadSwitch::~JKRThreadSwitch() {}
|
||||
|
||||
/* ############################################################################################## */
|
||||
/* 80434298-804342A4 060FB8 000C+00 0/1 0/0 0/0 .bss @989 */
|
||||
|
||||
Reference in New Issue
Block a user