Ignore:
Timestamp:
Oct 29, 2006, 2:32:25 AM (19 years ago)
Author:
bird
Message:

think I got the state stuff right now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kLdr/kLdrInternal.h

    r2837 r2840  
    6565/**
    6666 * The state of a dynamic loader module.
     67 * @image html KLDRSTATE.gif "The state diagram"
    6768 */
    6869typedef enum KLDRSTATE
     
    7071    /** The usual invalid 0 enum. */
    7172    KLDRSTATE_INVALID = 0,
    72     /** The module has just been opened and has no references.
     73
     74    /** The module has just been opened and linked into the load list.
     75     *
    7376     * Prev state: -
    74      * Next state: MAPPED, DESTROYED
     77     * Next state: MAPPED, PENDING_DESTROY
    7578     */
    7679    KLDRSTATE_OPEN,
    77     /** The module been mapped.
     80
     81    /** The module segments has been mapped into the process memory.
     82     *
    7883     * Prev state: OPEN
    79      * Next state: LOADED_PREREQUISITES, DESTROYED
     84     * Next state: LOADED_PREREQUISITES, PENDING_DESTROY
    8085     */
    8186    KLDRSTATE_MAPPED,
    8287    /** The module has been reloaded and needs to be fixed up again.
    83      * (The loader can still be in a re-entrant mode.)
     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     *
    8495     * Prev state: PENDING_GC
    85      * Next state: LOADED_PREREQUISITES, PENDING_GC
     96     * Next state: RELOADED_LOADED_PREREQUISITES, PENDING_GC
    8697     */
    8798    KLDRSTATE_RELOADED,
     99
    88100    /** The immediate prerequisites have been loaded.
    89      * Prev state: MAPPED, RELOADED
    90      * Next state: FIXED_UP, DESTROYED
     101     *
     102     * Prev state: MAPPED
     103     * Next state: FIXED_UP, PENDING_DESTROY
    91104     */
    92105    KLDRSTATE_LOADED_PREREQUISITES,
     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
    93113    /** Fixups has been applied.
     114     *
    94115     * Prev state: LOADED_PREREQUISITES
    95      * Next state: PENDING_INIT, DESTROYED
     116     * Next state: PENDING_INITIALIZATION, PENDING_DESTROY
    96117     */
    97118    KLDRSTATE_FIXED_UP,
     119    /** Fixups has been applied.
     120     *
     121     * Prev state: RELOADED_LOADED_PREREQUISITES
     122     * Next state: PENDING_INITIALIZATION, PENDING_GC
     123     */
     124    KLDRSTATE_RELOADED_FIXED_UP,
     125
    98126    /** Pending initialization.
    99      * (The loader can now be in a re-entrant mode.)
    100      * Prev state: FIXED_UP
    101      * Next state: PENDING_INITIALIZATION, PENDING_GC
     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
    102131     */
    103132    KLDRSTATE_PENDING_INITIALIZATION,
     133
    104134    /** Initializing.
    105      * (The loader is now in a re-entrant mode.)
     135     * While the module is in this state the loader is in reentrant mode.
     136     *
    106137     * Prev state: PENDING_INITIALIZATION
    107138     * Next state: GOOD, PENDING_GC
    108139     */
    109140    KLDRSTATE_INITIALIZING,
     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
    110155    /** The module has been successfully loaded and initialized.
    111      * (The loader can still be in a re-entrant mode.)
     156     * While the module is in this state the loader can be in reentrant
     157     * or 'unused' mode.
     158     *
    112159     * Prev state: INITIALIZING
    113160     * Next state: PENDING_TERMINATION
    114      * Re-entrant.
    115161     */
    116162    KLDRSTATE_GOOD,
     163
    117164    /** Pending termination, reference count is 0.
    118      * (The loader can now be in a re-entrant mode.)
     165     * While the module is in this state the loader is in reentrant mode.
     166     *
    119167     * Prev state: GOOD
    120168     * Next state: TERMINATING, GOOD
    121169     */
    122170    KLDRSTATE_PENDING_TERMINATION,
     171
    123172    /** Terminating, reference count is still 0.
    124      * (The loader is now in a re-entrant mode, but loading is a bit restricted.)
     173     * While the module is in this state the loader is in reentrant mode.
     174     *
    125175     * Prev state: PENDING_TERMINATION
    126176     * Next state: PENDING_GC
    127177     */
    128178    KLDRSTATE_TERMINATING,
     179
    129180    /** Pending garbage collection.
    130      * (The loader can still be in a re-entrant mode.)
    131      * Prev state: TERMINATING, INITIALIZING, PENDING_INITIALIZATION
     181     *
     182     * Prev state: TERMINATING, PENDING_INITIALIZATION, INITIALIZATION_FAILED
    132183     * Next state: GC, RELOADED
    133184     */
    134185    KLDRSTATE_PENDING_GC,
     186
    135187    /** Being garbage collected.
    136      * Prev state: PENDING_GC
     188     *
     189     * Prev state: PENDING_GC, INITIALIZATION_FAILED
    137190     * Next state: PENDING_DESTROY, DESTROYED
    138191     */
    139192    KLDRSTATE_GC,
     193
    140194    /** The module has be unlinked, but there are still stack references to it.
    141      * Prev state: GC
     195     *
     196     * Prev state: GC, FIXED_UP, LOADED_PREREQUISITES, MAPPED, OPEN
    142197     * Next state: DESTROYED
    143198     */
    144199    KLDRSTATE_PENDING_DESTROY,
     200
    145201    /** The module has been destroyed and is no longer valid.
     202     *
    146203     * Prev state: GC, PENDING_DESTROY
    147204     */
    148205    KLDRSTATE_DESTROYED,
     206
    149207    /** The end of valid states (exclusive) */
    150208    KLDRSTATE_END = KLDRSTATE_DESTROYED,
     
    194252        struct KLDRDYLDMOD *pPrev;
    195253    } Load;
    196     /** The termination list linkage. */
     254    /** The termination list linkage.
     255     * A module will be linked into the termination list upon a successful
     256     * return from module initialization. */
    197257    struct
    198258    {
Note: See TracChangeset for help on using the changeset viewer.