1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: fnd_DetailHeapHead.h 4 5 Copyright (C)2009 Nintendo Co., Ltd. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Rev: 12449 $ 14 *---------------------------------------------------------------------------*/ 15 16 /*! @file 17 @brief Heap に関するAPI の宣言 18 19 */ 20 21 #ifndef NN_FND_DETAIL_FND_DETAIL_HEAP_HEAD_H_ 22 #define NN_FND_DETAIL_FND_DETAIL_HEAP_HEAD_H_ 23 24 #ifdef __cplusplus 25 26 namespace nn{ namespace fnd{ namespace detail { 27 28 /*---------------------------------------------------------------------------* 29 Name: NNSFndLink 30 31 Description: 双方向リンクリストのノード構造体です。この構造体をリスト構造 32 で繋ぎたい構造体のメンバとして格納します。 33 *---------------------------------------------------------------------------*/ 34 typedef struct 35 { 36 void* prevObject; // 前に繋がれているオブジェクトへのポインタ。 37 void* nextObject; // 次に繋がれているオブジェクトへのポインタ。 38 39 } NNSFndLink; 40 41 42 /*---------------------------------------------------------------------------* 43 Name: NNSFndList 44 45 Description: 双方向リンクリスト構造体です。 46 *---------------------------------------------------------------------------*/ 47 typedef struct 48 { 49 void* headObject; // 先頭に繋がれているオブジェクトへのポインタ。 50 void* tailObject; // 後尾に繋がれているオブジェクトへのポインタ。 51 u16 numObjects; // リストに繋がれているオブジェクトの個数。 52 u16 offset; // NNSFndLink型の構造体メンバのオフセット。 53 54 } NNSFndList; 55 56 // メモリのヘッダ情報 57 struct NNSiFndExpHeapMBlockHead 58 { 59 u16 signature; // シグネチャ 60 u16 attribute; // 属性 61 // [8:グループID] 62 // [7:アラインメント] 63 // [1:テンポラリフラグ] 64 65 u32 blockSize; // ブロックサイズ(データ領域のみ) 66 67 NNSiFndExpHeapMBlockHead* pMBHeadPrev; // 前ブロック 68 NNSiFndExpHeapMBlockHead* pMBHeadNext; // 次ブロック 69 }; 70 71 // メモリのリスト 72 struct NNSiFndExpMBlockList 73 { 74 NNSiFndExpHeapMBlockHead* head; // 先頭に繋がれているメモリへのポインタ 75 NNSiFndExpHeapMBlockHead* tail; // 後尾に繋がれているメモリへのポインタ 76 }; 77 78 // 拡張ヒープのヘッダ情報 79 struct NNSiFndExpHeapHead 80 { 81 NNSiFndExpMBlockList mbFreeList; // フリーリスト 82 NNSiFndExpMBlockList mbUsedList; // 使用リスト 83 84 u16 groupID; // カレントグループID (下位8bitのみ) 85 u16 feature; // 属性 86 bool reuse; // アラインメントの際に発生する隙間の領域を再利用するかどうか 87 NN_PADDING3; 88 }; 89 90 struct ExpHeapImpl 91 { ExpHeapImplExpHeapImpl92 ExpHeapImpl() : signature(0) {} 93 94 u32 signature; 95 96 NNSFndLink link; 97 NNSFndList childList; 98 99 void* heapStart; // ヒープ先頭アドレス 100 void* heapEnd; // ヒープ末尾(+1)アドレス 101 102 u32 attribute; // 属性 103 // [8:オプションフラグ] 104 NNSiFndExpHeapHead nnsiFndExpHeapHead; 105 }; 106 107 }}} // namespace nn::fnd::detail 108 109 #endif // __cplusplus 110 111 /* NN_FND_DETAIL_FND_DETAIL_HEAP_HEAD_H_ */ 112 #endif 113 114