1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     os_Memory.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: 47391 $
14  *---------------------------------------------------------------------------*/
15 
16 /* Please see man pages for details
17 
18 
19 
20 */
21 
22 #ifndef NN_OS_OS_MEMORY_H_
23 #define NN_OS_OS_MEMORY_H_
24 
25 #include <nn/types.h>
26 #include <nn/Handle.h>
27 #include <nn/svc.h>
28 #include <nn/os/CTR/os_MemoryConfig.h>
29 
30 #ifdef __cplusplus
31 
32 #include <nn/util/util_NonCopyable.h>
33 #include <nn/os/os_SvcTypes.autogen.h>
34 #include <nn/util/util_Result.h>
35 
36 
37 namespace nn{ namespace os{
38 
39 
40 /*
41 
42 
43 
44 
45 
46 
47  */
48 void SetupHeapForMemoryBlock(size_t heapSize);
49 
50 
51 
52 
53 /*
54 
55 
56 
57 
58 
59 
60 
61  */
62 uptr GetDeviceMemoryAddress();
63 
64 
65 
66 /*
67 
68 
69 
70 
71 
72 
73 
74 
75 
76  */
77 Result SetDeviceMemorySize(size_t size);
78 
79 
80 
81 /*
82 
83 
84 
85 
86  */
87 size_t GetDeviceMemorySize();
88 
89 
90 
91 /*
92 
93 
94 
95 
96 
97 
98 
99 
100 
101 
102 
103 
104 
105  */
106 uptr GetHeapAddress();
107 
108 
109 
110 /*
111 
112 
113 
114 
115 
116 
117 
118 
119 
120 
121 
122 
123 
124  */
125 Result SetHeapSize(size_t size);
126 
127 
128 
129 /*
130 
131 
132 
133 
134 
135 
136 
137 
138 
139 
140  */
141 size_t GetHeapSize();
142 
143 
144 
145 //---------------------------------------------------------------------------
146 //
147 //
148 //
149 //
150 //
151 //
152 //---------------------------------------------------------------------------
153 uptr GetCodeRegionAddress();
154 
155 
156 
157 //---------------------------------------------------------------------------
158 //
159 //
160 //
161 //
162 //
163 //
164 //---------------------------------------------------------------------------
165 size_t GetCodeRegionSize();
166 
167 
168 
169     namespace detail
170     {
GetHeapAddressWithoutCheck()171         inline uptr GetHeapAddressWithoutCheck()
172         {
173             return NN_OS_ADDR_HEAP_BEGIN;
174         }
175     }
176 }} // namespace nn::os
177 
178 #endif // __cplusplus
179 
180 // Below is the C declaration
181 
182 #include <nn/util/detail/util_CLibImpl.h>
183 
184 /* Please see man pages for details
185 
186 
187 */
188 
189 /* Please see man pages for details
190 
191 */
192 NN_EXTERN_C uptr nnosGetDeviceMemoryAddress(void);
193 
194 /*
195 
196 */
197 
198 /* NN_OS_MEMORY_H_ */
199 #endif /* NN_OS_OS_MEMORY_H_ */
200