1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: os_StackMemoryAutoStackManager.h 4 5 Copyright (C)2009-2012 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:$ 14 *---------------------------------------------------------------------------*/ 15 16 #ifndef NN_OS_OS_STACKMEMORYAUTOSTACKMANAGER_H_ 17 #define NN_OS_OS_STACKMEMORYAUTOSTACKMANAGER_H_ 18 19 #include <nn/config.h> 20 #if NN_PLATFORM_HAS_MMU 21 22 #ifdef __cplusplus 23 24 #include <nn/os/os_Mutex.h> 25 #include <nn/os/os_SimpleAutoStackManagerBase.h> 26 27 namespace nn { 28 namespace fnd 29 { 30 class IAllocator; 31 } 32 33 namespace os { 34 35 36 /* Please see man pages for details 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 */ 54 class StackMemoryAutoStackManager : public SimpleAutoStackManagerBase 55 { 56 private: 57 typedef SimpleAutoStackManagerBase Base; 58 59 public: 60 /* Please see man pages for details 61 62 63 64 */ StackMemoryAutoStackManager()65 StackMemoryAutoStackManager(){} 66 67 /* Please see man pages for details 68 69 70 71 72 73 74 */ ~StackMemoryAutoStackManager()75 virtual ~StackMemoryAutoStackManager(){} 76 77 /* Please see man pages for details 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 */ Initialize(fnd::IAllocator * pAllocator,uptr stackBottom)102 void Initialize(fnd::IAllocator* pAllocator, uptr stackBottom) 103 { Base::Initialize(pAllocator, stackBottom); } 104 105 /* Please see man pages for details 106 107 108 109 110 111 112 113 114 115 116 117 118 119 */ 120 template <typename StackT> Initialize(fnd::IAllocator * pAllocator,StackT & stack)121 void Initialize(fnd::IAllocator* pAllocator, StackT& stack) 122 { 123 Initialize(pAllocator, stack.GetStackBottom()); 124 } 125 126 /* Please see man pages for details 127 128 129 130 */ Finalize()131 uptr Finalize() 132 { return Base::Finalize(); } 133 134 /* Please see man pages for details 135 136 137 138 139 140 */ 141 virtual void* Construct(size_t stackSize); 142 143 /* Please see man pages for details 144 145 146 147 148 149 150 */ Destruct(void * pStackBottom,bool isError)151 virtual void Destruct(void* pStackBottom, bool isError) 152 { Base::DestructImpl(pStackBottom, isError); } 153 154 private: 155 virtual void FreeStack(void* pStackBottom); 156 }; 157 158 159 }} // namespace nn::os 160 161 #endif // __cplusplus 162 163 #endif // if NN_PLATFORM_HAS_MMU 164 #endif /* NN_OS_OS_STACKMEMORYAUTOSTACKMANAGER_H_ */ 165