1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: ro_Api.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: 47385 $ 14 *---------------------------------------------------------------------------*/ 15 16 #ifndef NN_RO_RO_API_H_ 17 #define NN_RO_RO_API_H_ 18 19 #include <nn/config.h> 20 #include <nn/Handle.h> 21 #include <nn/Result.h> 22 #include <nn/types.h> 23 #include <nn/ro/ro_Types.h> 24 25 namespace nn { 26 namespace ro { 27 28 class Module; 29 class RegistrationList; 30 31 namespace detail 32 { 33 const char PORT_NAME_DYNAMIC_LOADER[] = "ldr:ro"; 34 const s32 ENTRY_NOT_FOUND = -1; 35 36 uptr GetOriginalAddress(const void* p); 37 void UpdateRegistrationListNode(RegistrationList* p); 38 s32 FindRegistrationListEntry(const RegistrationList** pp, const void* p); 39 void* GetRoot(); 40 41 NN_WEAK_SYMBOL bool IsCodeAddress(uptr addr); 42 } 43 44 45 // 46 // 47 const size_t REQUIRED_SIZE_FOR_GET_SIZE_INFO = 0x100; 48 49 50 51 //--------------------------------------------------------------------------- 52 // 53 // 54 // 55 // 56 // 57 // 58 // 59 // 60 // 61 // 62 // 63 // 64 // 65 // 66 //--------------------------------------------------------------------------- 67 Result Initialize(void* pRs, size_t rsSize); 68 69 //--------------------------------------------------------------------------- 70 // 71 // 72 // 73 //--------------------------------------------------------------------------- 74 Result Finalize(); 75 76 //--------------------------------------------------------------------------- 77 // 78 // 79 // 80 // 81 // 82 // 83 // 84 // 85 // 86 // 87 // 88 // 89 // 90 // 91 // 92 // 93 // 94 //--------------------------------------------------------------------------- 95 RegistrationList* RegisterList(void* pRr, size_t rrSize); 96 97 //--------------------------------------------------------------------------- 98 // 99 // 100 // 101 // 102 // 103 // 104 // 105 // 106 // 107 // 108 // 109 // 110 // 111 // 112 // 113 // 114 //--------------------------------------------------------------------------- 115 Result GetSizeInfo(SizeInfo* pInfo, const void* pRo); 116 117 //--------------------------------------------------------------------------- 118 // 119 // 120 // 121 // 122 // 123 // 124 // 125 // 126 // 127 // 128 // 129 // 130 // 131 //--------------------------------------------------------------------------- 132 uptr GetAddress(const char* name); 133 134 //--------------------------------------------------------------------------- 135 // 136 // 137 // 138 // 139 // 140 // 141 // 142 // 143 // 144 // 145 // 146 // 147 // 148 // 149 // 150 //--------------------------------------------------------------------------- 151 template<typename T> GetPointer(const char * name)152 T GetPointer(const char* name) 153 { return reinterpret_cast<T>(GetAddress(name)); } 154 155 //--------------------------------------------------------------------------- 156 // 157 // 158 // 159 // 160 // 161 // 162 // 163 // 164 // 165 // 166 // 167 //--------------------------------------------------------------------------- 168 Module* FindModule(const char* pName); 169 170 //--------------------------------------------------------------------------- 171 // 172 // 173 // 174 // 175 // 176 // 177 // 178 // 179 // 180 // 181 // 182 // 183 // 184 // 185 // 186 // 187 // 188 // 189 // 190 // 191 // 192 // 193 // 194 // 195 // 196 // 197 // 198 // 199 // 200 // 201 // 202 // 203 // 204 // 205 // 206 // 207 // 208 // 209 // 210 // 211 // 212 // 213 // 214 // 215 // 216 // 217 // 218 // 219 // 220 // 221 // 222 // 223 // 224 //--------------------------------------------------------------------------- 225 Module* LoadModule(void* pRo, size_t roSize, void* pBuffer, size_t bufferSize, 226 bool doRegister = true, 227 FixLevel fixLevel = FIX_LEVEL_1, 228 const RegistrationList* pRr = NULL ); 229 230 231 } // end of namespace ro 232 } // end of namespace nn 233 234 235 236 237 238 /* Please see man pages for details 239 240 241 242 243 244 245 */ 246 247 //--------------------------------------------------------------------------- 248 // 249 // 250 // 251 // 252 // 253 // 254 // 255 // 256 // 257 //--------------------------------------------------------------------------- 258 extern "C" NN_DLL_EXPORT void nnroProlog(); 259 260 261 //--------------------------------------------------------------------------- 262 // 263 // 264 // 265 // 266 // 267 // 268 // 269 // 270 // 271 //--------------------------------------------------------------------------- 272 extern "C" NN_DLL_EXPORT void nnroEpilog(); 273 274 275 //--------------------------------------------------------------------------- 276 // 277 // 278 // 279 // 280 // 281 // 282 // 283 // 284 // 285 // 286 //--------------------------------------------------------------------------- 287 extern "C" NN_DLL_EXPORT void nnroUnresolved(); 288 289 /* 290 291 */ 292 293 294 #endif // ifndef NN_RO_RO_API_H_ 295