Changeset 697
- Timestamp:
- Sep 11, 2003, 9:08:36 PM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/src/lib/startup/startup.c
-
Property cvs2svn:cvs-rev
changed from
1.2
to1.3
r696 r697 97 97 } 98 98 } 99 100 101 102 /** @page Startup 103 * 104 * Quick description of how we startup a process which modules uses LIBC. 105 * 106 * The load first loads the DLLs of the process, calling their _DLL_InitTerm 107 * entrypoints in order of dependencies. If you're using dynamic LIBC this 108 * will be initiated first of the LIBC-based modules. 109 * 110 * LIBCxy.DLL: 111 * - dll0.s gets control and calls __init_dll in sys/__initdll.c 112 * - __init_dll calls __init_os_version() to set _osminor,_osmajor globals. 113 * - __init_dll creates _sys_heap_fmutex. 114 * - __init_dll initiates _sys_pid and _sys_ppid globals. 115 * - __init_dll allocates and initiatlized the _sys_private_heap heap, which is 116 * operated by DosSubSetMem() and it's friends. 117 * - __init_dll then initializes _sys_thread_table and calls __newthread() in 118 * sys/__newthread.c to create the thread 1 entry. 119 * - __init_dll then intializes _sys_clock0_ms with the current MS count. 120 * - dll0.s calls _DLL_InitTerm in startup/dllinit.c. 121 * - _DLL_InitTerm calls _CRT_init() in startup/startup.c to initialize the CRT. 122 * - _CRT_init calls init_files() to initialize the file handle tables. 123 * - _CRT_init then call all the crt init functions in __crtinit1__. 124 * - _DLL_InitTerm calls __ctordtorInit() to initate any exception structures and 125 * construct static C++ objects. 126 * - dll0.s then returns to DOSCALL1.DLL and back to the kernel. 127 * 128 * Your.DLL: 129 * - dll0.s gets control and calls __init_dll() in sys/__initdll.c 130 * - __init_dll returns at once since already done during LIBCxy.DLL init. 131 * - dll0.s calls _DLL_InitTerm in startup/dllinit.c. 132 * - _DLL_InitTerm calls _CRT_init() in startup/startup.c to initialize the CRT. 133 * - _CRT_init return at once since already done during LIBCxy.DLL init. 134 * - _DLL_InitTerm calls __ctordtorInit() to initate any exception structures and 135 * construct static C++ objects in _this_ DLL. 136 * - dll0.s then returns to DOSCALL1.DLL and back to the kernel. 137 * 138 * Your.exe: 139 * - crt0.s gets control and calls ___init_app in sys/386/appinit.s which forwards 140 * the call to __init() in sys/__init.c. 141 * - __init() calls __init_dll() which returns at once because of LIBCxy.DLL init. 142 * - __init() parse the environment and commandline to figure out how much stack 143 * to use for their arrays and the argument copy. 144 * - __init() the allocates the stack space space, adding an exception handler struct. 145 * - __init() parse the environment and create the array using allocated stack space. 146 * - __init() parse the commandline creating both array and a copy using allocated 147 * stack space. 148 * - __init() installs the exception handler. 149 * - __init() set the signal focus. 150 * - __init() then 'returns' thru the hack called ___init_ret in sys/386/appinit.s 151 * - crt0.s now get control back with esp pointing to the array of env vars. 152 * - crt0.s sets environ and _org_environ. 153 * - crt0.s sets up the call frame for main() by skipping it's way thru the env and 154 * arg arrays. 155 * - crt0.s calls _CRT_init() in startup/startup.c to initialize the CRT which returns 156 * immediately since since already done during LIBCxy.DLL init. 157 * - crt0.s the calls main() with the three arguments setup earlier. 158 * - crt0.s then calls exit() with the return value of main(). 159 * - exit() will call all the registered at_exit functions. 160 * - exit() will call DosExit with the exit code and terminate the process. 161 */ -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.