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