Ignore:
Timestamp:
Oct 26, 2006, 5:58:53 AM (19 years ago)
Author:
bird
Message:

more prototyping. (And avoid 64-bit div/rem)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kLdr/kLdrInternal.h

    r2835 r2836  
    7070    /** The usual invalid 0 enum. */
    7171    KLDRSTATE_INVALID = 0,
    72     /** kldrOpen succeeded.
    73      * Modules in this state will be freed at  */
     72    /** The module has just been opened and has no references.
     73     * Prev state: -
     74     * Next state: MAPPED, DESTROYED
     75     */
    7476    KLDRSTATE_OPEN,
    75     /** Dependencies has been loaded. */
    76     KLDRSTATE_DEPS,
    77     /** Fixups has been applied. */
    78     KLDRSTATE_FIXED,
    79     /** The module has been initialized. */
    80     KLDRSTATE_INITED,
    81     /** The module is loaded successfully. */
    82     KLDRSTATE_LOADED,
     77    /** The module been mapped.
     78     * Prev state: OPEN
     79     * Next state: LOADED_DEPS, DESTROYED
     80     */
     81    KLDRSTATE_MAPPED,
     82    /** The immediate dependencies has been loaded.
     83     * Prev state: MAPPED
     84     * Next state: FIXED_UP, DESTROYED
     85     */
     86    KLDRSTATE_LOADED_DEPS,
     87    /** Fixups has been applied.
     88     * Prev state: LOADED_DEPS
     89     * Next state: PENDING_INIT, DESTROYED
     90     */
     91    KLDRSTATE_FIXED_UP,
     92    /** Pending initialization.
     93     * (The loader can now be in a re-entrant mode.)
     94     * Prev state: FIXED_UP
     95     * Next state: PENDING_INITIALIZATION, PENDING_GC
     96     */
     97    KLDRSTATE_PENDING_INITIALIZATION,
     98    /** Initializing.
     99     * (The loader is now in a re-entrant mode.)
     100     * Prev state: PENDING_INITIALIZATION
     101     * Next state: GOOD, PENDING_GC
     102     */
     103    KLDRSTATE_INITIALIZING,
     104    /** The module has been successfully loaded and initialized.
     105     * (The loader can still be in a re-entrant mode.)
     106     * Prev state: INITIALIZING
     107     * Next state: PENDING_TERMINATION
     108     * Re-entrant.
     109     */
     110    KLDRSTATE_GOOD,
     111    /** Pending termination, reference count is 0.
     112     * (The loader can now be in a re-entrant mode.)
     113     * Prev state: GOOD
     114     * Next state: TERMINATING, GOOD
     115     */
     116    KLDRSTATE_PENDING_TERMINATION,
     117    /** Terminating, reference count is still 0.
     118     * (The loader is now in a re-entrant mode, but loading is a bit restricted.)
     119     * Prev state: PENDING_TERMINATION
     120     * Next state: PENDING_GC
     121     */
     122    KLDRSTATE_TERMINATING,
     123    /** Pending garbage collection.
     124     * (The loader can still be in a re-entrant mode.)
     125     * Prev state: TERMINATING, INITIALIZING, PENDING_INITIALIZATION
     126     * Next state: GC, RELOADING
     127     */
     128    KLDRSTATE_PENDING_GC,
     129    /** Being garbage collected.
     130     * (The loader can still be in a re-entrant mode.)
     131     * Prev state: PENDING_GC
     132     * Next state: DESTROYED
     133     */
     134    KLDRSTATE_GC,
     135    /** The module is being reloaded after having been scheduled for termination or/and GC.
     136     * (The loader can still be in a re-entrant mode.)
     137     * Prev state: PENDING_GC
     138     * Next state: PENDING_INITIALIZATION
     139     */
     140    KLDRSTATE_RELOADING,
     141    /** The module has been destroyed and is no longer valid.
     142     * Prev state: GC
     143     */
     144    KLDRSTATE_DESTROYED,
    83145    /** The end of valid states (exclusive) */
    84     KLDRSTATE_END,
     146    KLDRSTATE_END = KLDRSTATE_DESTROYED,
    85147    /** The usual 32-bit blowup. */
    86148    KLDRSTATE_32BIT_HACK = 0x7fffffff
     
    99161    /** The module. */
    100162    PKLDRMOD            pMod;
     163    /** The module handle. */
     164    HKLDRMOD            hMod;
    101165    /** The number of references. */
    102166    uint32_t            cRefs;
    103167    /** The number of dynamic references. */
    104168    uint32_t            cDynRefs;
    105     /** Set if this is the executable module. */
     169    /** The number of dynamic load operations in progress.
     170     * This is used to reject anyone trying to unload a module before the load has
     171     * been completed. An alternative to this would be to not add the cDynRefs until
     172     * the load operation has completed... */
     173    uint32_t            cDynRefsInProgress;
     174    /** Set if this is the executable module.
     175     * When clear, the module is a shared object or relocatable object. */
    106176    uint32_t            fExecutable : 1;
    107177    /** Global DLL (set) or specific DLL (clear). */
    108     uint32_t            fGlobal : 1;
    109     /** Load stage one. */
    110     uint32_t            fLoadStageOne : 1;
     178    uint32_t            fGlobalOrSpecific : 1;
     179    /** Whether the module contains bindable symbols in the global unix namespace. */
     180    uint32_t            fBindable : 1;
    111181    /** Reserved for future use. */
    112182    uint32_t            fReserved : 29;
    113     /** The next module in the list. */
    114     struct KLDRDYMOD   *pNext;
    115     /** The prev module in the list. */
    116     struct KLDRDYMOD   *pPrev;
     183    /** The load list linkage. */
     184    struct
     185    {
     186        /** The next module in the list. */
     187        struct KLDRDYLDMOD *pNext;
     188        /** The prev module in the list. */
     189        struct KLDRDYLDMOD *pPrev;
     190    } Load;
     191    /** The termination list linkage. */
     192    struct
     193    {
     194        /** The next module in the list. */
     195        struct KLDRDYLDMOD *pNext;
     196        /** The prev module in the list. */
     197        struct KLDRDYLDMOD *pPrev;
     198    } Term;
     199    /** The bind order list linkage.
     200     * The module is not in this list when fBindable is clear. */
     201    struct
     202    {
     203        /** The next module in the list. */
     204        struct KLDRDYLDMOD *pNext;
     205        /** The prev module in the list. */
     206        struct KLDRDYLDMOD *pPrev;
     207    } Bind;
    117208    /** Magic number. */
    118209    uint32_t            u32MagicTail;
    119210} KLDRDYLDMOD, *PKLDRDYLDMOD, **PPKLDRDYLDMOD;
    120211
    121 /** KLDRDYMOD magic value. (Fuyumi Soryo) */
     212/** KLDRDYLDMOD magic value. (Fuyumi Soryo) */
    122213#define KLDRDYMOD_MAGIC     0x19590106
    123214
     
    134225
    135226
    136 int kldrDyldFindNewModule(const char *pszName, const char *pszPrefix, const char *pszSuffix,
     227int kldrDyldFindNewModule(const char *pszName, const char *pszDefPrefix, const char *pszDefSuffix,
    137228                          KLDRDYLDSEARCH enmSearch, unsigned fFlags, PPKLDRDYLDMOD ppMod);
    138 int kldrDyldFindExistingModule(const char *pszName, const char *pszPrefix, const char *pszSuffix,
     229int kldrDyldFindExistingModule(const char *pszName, const char *pszDefPrefix, const char *pszDefSuffix,
    139230                               KLDRDYLDSEARCH enmSearch, unsigned fFlags, PPKLDRDYLDMOD ppMod);
    140231
     
    158249int kldrDyldModCallInit(PKLDRDYLDMOD pMod);
    159250int kldrDyldModCallTerm(PKLDRDYLDMOD pMod);
     251int kldrDyldModAttachThread(PKLDRDYLDMOD pMod);
     252int kldrDyldModDetachThread(PKLDRDYLDMOD pMod);
    160253int kldrDyldModGetStackInfo(PKLDRDYLDMOD pMod, void *pvStack, size_t *pcbStack, size_t);
    161254int kldrDyldModStartExe(PKLDRDYLDMOD pMod);
     
    169262
    170263
    171 /** Pointer to the head module (the executable). */
     264/** Pointer to the head module of the load list (the executable). */
    172265extern PKLDRDYLDMOD     kLdrDyldModuleHead;
    173 /** Pointer to the tail module. */
     266/** Pointer to the tail module of the load list. */
    174267extern PKLDRDYLDMOD     kLdrDyldModuleTail;
     268/** Pointer to the head module of the termination order list. */
     269extern PKLDRDYLDMOD     g_pkLdrDyldTermHead;
     270/** Pointer to the tail module of the termination order list. */
     271extern PKLDRDYLDMOD     g_pkLdrDyldTermTail;
     272/** Pointer to the head module of the bind order list.
     273 * The modules in this list makes up the global namespace used when binding symbol unix fashion. */
     274extern PKLDRDYLDMOD     g_pkLdrDyldBindHead;
     275/** Pointer to the tail module of the bind order list. */
     276extern PKLDRDYLDMOD     g_pkLdrDyldBindTail;
     277
     278/** The global error buffer. */
     279extern char             g_szkLdrDyldError[1024];
     280
    175281/** The Library search path. */
    176282extern char             kLdrDyldLibraryPath[4096];
    177 /** The global error buffer. */
    178 extern char             g_szkLdrDyldError[1024];
    179283
    180284
Note: See TracChangeset for help on using the changeset viewer.