[2826] | 1 | /* $Id: kLdrInternal.h 2883 2006-11-18 11:21:33Z bird $ */
|
---|
[2825] | 2 | /** @file
|
---|
| 3 | *
|
---|
| 4 | * kLdr - The Dynamic Loader, internal header.
|
---|
| 5 | *
|
---|
| 6 | * Copyright (c) 2006 knut st. osmundsen <bird-kbuild-src@anduin.net>
|
---|
| 7 | *
|
---|
| 8 | *
|
---|
| 9 | * This file is part of kLdr.
|
---|
| 10 | *
|
---|
| 11 | * kLdr is free software; you can redistribute it and/or modify
|
---|
| 12 | * it under the terms of the GNU General Public License as published by
|
---|
| 13 | * the Free Software Foundation; either version 2 of the License, or
|
---|
| 14 | * (at your option) any later version.
|
---|
| 15 | *
|
---|
| 16 | * kLdr is distributed in the hope that it will be useful,
|
---|
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 19 | * GNU General Public License for more details.
|
---|
| 20 | *
|
---|
| 21 | * You should have received a copy of the GNU General Public License
|
---|
| 22 | * along with kLdr; if not, write to the Free Software
|
---|
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
| 24 | *
|
---|
| 25 | */
|
---|
| 26 |
|
---|
| 27 |
|
---|
| 28 | #ifndef __kLdrInternal_h__
|
---|
| 29 | #define __kLdrInternal_h__
|
---|
| 30 |
|
---|
| 31 | #ifdef __cplusplus
|
---|
| 32 | extern "C" {
|
---|
| 33 | #endif
|
---|
| 34 |
|
---|
[2883] | 35 | #if !defined(__X86__) || !defined(__AMD64__)
|
---|
| 36 | # if defined(__i386__) || defined(_M_IX86)
|
---|
| 37 | # define __X86__
|
---|
| 38 | # elif defined(__x86_64__) || defined(_M_X64) || defined(__AMD64__) || defined(_M_AMD64)
|
---|
| 39 | # define __AMD64__
|
---|
| 40 | # else
|
---|
| 41 | # error "can't figure out the target arch."
|
---|
| 42 | # endif
|
---|
| 43 | #endif
|
---|
| 44 |
|
---|
[2827] | 45 | /* ignore definitions in winnt.h */
|
---|
| 46 | #undef IMAGE_DOS_SIGNATURE
|
---|
| 47 | #undef IMAGE_NT_SIGNATURE
|
---|
| 48 |
|
---|
| 49 | /** @name Signatures we know
|
---|
| 50 | * @{ */
|
---|
| 51 | /** ELF signature ("\x7fELF"). */
|
---|
| 52 | #define IMAGE_ELF_SIGNATURE KLDRHLP_LE2H_U32(0x7f | ('E' << 8) | ((uint32_t)'L' << 16) | ((uint32_t)'F' << 24))
|
---|
| 53 | /** PE signature ("PE\0\0"). */
|
---|
| 54 | #define IMAGE_NT_SIGNATURE KLDRHLP_LE2H_U32('P' | ('E' << 8))
|
---|
| 55 | /** LX signature ("LX") */
|
---|
| 56 | #define IMAGE_LX_SIGNATURE KLDRHLP_LE2H_U16('L' | ('X' << 8))
|
---|
| 57 | /** LE signature ("LE") */
|
---|
| 58 | #define IMAGE_LE_SIGNATURE KLDRHLP_LE2H_U16('L' | ('E' << 8))
|
---|
| 59 | /** NE signature ("NE") */
|
---|
| 60 | #define IMAGE_NE_SIGNATURE KLDRHLP_LE2H_U16('N' | ('E' << 8))
|
---|
| 61 | /** MZ signature ("MZ"). */
|
---|
| 62 | #define IMAGE_DOS_SIGNATURE KLDRHLP_LE2H_U16('M' | ('Z' << 8))
|
---|
| 63 | /** @} */
|
---|
| 64 |
|
---|
[2833] | 65 | /** @defgroup grp_kLdrInternal Internals
|
---|
| 66 | * @internal
|
---|
| 67 | * @{
|
---|
| 68 | */
|
---|
[2827] | 69 |
|
---|
[2833] | 70 |
|
---|
[2825] | 71 | /** Native file provider operations. */
|
---|
| 72 | extern const KLDRRDROPS g_kLdrRdrFileOps;
|
---|
| 73 |
|
---|
| 74 |
|
---|
| 75 | /**
|
---|
| 76 | * The state of a dynamic loader module.
|
---|
[2840] | 77 | * @image html KLDRSTATE.gif "The state diagram"
|
---|
[2825] | 78 | */
|
---|
| 79 | typedef enum KLDRSTATE
|
---|
| 80 | {
|
---|
| 81 | /** The usual invalid 0 enum. */
|
---|
| 82 | KLDRSTATE_INVALID = 0,
|
---|
[2840] | 83 |
|
---|
| 84 | /** The module has just been opened and linked into the load list.
|
---|
| 85 | *
|
---|
[2836] | 86 | * Prev state: -
|
---|
[2840] | 87 | * Next state: MAPPED, PENDING_DESTROY
|
---|
[2836] | 88 | */
|
---|
[2825] | 89 | KLDRSTATE_OPEN,
|
---|
[2840] | 90 |
|
---|
| 91 | /** The module segments has been mapped into the process memory.
|
---|
| 92 | *
|
---|
[2836] | 93 | * Prev state: OPEN
|
---|
[2840] | 94 | * Next state: LOADED_PREREQUISITES, PENDING_DESTROY
|
---|
[2836] | 95 | */
|
---|
| 96 | KLDRSTATE_MAPPED,
|
---|
[2837] | 97 | /** The module has been reloaded and needs to be fixed up again.
|
---|
[2840] | 98 | * This can occure when the loader is called recursivly.
|
---|
| 99 | *
|
---|
| 100 | * The reason RELOADED modules must go back to the PENDING_GC state is
|
---|
| 101 | * because we want to guard against uninit order issues, and therefore
|
---|
| 102 | * doesn't unmap modules untill all pending termintation callbacks has
|
---|
| 103 | * been executed.
|
---|
| 104 | *
|
---|
[2837] | 105 | * Prev state: PENDING_GC
|
---|
[2840] | 106 | * Next state: RELOADED_LOADED_PREREQUISITES, PENDING_GC
|
---|
[2837] | 107 | */
|
---|
| 108 | KLDRSTATE_RELOADED,
|
---|
[2840] | 109 |
|
---|
[2837] | 110 | /** The immediate prerequisites have been loaded.
|
---|
[2840] | 111 | *
|
---|
| 112 | * Prev state: MAPPED
|
---|
| 113 | * Next state: FIXED_UP, PENDING_DESTROY
|
---|
[2836] | 114 | */
|
---|
[2837] | 115 | KLDRSTATE_LOADED_PREREQUISITES,
|
---|
[2840] | 116 | /** The immediate prerequisites have been loaded for a reloaded module.
|
---|
| 117 | *
|
---|
| 118 | * Prev state: RELOADED
|
---|
| 119 | * Next state: RELOADED_FIXED_UP, PENDING_GC
|
---|
| 120 | */
|
---|
| 121 | KLDRSTATE_RELOADED_LOADED_PREREQUISITES,
|
---|
| 122 |
|
---|
[2836] | 123 | /** Fixups has been applied.
|
---|
[2840] | 124 | *
|
---|
[2837] | 125 | * Prev state: LOADED_PREREQUISITES
|
---|
[2840] | 126 | * Next state: PENDING_INITIALIZATION, PENDING_DESTROY
|
---|
[2836] | 127 | */
|
---|
| 128 | KLDRSTATE_FIXED_UP,
|
---|
[2840] | 129 | /** Fixups has been applied.
|
---|
| 130 | *
|
---|
| 131 | * Prev state: RELOADED_LOADED_PREREQUISITES
|
---|
[2836] | 132 | * Next state: PENDING_INITIALIZATION, PENDING_GC
|
---|
| 133 | */
|
---|
[2840] | 134 | KLDRSTATE_RELOADED_FIXED_UP,
|
---|
| 135 |
|
---|
| 136 | /** Pending initialization.
|
---|
| 137 | * While the module is in this state the loader is in reentrant mode.
|
---|
| 138 | *
|
---|
| 139 | * Prev state: FIXED_UP, RELOADED_FIXED_UP
|
---|
| 140 | * Next state: INITIALIZATION, PENDING_GC
|
---|
| 141 | */
|
---|
[2836] | 142 | KLDRSTATE_PENDING_INITIALIZATION,
|
---|
[2840] | 143 |
|
---|
[2836] | 144 | /** Initializing.
|
---|
[2840] | 145 | * While the module is in this state the loader is in reentrant mode.
|
---|
| 146 | *
|
---|
[2836] | 147 | * Prev state: PENDING_INITIALIZATION
|
---|
| 148 | * Next state: GOOD, PENDING_GC
|
---|
| 149 | */
|
---|
| 150 | KLDRSTATE_INITIALIZING,
|
---|
[2840] | 151 |
|
---|
| 152 | /** Initialization failed.
|
---|
| 153 | *
|
---|
| 154 | * This is somewhat similar to PENDING_GC except that, a module
|
---|
| 155 | * in this state cannot be reloaded untill we've done GC. This ensures
|
---|
| 156 | * that a init failure during recursive loading is propagated up.
|
---|
| 157 | *
|
---|
| 158 | * While the module is in this state the loader is in reentrant mode.
|
---|
| 159 | *
|
---|
| 160 | * Prev state: INITIALIZING
|
---|
| 161 | * Next state: GC
|
---|
| 162 | */
|
---|
| 163 | KLDRSTATE_INITIALIZATION_FAILED,
|
---|
| 164 |
|
---|
[2836] | 165 | /** The module has been successfully loaded and initialized.
|
---|
[2840] | 166 | * While the module is in this state the loader can be in reentrant
|
---|
| 167 | * or 'unused' mode.
|
---|
| 168 | *
|
---|
[2836] | 169 | * Prev state: INITIALIZING
|
---|
| 170 | * Next state: PENDING_TERMINATION
|
---|
| 171 | */
|
---|
| 172 | KLDRSTATE_GOOD,
|
---|
[2840] | 173 |
|
---|
[2836] | 174 | /** Pending termination, reference count is 0.
|
---|
[2840] | 175 | * While the module is in this state the loader is in reentrant mode.
|
---|
[2842] | 176 | * Prerequisite modules are dropped when a module enters this state.
|
---|
[2840] | 177 | *
|
---|
[2836] | 178 | * Prev state: GOOD
|
---|
| 179 | * Next state: TERMINATING, GOOD
|
---|
| 180 | */
|
---|
| 181 | KLDRSTATE_PENDING_TERMINATION,
|
---|
[2840] | 182 |
|
---|
[2836] | 183 | /** Terminating, reference count is still 0.
|
---|
[2840] | 184 | * While the module is in this state the loader is in reentrant mode.
|
---|
| 185 | *
|
---|
[2836] | 186 | * Prev state: PENDING_TERMINATION
|
---|
| 187 | * Next state: PENDING_GC
|
---|
| 188 | */
|
---|
| 189 | KLDRSTATE_TERMINATING,
|
---|
[2840] | 190 |
|
---|
[2836] | 191 | /** Pending garbage collection.
|
---|
[2842] | 192 | * Prerequisite modules are dropped when a module enters this state (if not done already).
|
---|
[2840] | 193 | *
|
---|
| 194 | * Prev state: TERMINATING, PENDING_INITIALIZATION, INITIALIZATION_FAILED
|
---|
[2837] | 195 | * Next state: GC, RELOADED
|
---|
[2836] | 196 | */
|
---|
| 197 | KLDRSTATE_PENDING_GC,
|
---|
[2840] | 198 |
|
---|
[2836] | 199 | /** Being garbage collected.
|
---|
[2840] | 200 | *
|
---|
| 201 | * Prev state: PENDING_GC, INITIALIZATION_FAILED
|
---|
[2837] | 202 | * Next state: PENDING_DESTROY, DESTROYED
|
---|
[2836] | 203 | */
|
---|
| 204 | KLDRSTATE_GC,
|
---|
[2840] | 205 |
|
---|
[2837] | 206 | /** The module has be unlinked, but there are still stack references to it.
|
---|
[2840] | 207 | *
|
---|
| 208 | * Prev state: GC, FIXED_UP, LOADED_PREREQUISITES, MAPPED, OPEN
|
---|
[2837] | 209 | * Next state: DESTROYED
|
---|
[2836] | 210 | */
|
---|
[2837] | 211 | KLDRSTATE_PENDING_DESTROY,
|
---|
[2840] | 212 |
|
---|
[2845] | 213 | /** The module has been destroyed but not freed yet.
|
---|
[2840] | 214 | *
|
---|
[2845] | 215 | * This happens when a module ends up being destroyed when cRefs > 0. The
|
---|
| 216 | * module structure will be freed when cRefs reaches 0.
|
---|
| 217 | *
|
---|
[2837] | 218 | * Prev state: GC, PENDING_DESTROY
|
---|
[2836] | 219 | */
|
---|
| 220 | KLDRSTATE_DESTROYED,
|
---|
[2840] | 221 |
|
---|
[2825] | 222 | /** The end of valid states (exclusive) */
|
---|
[2836] | 223 | KLDRSTATE_END = KLDRSTATE_DESTROYED,
|
---|
[2825] | 224 | /** The usual 32-bit blowup. */
|
---|
| 225 | KLDRSTATE_32BIT_HACK = 0x7fffffff
|
---|
| 226 | } KLDRSTATE;
|
---|
| 227 |
|
---|
| 228 |
|
---|
| 229 | /**
|
---|
| 230 | * Dynamic loader module.
|
---|
| 231 | */
|
---|
[2833] | 232 | typedef struct KLDRDYLDMOD
|
---|
[2825] | 233 | {
|
---|
[2833] | 234 | /** Magic number. */
|
---|
| 235 | uint32_t u32MagicHead;
|
---|
| 236 | /** The module state. */
|
---|
| 237 | KLDRSTATE enmState;
|
---|
[2825] | 238 | /** The module. */
|
---|
| 239 | PKLDRMOD pMod;
|
---|
[2836] | 240 | /** The module handle. */
|
---|
| 241 | HKLDRMOD hMod;
|
---|
[2837] | 242 | /** The total number of references. */
|
---|
[2825] | 243 | uint32_t cRefs;
|
---|
[2837] | 244 | /** The number of dependency references. */
|
---|
| 245 | uint32_t cDepRefs;
|
---|
| 246 | /** The number of dynamic load references. */
|
---|
[2825] | 247 | uint32_t cDynRefs;
|
---|
[2836] | 248 | /** Set if this is the executable module.
|
---|
| 249 | * When clear, the module is a shared object or relocatable object. */
|
---|
[2825] | 250 | uint32_t fExecutable : 1;
|
---|
| 251 | /** Global DLL (set) or specific DLL (clear). */
|
---|
[2836] | 252 | uint32_t fGlobalOrSpecific : 1;
|
---|
| 253 | /** Whether the module contains bindable symbols in the global unix namespace. */
|
---|
| 254 | uint32_t fBindable : 1;
|
---|
[2842] | 255 | /** Set if linked into the global init list. */
|
---|
| 256 | uint32_t fInitList : 1;
|
---|
| 257 | /** Already loaded or checked prerequisites.
|
---|
| 258 | * This flag is used when loading prerequisites, when set it means that
|
---|
| 259 | * this module is already seen and shouldn't be processed again. */
|
---|
| 260 | uint32_t fAlreadySeen : 1;
|
---|
[2845] | 261 | /** Set if the module is currently mapped.
|
---|
| 262 | * This is used to avoid unnecessary calls to kLdrModUnmap during cleanup. */
|
---|
| 263 | uint32_t fMapped : 1;
|
---|
[2846] | 264 | /** Set if TLS allocation has been done. (part of the mapping). */
|
---|
| 265 | uint32_t fAllocatedTLS : 1;
|
---|
[2825] | 266 | /** Reserved for future use. */
|
---|
[2846] | 267 | uint32_t f25Reserved : 25;
|
---|
[2836] | 268 | /** The load list linkage. */
|
---|
| 269 | struct
|
---|
| 270 | {
|
---|
| 271 | /** The next module in the list. */
|
---|
| 272 | struct KLDRDYLDMOD *pNext;
|
---|
| 273 | /** The prev module in the list. */
|
---|
| 274 | struct KLDRDYLDMOD *pPrev;
|
---|
| 275 | } Load;
|
---|
[2842] | 276 | /** The initialization and termination list linkage.
|
---|
| 277 | * If non-recursive initialization is used, the module will be pushed on
|
---|
| 278 | * the initialization list.
|
---|
[2840] | 279 | * A module will be linked into the termination list upon a successful
|
---|
| 280 | * return from module initialization. */
|
---|
[2836] | 281 | struct
|
---|
| 282 | {
|
---|
| 283 | /** The next module in the list. */
|
---|
| 284 | struct KLDRDYLDMOD *pNext;
|
---|
| 285 | /** The prev module in the list. */
|
---|
| 286 | struct KLDRDYLDMOD *pPrev;
|
---|
[2842] | 287 | } InitTerm;
|
---|
[2836] | 288 | /** The bind order list linkage.
|
---|
| 289 | * The module is not in this list when fBindable is clear. */
|
---|
| 290 | struct
|
---|
| 291 | {
|
---|
| 292 | /** The next module in the list. */
|
---|
| 293 | struct KLDRDYLDMOD *pNext;
|
---|
| 294 | /** The prev module in the list. */
|
---|
| 295 | struct KLDRDYLDMOD *pPrev;
|
---|
| 296 | } Bind;
|
---|
[2842] | 297 |
|
---|
| 298 | /** The number of prerequisite modules in the prereq array. */
|
---|
| 299 | uint32_t cPrereqs;
|
---|
| 300 | /** Pointer to an array of prerequisite module pointers.
|
---|
| 301 | * This array is only filled when in the states starting with
|
---|
| 302 | * KLDRSTATE_LOADED_PREREQUISITES thru KLDRSTATE_GOOD.
|
---|
| 303 | */
|
---|
| 304 | struct KLDRDYLDMOD **papPrereqs;
|
---|
| 305 |
|
---|
[2833] | 306 | /** Magic number. */
|
---|
| 307 | uint32_t u32MagicTail;
|
---|
| 308 | } KLDRDYLDMOD, *PKLDRDYLDMOD, **PPKLDRDYLDMOD;
|
---|
[2825] | 309 |
|
---|
[2836] | 310 | /** KLDRDYLDMOD magic value. (Fuyumi Soryo) */
|
---|
[2833] | 311 | #define KLDRDYMOD_MAGIC 0x19590106
|
---|
[2825] | 312 |
|
---|
[2833] | 313 | /** Return / crash validation of a module handle argument. */
|
---|
| 314 | #define KLDRDYLD_VALIDATE_HKLDRMOD(hMod) \
|
---|
| 315 | do { \
|
---|
| 316 | if ( (hMod) == NIL_HKLDRMOD \
|
---|
| 317 | || (hMod)->u32MagicHead != KLDRDYMOD_MAGIC \
|
---|
| 318 | || (hMod)->u32MagicTail != KLDRDYMOD_MAGIC) \
|
---|
| 319 | { \
|
---|
| 320 | return KLDR_ERR_INVALID_HANDLE; \
|
---|
| 321 | } \
|
---|
| 322 | } while (0)
|
---|
| 323 |
|
---|
| 324 |
|
---|
[2875] | 325 | int kldrInit(void);
|
---|
| 326 | void kldrTerm(void);
|
---|
| 327 |
|
---|
| 328 | int kldrDyldInit(void);
|
---|
| 329 | void kldrDyldTerm(void);
|
---|
| 330 |
|
---|
| 331 | void kldrDyldDoLoadExe(PKLDRDYLDMOD pExe);
|
---|
| 332 | int kldrDyldFailure(int rc, const char *pszFormat, ...);
|
---|
| 333 |
|
---|
| 334 | int kldrDyldOSStartExe(uintptr_t uMainEntrypoint, void *pvStack, size_t cbStack);
|
---|
| 335 | void *kldrDyldOSAllocStack(size_t cb);
|
---|
| 336 |
|
---|
| 337 | int kldrDyldFindInit(void);
|
---|
[2843] | 338 | int kldrDyldFindNewModule(const char *pszName, const char *pszPrefix, const char *pszSuffix,
|
---|
[2835] | 339 | KLDRDYLDSEARCH enmSearch, unsigned fFlags, PPKLDRDYLDMOD ppMod);
|
---|
[2843] | 340 | int kldrDyldFindExistingModule(const char *pszName, const char *pszPrefix, const char *pszSuffix,
|
---|
[2835] | 341 | KLDRDYLDSEARCH enmSearch, unsigned fFlags, PPKLDRDYLDMOD ppMod);
|
---|
| 342 |
|
---|
[2847] | 343 | int kldrDyldGetPrerequisite(const char *pszDll, const char *pszPrefix, const char *pszSuffix, KLDRDYLDSEARCH enmSearch,
|
---|
| 344 | unsigned fFlags, PKLDRDYLDMOD pDep, PPKLDRDYLDMOD ppMod);
|
---|
[2835] | 345 |
|
---|
[2847] | 346 |
|
---|
[2868] | 347 | int kldrDyldModCreate(PKLDRRDR pRdr, uint32_t fFlags, PPKLDRDYLDMOD ppMod);
|
---|
[2845] | 348 | void kldrDyldModDestroy(PKLDRDYLDMOD pMod);
|
---|
| 349 | void kldrDyldModAddRef(PKLDRDYLDMOD pMod);
|
---|
[2837] | 350 | void kldrDyldModDeref(PKLDRDYLDMOD pMod);
|
---|
[2845] | 351 | void kldrDyldModAddDep(PKLDRDYLDMOD pMod, PKLDRDYLDMOD pDep);
|
---|
[2837] | 352 | void kldrDyldModRemoveDep(PKLDRDYLDMOD pMod, PKLDRDYLDMOD pDep);
|
---|
[2835] | 353 | int kldrDyldModDynamicLoad(PKLDRDYLDMOD pMod);
|
---|
| 354 | int kldrDyldModDynamicUnload(PKLDRDYLDMOD pMod);
|
---|
[2845] | 355 | void kldrDyldModMarkGlobal(PKLDRDYLDMOD pMod);
|
---|
| 356 | void kldrDyldModMarkSpecific(PKLDRDYLDMOD pMod);
|
---|
| 357 | void kldrDyldModSetBindable(PKLDRDYLDMOD pMod, unsigned fDeep);
|
---|
| 358 | void kldrDyldModClearBindable(PKLDRDYLDMOD pMod);
|
---|
[2835] | 359 | int kldrDyldModMap(PKLDRDYLDMOD pMod);
|
---|
| 360 | int kldrDyldModUnmap(PKLDRDYLDMOD pMod);
|
---|
[2843] | 361 | int kldrDyldModLoadPrerequisites(PKLDRDYLDMOD pMod, const char *pszPrefix, const char *pszSuffix,
|
---|
[2837] | 362 | KLDRDYLDSEARCH enmSearch, unsigned fFlags);
|
---|
| 363 | int kldrDyldModCheckPrerequisites(PKLDRDYLDMOD pMod);
|
---|
| 364 | void kldrDyldModUnloadPrerequisites(PKLDRDYLDMOD pMod);
|
---|
[2835] | 365 | int kldrDyldModFixup(PKLDRDYLDMOD pMod);
|
---|
| 366 | int kldrDyldModCallInit(PKLDRDYLDMOD pMod);
|
---|
[2837] | 367 | void kldrDyldModCallTerm(PKLDRDYLDMOD pMod);
|
---|
| 368 | int kldrDyldModReload(PKLDRDYLDMOD pMod);
|
---|
[2836] | 369 | int kldrDyldModAttachThread(PKLDRDYLDMOD pMod);
|
---|
[2846] | 370 | void kldrDyldModDetachThread(PKLDRDYLDMOD pMod);
|
---|
| 371 | int kldrDyldModGetMainStack(PKLDRDYLDMOD pMod, void **ppvStack, size_t *pcbStack);
|
---|
[2835] | 372 | int kldrDyldModStartExe(PKLDRDYLDMOD pMod);
|
---|
| 373 |
|
---|
| 374 | int kldrDyldModGetName(PKLDRDYLDMOD pMod, char *pszName, size_t cchName);
|
---|
| 375 | int kldrDyldModGetFilename(PKLDRDYLDMOD pMod, char *pszFilename, size_t cchFilename);
|
---|
[2846] | 376 | int kldrDyldModQuerySymbol(PKLDRDYLDMOD pMod, uint32_t uSymbolOrdinal, const char *pszSymbolName, uintptr_t *puValue, uint32_t *pfKind);
|
---|
[2835] | 377 |
|
---|
[2869] | 378 |
|
---|
[2842] | 379 | /** Pointer to the head module (the executable).
|
---|
| 380 | * (This is exported, so no prefix.) */
|
---|
| 381 | extern PKLDRDYLDMOD kLdrDyldHead;
|
---|
| 382 | /** Pointer to the tail module.
|
---|
| 383 | * (This is exported, so no prefix.) */
|
---|
| 384 | extern PKLDRDYLDMOD kLdrDyldTail;
|
---|
[2845] | 385 | /** Pointer to the head module of the initialization list.
|
---|
| 386 | * The outermost load call will pop elements from this list in LIFO order (i.e.
|
---|
| 387 | * from the tail). The list is only used during non-recursive initialization
|
---|
| 388 | * and may therefore share the pNext/pPrev members with the termination list
|
---|
| 389 | * since we don't push a module onto the termination list untill it has been
|
---|
| 390 | * successfully initialized. */
|
---|
| 391 | extern PKLDRDYLDMOD g_pkLdrDyldInitHead;
|
---|
| 392 | /** Pointer to the tail module of the initalization list. */
|
---|
| 393 | extern PKLDRDYLDMOD g_pkLdrDyldInitTail;
|
---|
[2836] | 394 | /** Pointer to the head module of the termination order list. */
|
---|
| 395 | extern PKLDRDYLDMOD g_pkLdrDyldTermHead;
|
---|
| 396 | /** Pointer to the tail module of the termination order list. */
|
---|
| 397 | extern PKLDRDYLDMOD g_pkLdrDyldTermTail;
|
---|
| 398 | /** Pointer to the head module of the bind order list.
|
---|
| 399 | * The modules in this list makes up the global namespace used when binding symbol unix fashion. */
|
---|
| 400 | extern PKLDRDYLDMOD g_pkLdrDyldBindHead;
|
---|
| 401 | /** Pointer to the tail module of the bind order list. */
|
---|
| 402 | extern PKLDRDYLDMOD g_pkLdrDyldBindTail;
|
---|
| 403 |
|
---|
[2846] | 404 | /** Indicates that the other MainStack globals have been filled in. */
|
---|
| 405 | extern unsigned g_fkLdrDyldDoneMainStack;
|
---|
| 406 | /** Whether the stack was allocated seperatly or was part of the executable. */
|
---|
| 407 | extern unsigned g_fkLdrDyldMainStackAllocated;
|
---|
| 408 | /** Pointer to the main stack object. */
|
---|
| 409 | extern void *g_pvkLdrDyldMainStack;
|
---|
| 410 | /** The size of the main stack object. */
|
---|
| 411 | extern size_t g_cbkLdrDyldMainStack;
|
---|
| 412 |
|
---|
[2835] | 413 | /** The global error buffer. */
|
---|
| 414 | extern char g_szkLdrDyldError[1024];
|
---|
[2825] | 415 |
|
---|
[2875] | 416 | extern char kLdrDyldExePath[8192];
|
---|
| 417 | extern char kLdrDyldLibraryPath[8192];
|
---|
[2867] | 418 | extern char kLdrDyldDefPrefix[16];
|
---|
| 419 | extern char kLdrDyldDefSuffix[16];
|
---|
[2833] | 420 |
|
---|
[2875] | 421 | extern int g_fBootstrapping;
|
---|
[2836] | 422 |
|
---|
[2875] | 423 |
|
---|
[2858] | 424 | /** @name Module interpreter method tables
|
---|
| 425 | * @{ */
|
---|
| 426 | extern KLDRMODOPS g_kLdrModPEOps;
|
---|
[2879] | 427 | extern KLDRMODOPS g_kLdrModLXOps;
|
---|
[2877] | 428 | extern KLDRMODOPS g_kLdrModNativeOps;
|
---|
[2825] | 429 | /** @} */
|
---|
[2858] | 430 |
|
---|
| 431 | /** @} */
|
---|
[2825] | 432 | #ifdef __cplusplus
|
---|
| 433 | }
|
---|
| 434 | #endif
|
---|
| 435 |
|
---|
| 436 | #endif
|
---|