mirror of
https://github.com/SwareJonge/mkdd.git
synced 2024-11-26 23:00:25 +00:00
formatting
This commit is contained in:
parent
a02d568d20
commit
9ac38a019c
@ -8,7 +8,8 @@
|
|||||||
|
|
||||||
// TODO: Add JKRExpHeap and JKRAssertHeap to here?
|
// TODO: Add JKRExpHeap and JKRAssertHeap to here?
|
||||||
typedef void JKRHeapErrorHandler(void *, u32, int);
|
typedef void JKRHeapErrorHandler(void *, u32, int);
|
||||||
class JKRHeap : public JKRDisposer {
|
class JKRHeap : public JKRDisposer
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
enum EAllocMode
|
enum EAllocMode
|
||||||
{
|
{
|
||||||
@ -78,7 +79,7 @@ public:
|
|||||||
JKRHeap(void *, u32, JKRHeap *, bool);
|
JKRHeap(void *, u32, JKRHeap *, bool);
|
||||||
|
|
||||||
bool setErrorFlag(bool errorFlag);
|
bool setErrorFlag(bool errorFlag);
|
||||||
bool isSubHeap(JKRHeap* heap) const;
|
bool isSubHeap(JKRHeap *heap) const;
|
||||||
|
|
||||||
/////////////// VTABLE
|
/////////////// VTABLE
|
||||||
virtual ~JKRHeap(); // _08
|
virtual ~JKRHeap(); // _08
|
||||||
@ -104,9 +105,9 @@ public:
|
|||||||
virtual bool state_compare(const TState &, const TState &) const; // _58
|
virtual bool state_compare(const TState &, const TState &) const; // _58
|
||||||
virtual void state_dump(const TState &) const; // _5C
|
virtual void state_dump(const TState &) const; // _5C
|
||||||
|
|
||||||
JKRHeap* becomeSystemHeap();
|
JKRHeap *becomeSystemHeap();
|
||||||
JKRHeap* becomeCurrentHeap();
|
JKRHeap *becomeCurrentHeap();
|
||||||
void destroy();
|
void destroy();
|
||||||
void *alloc(u32, int);
|
void *alloc(u32, int);
|
||||||
void free(void *);
|
void free(void *);
|
||||||
void freeAll();
|
void freeAll();
|
||||||
@ -130,11 +131,13 @@ public:
|
|||||||
void dispose(); // 0x80084cb8
|
void dispose(); // 0x80084cb8
|
||||||
void dispose_subroutine(u32 begin, u32 end);
|
void dispose_subroutine(u32 begin, u32 end);
|
||||||
|
|
||||||
void appendDisposer(JKRDisposer * disposer) {
|
void appendDisposer(JKRDisposer *disposer)
|
||||||
|
{
|
||||||
mDisposerList.append(&disposer->mPointerLinks);
|
mDisposerList.append(&disposer->mPointerLinks);
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeDisposer(JKRDisposer * disposer) {
|
void removeDisposer(JKRDisposer *disposer)
|
||||||
|
{
|
||||||
mDisposerList.remove(&disposer->mPointerLinks);
|
mDisposerList.remove(&disposer->mPointerLinks);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,8 +147,10 @@ public:
|
|||||||
void *getEndAddr() const { return (void *)mEndAddress; }
|
void *getEndAddr() const { return (void *)mEndAddress; }
|
||||||
u32 getHeapSize() const { return mHeapSize; }
|
u32 getHeapSize() const { return mHeapSize; }
|
||||||
bool getErrorFlag() const { return mErrorFlag; }
|
bool getErrorFlag() const { return mErrorFlag; }
|
||||||
void callErrorHandler(JKRHeap *heap, u32 size, int alignment) {
|
void callErrorHandler(JKRHeap *heap, u32 size, int alignment)
|
||||||
if (mErrorHandler) {
|
{
|
||||||
|
if (mErrorHandler)
|
||||||
|
{
|
||||||
(*mErrorHandler)(heap, size, alignment);
|
(*mErrorHandler)(heap, size, alignment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -160,7 +165,7 @@ public:
|
|||||||
{
|
{
|
||||||
state->mUsedSize = usedSize;
|
state->mUsedSize = usedSize;
|
||||||
}
|
}
|
||||||
static void setState_u32CheckCode_(TState * state, u32 checkCode) { state->mCheckCode = checkCode; }
|
static void setState_u32CheckCode_(TState *state, u32 checkCode) { state->mCheckCode = checkCode; }
|
||||||
|
|
||||||
void lock() const { OSLockMutex(&mMutex); }
|
void lock() const { OSLockMutex(&mMutex); }
|
||||||
void unlock() const { OSUnlockMutex(&mMutex); }
|
void unlock() const { OSUnlockMutex(&mMutex); }
|
||||||
@ -170,7 +175,8 @@ public:
|
|||||||
return mHeapTree.getParent()->getObject();
|
return mHeapTree.getParent()->getObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
const JSUTree<JKRHeap> &getHeapTree() {
|
const JSUTree<JKRHeap> &getHeapTree()
|
||||||
|
{
|
||||||
return mHeapTree;
|
return mHeapTree;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,53 +191,30 @@ public:
|
|||||||
static void state_dumpDifference(const TState &r1, const TState &r2);
|
static void state_dumpDifference(const TState &r1, const TState &r2);
|
||||||
static JKRHeap *findFromRoot(void *memory);
|
static JKRHeap *findFromRoot(void *memory);
|
||||||
static JKRHeapErrorHandler *setErrorHandler(JKRHeapErrorHandler *errorHandler);
|
static JKRHeapErrorHandler *setErrorHandler(JKRHeapErrorHandler *errorHandler);
|
||||||
|
|
||||||
static void * getCodeStart() {
|
|
||||||
return mCodeStart;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void *getCodeEnd() {
|
static void *getCodeStart() { return mCodeStart; }
|
||||||
return mCodeEnd;
|
static void *getCodeEnd() { return mCodeEnd; }
|
||||||
}
|
static void *getUserRamStart() { return mUserRamStart; }
|
||||||
|
static void *getUserRamEnd() {return mUserRamEnd; }
|
||||||
|
static u32 getMemorySize() { return mMemorySize; }
|
||||||
|
static JKRHeap *getCurrentHeap() { return sCurrentHeap; }
|
||||||
|
static JKRHeap *getRootHeap() { return sRootHeap; }
|
||||||
|
static JKRHeap *getSystemHeap() { return sSystemHeap; }
|
||||||
|
|
||||||
static void *getUserRamStart() {
|
static void *mCodeStart;
|
||||||
return mUserRamStart;
|
static void *mCodeEnd;
|
||||||
}
|
static void *mUserRamStart;
|
||||||
|
static void *mUserRamEnd;
|
||||||
static void *getUserRamEnd() {
|
|
||||||
return mUserRamEnd;
|
|
||||||
}
|
|
||||||
|
|
||||||
static u32 getMemorySize() {
|
|
||||||
return mMemorySize;
|
|
||||||
}
|
|
||||||
|
|
||||||
static JKRHeap * getCurrentHeap() {
|
|
||||||
return sCurrentHeap;
|
|
||||||
}
|
|
||||||
|
|
||||||
static JKRHeap *getRootHeap() {
|
|
||||||
return sRootHeap;
|
|
||||||
}
|
|
||||||
|
|
||||||
static JKRHeap *getSystemHeap() {
|
|
||||||
return sSystemHeap;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void* mCodeStart;
|
|
||||||
static void* mCodeEnd;
|
|
||||||
static void* mUserRamStart;
|
|
||||||
static void* mUserRamEnd;
|
|
||||||
static u32 mMemorySize;
|
static u32 mMemorySize;
|
||||||
|
|
||||||
static JKRHeap* sSystemHeap;
|
static JKRHeap *sSystemHeap;
|
||||||
static JKRHeap* sCurrentHeap;
|
static JKRHeap *sCurrentHeap;
|
||||||
static JKRHeap* sRootHeap;
|
static JKRHeap *sRootHeap;
|
||||||
|
|
||||||
static bool sDefaultFillFlag;
|
static bool sDefaultFillFlag;
|
||||||
static bool sDefaultFillCheckFlag;
|
static bool sDefaultFillCheckFlag;
|
||||||
|
|
||||||
static JKRHeapErrorHandler* mErrorHandler;
|
static JKRHeapErrorHandler *mErrorHandler;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
mutable OSMutex mMutex; // _18
|
mutable OSMutex mMutex; // _18
|
||||||
@ -253,7 +236,8 @@ class JKRSolidHeap : public JKRHeap
|
|||||||
public:
|
public:
|
||||||
struct State
|
struct State
|
||||||
{
|
{
|
||||||
State(State * other, u32 cnt) {
|
State(State *other, u32 cnt)
|
||||||
|
{
|
||||||
mCnt = cnt;
|
mCnt = cnt;
|
||||||
mSize = other->mSize;
|
mSize = other->mSize;
|
||||||
_08 = other->_08;
|
_08 = other->_08;
|
||||||
@ -321,41 +305,16 @@ private:
|
|||||||
State *_78; // _78, seems to be some linked list struct in TP
|
State *_78; // _78, seems to be some linked list struct in TP
|
||||||
};
|
};
|
||||||
|
|
||||||
inline JKRSolidHeap *JKRCreateSolidHeap(size_t size, JKRHeap *heap, bool p3) {
|
inline JKRSolidHeap *JKRCreateSolidHeap(size_t size, JKRHeap *heap, bool p3) { return JKRSolidHeap::create(size, heap, p3); }
|
||||||
return JKRSolidHeap::create(size, heap, p3);
|
inline JKRHeap *JKRGetCurrentHeap() { return JKRHeap::getCurrentHeap(); }
|
||||||
}
|
|
||||||
|
|
||||||
inline JKRHeap * JKRGetCurrentHeap() {
|
|
||||||
return JKRHeap::getCurrentHeap();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline JKRHeap *JKRSetCurrentHeap(JKRHeap *heap) { return heap->becomeCurrentHeap(); }
|
inline JKRHeap *JKRSetCurrentHeap(JKRHeap *heap) { return heap->becomeCurrentHeap(); }
|
||||||
|
inline JKRHeap *JKRGetSystemHeap() { return JKRHeap::getSystemHeap(); }
|
||||||
inline JKRHeap *JKRGetSystemHeap(){
|
inline JKRHeap *JKRGetRootHeap() { return JKRHeap::getRootHeap(); }
|
||||||
return JKRHeap::getSystemHeap();
|
inline void *JKRAllocFromSysHeap(u32 size, int alignment) { return JKRHeap::getSystemHeap()->alloc(size, alignment); }
|
||||||
}
|
inline void *JKRAllocFromHeap(JKRHeap *heap, u32 size, int alignment) { return JKRHeap::alloc(size, alignment, heap); }
|
||||||
|
inline void JKRFree(void *pBuf) { JKRHeap::free(pBuf, nullptr); }
|
||||||
inline JKRHeap *JKRGetRootHeap(){
|
|
||||||
return JKRHeap::getRootHeap();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void *JKRAllocFromSysHeap(u32 size, int alignment) {
|
|
||||||
return JKRHeap::getSystemHeap()->alloc(size, alignment);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void * JKRAllocFromHeap(JKRHeap * heap, u32 size, int alignment) {
|
|
||||||
return JKRHeap::alloc(size, alignment, heap);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void JKRFree(void * pBuf) {
|
|
||||||
JKRHeap::free(pBuf, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void JKRFreeToHeap(JKRHeap *heap, void *ptr) { JKRHeap::free(ptr, heap); }
|
inline void JKRFreeToHeap(JKRHeap *heap, void *ptr) { JKRHeap::free(ptr, heap); }
|
||||||
|
inline void JKRFreeToSysHeap(void *buf) { JKRHeap::getSystemHeap()->free(buf); }
|
||||||
inline void JKRFreeToSysHeap(void * buf) {
|
|
||||||
JKRHeap::getSystemHeap()->free(buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
void JKRDefaultMemoryErrorRoutine(void *, u32, int);
|
void JKRDefaultMemoryErrorRoutine(void *, u32, int);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user