- Timestamp:
- Jun 29, 2014, 9:22:44 PM (11 years ago)
- Location:
- trunk/libc
- Files:
-
- 2 added
- 3 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/libc/Makefile.kmk
r3845 r3895 327 327 startupobjs_SOURCES := 328 328 ifeq ($(BUILD_TARGET),os2) 329 330 ifdef CFG_LIBC_USE_WATCOM 331 define def_startup 332 $(PATH_TARGET)/crt0$(i).obj: src/libc/startup/os2/x86/crt0.asm | $(call DIRDEP,$(PATH_TARGET)) 333 $(RM) -f $$@ 334 $$(TOOL_$$(TEMPLATE_libcasm_ASTOOL)_AS) $(TEMPLATE_libcasm_ASFLAGS) -Iinclude/ \ 335 $(addprefix -D,$(DEFS) $(ASDEFS) $(DEFS.$(KBUILD_TARGET)) $(ASDEFS.$(KBUILD_TARGET)) ) \ 336 $(subst wild, -DARGS_WILD, \ 337 $(subst resp, -DARGS_RESP, \ 338 $(subst noux, -DNOUNIX, \ 339 $(subst nofork, -DNOFORK, \ 340 $(subst hi, -DHIGHMEM, $i) )))) \ 341 -o $$@ \ 342 $$< 343 $$(eval startupobjs_SOURCES += $(PATH_TARGET)/crt0$(i).obj) 344 345 ifeq ($(subst resp,,$(subst wild,,$(i))),$(i)) 346 $(PATH_TARGET)/dll0$(i).obj: src/libc/startup/os2/x86/dll0.asm | $(call DIRDEP,$(PATH_TARGET)) 347 $(RM) -f $$@ 348 $$(TOOL_$$(TEMPLATE_libcasm_ASTOOL)_AS) $(TEMPLATE_libcasm_ASFLAGS) -Iinclude/ \ 349 $(addprefix -D,$(DEFS) $(ASDEFS) $(DEFS.$(KBUILD_TARGET)) $(ASDEFS.$(KBUILD_TARGET)) ) \ 350 $(subst wild, -DARGS_WILD, \ 351 $(subst resp, -DARGS_RESP, \ 352 $(subst noux, -DNOUNIX, \ 353 $(subst nofork, -DNOFORK, \ 354 $(subst hi, -DHIGHMEM, $i) )))) \ 355 -o $$@ \ 356 $$< 357 $$(eval startupobjs_SOURCES += $(PATH_TARGET)/dll0$(i).obj) 358 endif 359 endef # def_startup 360 361 else # !CFG_LIBC_USE_WATCOM 329 362 define def_startup 330 363 $(PATH_TARGET)/crt0$(i).o: src/libc/startup/os2/x86/crt0.s | $(call DIRDEP,$(PATH_TARGET)) 331 364 $(RM) -f $$@ $$@bj 332 echo "i=$i"333 365 gcc -c -Iinclude -x assembler-with-cpp \ 334 366 $(subst wild, -DARGS_WILD, \ … … 364 396 endif 365 397 endif 366 endef 398 endef # def_startup 399 endif # !CFG_LIBC_USE_WATCOM 367 400 368 401 # generate … … 418 451 419 452 # binmode 453 ifdef CFG_LIBC_USE_WATCOM 454 $(PATH_TARGET)/binmode.obj: src/libc/io/386/binmode.asm 455 $(RM) -f $@ 456 $(TOOL_$(TEMPLATE_libcasm_ASTOOL)_AS) $(TEMPLATE_libcasm_ASFLAGS) -Iinclude/ \ 457 $(addprefix -D,$(DEFS) $(ASDEFS) $(DEFS.$(KBUILD_TARGET)) $(ASDEFS.$(KBUILD_TARGET)) ) \ 458 -o $@ $< 459 startupobjs_SOURCES += $(PATH_TARGET)/binmode.obj 460 else 420 461 $(PATH_TARGET)/binmode.o: src/libc/io/386/binmode.s 421 462 gcc -c -o $@ $< 422 463 startupobjs_SOURCES += $(PATH_TARGET)/binmode.o 423 ifdef ($(BUILD_TARGET),os2)464 ifdef ($(BUILD_TARGET),os2) 424 465 $(PATH_TARGET)/binmode.obj: $(PATH_TARGET)/binmode.o 425 466 emxomf -o $@ $< 426 467 startupobjs_SOURCES += $(PATH_TARGET)/binmode.obj 468 endif 427 469 endif 428 470 -
trunk/libc/include/klibc/initterm.h
r3857 r3895 62 62 63 63 /** @name Flags for __libc_InitDll, __libc_InitExe, __libc_TermDll and __libc_TermExe. 64 * @remarks also defined in initterm.mac. 64 65 * @{ */ 65 66 #define __LIBC_INIT_FLAGS_MEM_HIGH 1 -
trunk/libc/include/klibc/os2/asmdefs.mac
r3883 r3895 20 20 ; Segment definitions. 21 21 ; 22 23 ;; Defines the set-vector %1 (for crt0/dll0). 24 %macro KLIBC_OS2_SET_VECTOR_DEFINE 1 25 segment SET1_ %+ %1 26 GLOBAL_DATA %1 27 NAME_DATA(%1): 28 dd 0xfffffffe ; terminates the array 29 segment SET2_ %+ %1 30 %1 %+_Dummy2: 31 segment SET3_ %+ %1 32 %1 %+_Dummy3: 33 dd 0 ; terminates the array 34 %endmacro 35 ;; Lists the segment names for set-vector %1. 36 %define KLIBC_OS2_SET_VECTOR_NAMES(a_Name) SET1_ %+ a_Name SET2_ %+ a_Name SET3_ %+ a_Name 37 38 22 39 %if KLIBC_OBJFMT = KLIBC_OBJFMT_AOUT 40 %macro KLIBC_OS2_SET_VECTOR_DECLARE 1 41 %error "Dunno how to do set-vectors in AOUT/NASM." 42 %endmacro 43 %macro KLIBC_OS2_SET_VECTOR_ADD 2 44 %error "Dunno how to do set-vectors in AOUT/NASM." 45 %endmacro 46 23 47 %define SEG_BEGIN_CODE section .text 24 48 %define SEG_BEGIN_DATA section .data … … 26 50 %define SEG_BEGIN_BSS section .bss 27 51 52 28 53 %elif KLIBC_OBJFMT = KLIBC_OBJFMT_OMF 54 %macro KLIBC_OS2_SET_VECTOR_DECLARE 1 55 segment SET1_ %+ %1 use32 align=4 public class=DATA 56 segment SET2_ %+ %1 use32 align=4 public class=DATA 57 segment SET3_ %+ %1 use32 align=4 public class=DATA 58 %endmacro 59 29 60 %define SEG_BEGIN_CODE segment CODE32 30 61 %define SEG_BEGIN_DATA segment DATA32 … … 34 65 segment CODE32 use32 flat align=16 public class=CODE 35 66 segment DATA32 use32 align=16 public class=DATA 36 37 segment SET1___fork_child1__ use32 align=4 public class=DATA 38 segment SET2___fork_child1__ use32 align=4 public class=DATA 39 segment SET3___fork_child1__ use32 align=4 public class=DATA 40 41 segment SET1___fork_parent1__ use32 align=4 public class=DATA 42 segment SET2___fork_parent1__ use32 align=4 public class=DATA 43 segment SET3___fork_parent1__ use32 align=4 public class=DATA 44 45 segment SET1___crtinit1__ use32 align=4 public class=DATA 46 segment SET2___crtinit1__ use32 align=4 public class=DATA 47 segment SET3___crtinit1__ use32 align=4 public class=DATA 48 49 segment SET1___crtexit1__ use32 align=4 public class=DATA 50 segment SET2___crtexit1__ use32 align=4 public class=DATA 51 segment SET3___crtexit1__ use32 align=4 public class=DATA 52 67 KLIBC_OS2_SET_VECTOR_DECLARE _os2dll 68 KLIBC_OS2_SET_VECTOR_DECLARE __CTOR_LIST__ 69 KLIBC_OS2_SET_VECTOR_DECLARE __DTOR_LIST__ 70 KLIBC_OS2_SET_VECTOR_DECLARE __crtinit1__ 71 KLIBC_OS2_SET_VECTOR_DECLARE __crtexit1__ 72 KLIBC_OS2_SET_VECTOR_DECLARE __libc_sysctl__ 73 KLIBC_OS2_SET_VECTOR_DECLARE __fork_child1__ 74 KLIBC_OS2_SET_VECTOR_DECLARE __fork_parent1__ 75 KLIBC_OS2_SET_VECTOR_DECLARE __eh_frame__ 76 KLIBC_OS2_SET_VECTOR_DECLARE __eh_init__ 77 KLIBC_OS2_SET_VECTOR_DECLARE __eh_term__ 53 78 segment BSS32 use32 align=16 public class=BSS 54 group DGROUP DATA32 BSS32 \ 55 SET1___fork_parent1__ SET2___fork_parent1__ SET3___fork_parent1__ \ 56 SET1___fork_child1__ SET2___fork_child1__ SET3___fork_child1__ \ 57 SET1___crtinit1__ SET2___crtinit1__ SET3___crtinit1__ \ 58 SET1___crtexit1__ SET2___crtexit1__ SET3___crtexit1__ 79 group DGROUP DATA32 \ 80 KLIBC_OS2_SET_VECTOR_NAMES(_os2dll) \ 81 KLIBC_OS2_SET_VECTOR_NAMES(__CTOR_LIST__) \ 82 KLIBC_OS2_SET_VECTOR_NAMES(__DTOR_LIST__) \ 83 KLIBC_OS2_SET_VECTOR_NAMES(__crtinit1__) \ 84 KLIBC_OS2_SET_VECTOR_NAMES(__crtexit1__) \ 85 KLIBC_OS2_SET_VECTOR_NAMES(__libc_sysctl__) \ 86 KLIBC_OS2_SET_VECTOR_NAMES(__fork_child1__) \ 87 KLIBC_OS2_SET_VECTOR_NAMES(__fork_parent1__) \ 88 KLIBC_OS2_SET_VECTOR_NAMES(__eh_frame__) \ 89 KLIBC_OS2_SET_VECTOR_NAMES(__eh_init__) \ 90 KLIBC_OS2_SET_VECTOR_NAMES(__eh_term__) \ 91 BSS32 59 92 60 93 segment CODE16 use16 align=16 public class=CODE 61 94 62 %elif KLIBC_OBJFMT = KLIBC_OBJFMT_ELF32 || KLIBC_OBJFMT = KLIBC_OBJFMT_COFF32 ; latter is just for testing! 95 96 %elif KLIBC_OBJFMT = KLIBC_OBJFMT_ELF32 97 %macro KLIBC_OS2_SET_VECTOR_DECLARE 1 98 segment SET1_ %+ %1 use32 align=4 public class=DATA 99 segment SET2_ %+ %1 use32 align=4 public class=DATA 100 segment SET3_ %+ %1 use32 align=4 public class=DATA 101 %endmacro 102 63 103 %define SEG_BEGIN_CODE section .text 64 104 %define SEG_BEGIN_DATA section .data … … 66 106 %define SEG_BEGIN_BSS section .bss 67 107 108 KLIBC_OS2_SET_VECTOR_DECLARE _os2dll 109 KLIBC_OS2_SET_VECTOR_DECLARE __CTOR_LIST__ 110 KLIBC_OS2_SET_VECTOR_DECLARE __DTOR_LIST__ 111 KLIBC_OS2_SET_VECTOR_DECLARE __crtinit1__ 112 KLIBC_OS2_SET_VECTOR_DECLARE __crtexit1__ 113 KLIBC_OS2_SET_VECTOR_DECLARE __libc_sysctl__ 114 KLIBC_OS2_SET_VECTOR_DECLARE __fork_child1__ 115 KLIBC_OS2_SET_VECTOR_DECLARE __fork_parent1__ 116 KLIBC_OS2_SET_VECTOR_DECLARE __eh_frame__ 117 KLIBC_OS2_SET_VECTOR_DECLARE __eh_init__ 118 KLIBC_OS2_SET_VECTOR_DECLARE __eh_term__ 119 68 120 %else 69 121 %fatal Object format __OUTPUT_FORMAT__ is not supported by kLibC on OS/2. 122 %endif 123 124 %ifndef KLIBC_OS2_SET_VECTOR_ADD 125 ;; Adds the address of %2 to the set-vector %1. 126 %macro KLIBC_OS2_SET_VECTOR_ADD 2 127 segment SET2_ %+ %1 128 dd %2 129 SEG_BEGIN_CODE 130 %endmacro 70 131 %endif 71 132 -
trunk/libc/src/libc/startup/os2/x86/crt0.asm
r3893 r3895 1 /* $Id$ */ 2 /**@file3 * 4 * OS/2 crt0. 5 * 6 * Copyright (c) 2006 knut st. osmundsen <bird@innotek.de> 7 * 8 * 9 * This file is part of kLIBC. 10 11 * kLIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 * (at your option) any later version. 15 * 16 * kLIBC 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 Lesser General Public License for more details. 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * along with kLIBC; 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 #include <klibc/initterm.h> 29 30 31 32 /** 33 * The OS/2 executable entry point.34 * 35 * EAX = EBX = ECX = EDX = ESI = EDI = EBP = GS = 0.36 * CS = flat codeselector.37 * DS = ES = SS = flat data selector. 38 * FS = TIB selector. 39 * EFLAGS=undefined 40 * 41 * @returns exit code to pass to DosExit(1, rc); 42 * @param hmod [ebp + 8h] The executable module handle.43 * @param Reserved [ebp + 0ch] Reserved (probably 0).44 * @param pszzEnv [ebp + 10h] Pointer to the environment data object. 45 * @param pszzCmdline [ebp + 14h] Pointer to the commandline. 46 * 47 */ 48 .text 49 .global __text 50 __text: 51 /*52 * Clear DF, create a stack frame, register the exception handler,53 * and allocate the main argument frame.54 */55 cld 56 push %ebp57 mov %esp, %ebp58 59 pushl $__libc_Back_exceptionHandler 60 pushl %fs:0 /* tib_pexchain */61 mov %esp, %fs:062 63 andl $0xfffffff0, %esp /* make sure it's properly aligned. */ 64 subl $0x10, %esp 65 66 67 #if !defined(NOFORK) && !defined(NOUNIX) 68 /*69 * Update g_ForkModule.hmod and call __libc_ForkRegisterModule(&g_ForkModule) to70 * register the fork module. If we're forking, this call will never return.71 */72 movl 8(%ebp), %eax 73 movl %eax, g_ForkModule_hmod74 75 movl $g_ForkModule, (%esp)76 call ___libc_ForkRegisterModule 77 #endif 78 79 /*80 * Call __libc_InitExe(hmod, &hmod, fFlags, &MainArgs) to initialized81 * the CRT and get the arguments for main().82 */83 movl %esp, %ecx84 pushl %ecx /* pMainFrame */ 85 #if defined(HIGHMEM) 86 # define F1 __LIBC_INIT_FLAGS_MEM_HIGH 87 #else 88 # define F1 0 89 #endif 90 #if defined(NOUNIX) 91 # define F2 __LIBC_INIT_FLAGS_NO_UNIX 92 #else 93 # define F2 0 94 #endif 95 #if defined(ARGS_RESP) 96 # define F3 __LIBC_INIT_FLAGS_EXPAND_RESPONSE_FILE 97 #else 98 # define F3 0 99 #endif 100 #if defined(ARGS_WILD) 101 # define F4 __LIBC_INIT_FLAGS_EXPAND_WILDCARDS 102 #else 103 # define F4 0 104 #endif 105 pushl $(F1+F2+F3+F4)106 lea 8(%ebp), %edx107 pushl %edx /* pvOS */108 movl 8(%ebp), %eax109 pushl %eax /* hmod */110 call ___libc_InitExe111 addl $0x10, %esp 112 113 /*114 * We can call main(). Should main return, invoke exit with the return code.115 *116 * Should some bright guy override exit() and make it return, we'll loop117 * eating 4 bytes of stack for each call to exit(). Eventually we'll crash118 * when we run out of stack.119 */120 call _main 121 122 do_exit:123 pushl %eax124 call _exit125 jmpdo_exit126 127 128 129 /** 130 * __data_start (and __data) marks the start of the data segment. 131 * 132 * By convention required by emxbind, the datasegment starts with 133 * a magic number followed by a pointer to the list of OS/2 DLL 134 * references. When linking OMF this is not used by anyone. 135 */ 136 .data 137 .global ___data_start 138 .global __data 139 ___data_start:140 __data: 141 .long 0x00ba0bab /* Magic number (error detection). */142 .long __os2dll /* List of OS/2 DLL references. */ 143 144 #if !defined(NOFORK) && !defined(NOUNIX) 145 /** 146 *The fork module structure.147 */ 1 ; $Id$ 2 ;; @file 3 ; kNIX - Pre-main() startup code, OS/2. 4 ; 5 ; @copyright Copyright (C) 2006-2014 knut st. osmundsen <bird-klibc-spam-xiv@anduin.net> 6 ; @licenses MIT, BSD2, BSD3, BSD4, LGPLv2.1, LGPLv3, LGPLvFuture. 7 ; 8 9 10 ;******************************************************************************* 11 ;* Header Files * 12 ;******************************************************************************* 13 %include "klibc/asmdefs.mac" 14 %include "klibc/initterm.mac" 15 16 17 SEG_BEGIN_CODE 18 19 extern NAME_FUNC(main) 20 extern NAME_FUNC(exit) 21 extern NAME_FUNC(__libc_ForkRegisterModule) 22 extern NAME_FUNC(__libc_InitExe) 23 extern NAME_FUNC(_atfork_callback) 24 extern __libc_Back_exceptionHandler ; _System 25 ; Add a symbol table entry which drags _end in libend into OMF links. 26 extern __end 27 extern _end 28 29 30 ;; 31 ; The OS/2 executable entry point. 32 ; 33 ; EAX = EBX = ECX = EDX = ESI = EDI = EBP = GS = 0. 34 ; CS = flat code selector. 35 ; DS = ES = SS = flat data selector. 36 ; FS = TIB selector. 37 ; EFLAGS=undefined 38 ; 39 ; @returns exit code to pass to DosExit(1, rc); 40 ; @param hmod [ebp + 8h] The executable module handle. 41 ; @param Reserved [ebp + 0ch] Reserved (probably 0). 42 ; @param pszzEnv [ebp + 10h] Pointer to the environment data object. 43 ; @param pszzCmdline [ebp + 14h] Pointer to the commandline. 44 ; 45 GLOBAL_FUNC _text 46 NAME_FUNC(_text): 47 ..start: 48 ; 49 ; Clear DF, create a stack frame, register the exception handler, 50 ; and allocate the main argument frame. 51 ; 52 cld 53 push ebp 54 mov ebp, esp 55 56 push __libc_Back_exceptionHandler 57 push dword [fs:0] ; tib_pexchain 58 mov dword [fs:0], esp 59 60 and esp, 0xfffffff0 ; make sure it's properly aligned. 61 sub esp, 10h 62 63 64 %ifndef NOFORK 65 %ifndef NOUNIX 66 ; 67 ; Update g_ForkModule.hmod and call __libc_ForkRegisterModule(&g_ForkModule) to 68 ; register the fork module. If we're forking, this call will never return. 69 ; 70 mov eax, [ebp + 8] ; hmod 71 mov [g_ForkModule_hmod], eax 72 73 mov dword [esp], g_ForkModule 74 call NAME_FUNC(__libc_ForkRegisterModule) 75 %endif 76 %endif 77 78 ; 79 ; Call __libc_InitExe(hmod, &hmod, fFlags, &MainArgs) to initialized 80 ; the CRT and get the arguments for main(). 81 ; 82 mov ecx, esp 83 push ecx ; pMainFrame 84 %ifdef HIGHMEM 85 %define F1 __LIBC_INIT_FLAGS_MEM_HIGH 86 %else 87 %define F1 0 88 %endif 89 %ifdef NOUNIX 90 %define F2 __LIBC_INIT_FLAGS_NO_UNIX 91 %else 92 %define F2 0 93 %endif 94 %ifdef ARGS_RESP 95 %define F3 __LIBC_INIT_FLAGS_EXPAND_RESPONSE_FILE 96 %else 97 %define F3 0 98 %endif 99 %ifdef ARGS_WILD 100 %define F4 __LIBC_INIT_FLAGS_EXPAND_WILDCARDS 101 %else 102 %define F4 0 103 %endif 104 push F1+F2+F3+F4 105 lea edx, [ebp + 8] 106 push edx ; pvOS 107 mov eax, [ebp + 8] 108 push eax ; hmod 109 call NAME_FUNC(__libc_InitExe) 110 add esp, 10h 111 112 ; 113 ; We can call main(). Should main return, invoke exit with the return code. 114 ; 115 ; Should some bright guy override exit() and make it return, we'll loop 116 ; eating 4 bytes of stack for each call to exit(). Eventually we'll crash 117 ; when we run out of stack. 118 ; 119 call NAME_FUNC(main) 120 121 mov esi, eax 122 .do_exit: 123 mov [esp], esi 124 call NAME_FUNC(exit) 125 jmp .do_exit 126 127 128 ;; 129 ; __data_start (and __data) marks the start of the data segment. 130 ; 131 ; By convention required by emxbind, the datasegment starts with 132 ; a magic number followed by a pointer to the list of OS/2 DLL 133 ; references. When linking OMF this is not used by anyone. 134 ; 135 SEG_BEGIN_DATA 136 GLOBAL_DATA __data_start 137 GLOBAL_DATA _data 138 NAME_DATA(__data_start): 139 NAME_DATA(_data): 140 dd 0x00ba0bab ; Magic number (error detection). 141 dd NAME_DATA(_os2dll) ; List of OS/2 DLL references. 142 143 %ifndef NOFORK 144 %ifndef NOUNIX 145 ;; 146 ; The fork module structure. 147 ; 148 148 g_ForkModule: 149 .long 0x00010001 /* uVersion (__LIBC_FORK_MODULE_VERSION) */ 150 .long __atfork_callback /* pfnAtFork */ 151 .long ___fork_parent1__ /* papParent1 */ 152 .long ___fork_child1__ /* papChild1 */ 153 .long ___data_start /* pvDataSegBase */ 154 .long _end /* pvDataSegEnd */ 155 .long 0x00000001 /* fFlags - __LIBC_FORKMODULE_FLAGS_EXECUTABLE */ 156 .long 0 /* pNext */ 157 g_ForkModule_hmod: 158 .long 0 /* hmod */ 159 .long 0 /* uReserved[7] */ 160 .long 0 /* uReserved[7] */ 161 .long 0 /* uReserved[7] */ 162 .long 0 /* uReserved[7] */ 163 .long 0 /* uReserved[7] */ 164 .long 0 /* uReserved[7] */ 165 .long 0 /* uReserved[7] */ 166 #endif 167 168 169 /** 170 * __bss_start marks where the BSS segment starts. 171 */ 172 .bss 173 .global ___bss_start 174 ___bss_start: 175 176 177 /** 178 * Start all the a.out SETs the CRT and GCC are making use of. 179 * 180 * _os2dll is used by emxbind/ld for dll imports. 181 * __CTOR_LIST__ and __DTOR_LIST__ are lists of static constructors and destructors. 182 * __crtinit1__ is the list of static crt init routines. 183 * __crtinit2__ is the list of static crt termination routines. 184 * __eh_frame__, __eh_init__ and __eh_term__ are GCC exception handling info. 185 * __fork_parent1__ and __fork_child1__ are lists with fork time callbacks. 186 */ 187 .stabs "__os2dll", 21, 0, 0, 0xffffffff 188 .stabs "___CTOR_LIST__", 21, 0, 0, 0xffffffff 189 .stabs "___DTOR_LIST__", 21, 0, 0, 0xffffffff 190 .stabs "___crtinit1__", 21, 0, 0, 0xffffffff 191 .stabs "___crtexit1__", 21, 0, 0, 0xffffffff 192 .stabs "___eh_frame__", 21, 0, 0, 0xffffffff 193 .stabs "___eh_init__", 21, 0, 0, 0xffffffff 194 .stabs "___eh_term__", 21, 0, 0, 0xffffffff 195 #if !defined(NOFORK) && !defined(NOUNIX) 196 .stabs "___fork_parent1__", 21, 0, 0, 0xffffffff 197 .stabs "___fork_child1__", 21, 0, 0, 0xffffffff 198 #endif 199 200 201 /** 202 * Add a symbol table entry which drags _end in libend into OMF links. 203 */ 204 .stabs "__end",1,0,0,0 205 149 dd 0x00010001 ; uVersion (__LIBC_FORK_MODULE_VERSION) 150 dd NAME_FUNC(_atfork_callback) ; pfnAtFork 151 dd ___fork_parent1__ ; papParent1 152 dd ___fork_child1__ ; papChild1 153 dd ___data_start ; pvDataSegBase 154 dd _end ; pvDataSegEnd 155 dd 0x00000001 ; fFlags - __LIBC_FORKMODULE_FLAGS_EXECUTABLE 156 dd 0 ; pNext 157 g_ForkModule_hmod: ; 158 dd 0 ; hmod 159 dd 0 ; uReserved[7] 160 dd 0 ; uReserved[7] 161 dd 0 ; uReserved[7] 162 dd 0 ; uReserved[7] 163 dd 0 ; uReserved[7] 164 dd 0 ; uReserved[7] 165 dd 0 ; uReserved[7] 166 %endif 167 %endif 168 169 170 ; 171 ; Start all the a.out SETs the CRT and GCC are making use of. 172 ; 173 ; _os2dll is used by emxbind/ld for dll imports. 174 ; __CTOR_LIST__ and __DTOR_LIST__ are lists of static constructors and destructors. 175 ; __crtinit1__ is the list of static crt init routines. 176 ; __crtinit2__ is the list of static crt termination routines. 177 ; __eh_frame__, __eh_init__ and __eh_term__ are GCC exception handling info. 178 ; __fork_parent1__ and __fork_child1__ are lists with fork time callbacks. 179 ; __libc_sysctl__ are lists with sysctl registration structure pointers. 180 ; 181 %if KLIBC_OBJFMT == KLIBC_OBJFMT_AOUT 182 %fatal "AOUT is not suported. 183 %endif 184 KLIBC_OS2_SET_VECTOR_DEFINE _os2dll 185 KLIBC_OS2_SET_VECTOR_DEFINE __CTOR_LIST__ 186 KLIBC_OS2_SET_VECTOR_DEFINE __DTOR_LIST__ 187 KLIBC_OS2_SET_VECTOR_DEFINE __crtinit1__ 188 KLIBC_OS2_SET_VECTOR_DEFINE __crtexit1__ 189 KLIBC_OS2_SET_VECTOR_DEFINE __libc_sysctl__ 190 %ifndef NOFORK 191 %ifndef NOUNIX 192 KLIBC_OS2_SET_VECTOR_DEFINE __fork_child1__ 193 KLIBC_OS2_SET_VECTOR_DEFINE __fork_parent1__ 194 %endif 195 %endif 196 KLIBC_OS2_SET_VECTOR_DEFINE __eh_frame__ 197 KLIBC_OS2_SET_VECTOR_DEFINE __eh_init__ 198 KLIBC_OS2_SET_VECTOR_DEFINE __eh_term__ 199 200 201 ;; 202 ; __bss_start marks where the BSS segment starts. 203 ; 204 SEG_BEGIN_BSS 205 GLOBAL_DATA __bss_start 206 NAME_DATA(__bss_start): 207 -
trunk/libc/src/libc/startup/os2/x86/dll0.asm
r3893 r3895 1 /* $Id$ */ 2 /** @file 3 * 4 * OS/2 dll0. 5 * 6 * Copyright (c) 2006 knut st. osmundsen <bird@innotek.de> 7 * 8 * 9 * This file is part of kLIBC. 10 * 11 * kLIBC is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License as published 13 * by the Free Software Foundation; either version 2 of the License, or 14 * (at your option) any later version. 15 * 16 * kLIBC 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 Lesser General Public License for more details. 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * along with kLIBC; 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 #include <klibc/initterm.h> 29 30 31 32 /** 33 * The OS/2 library entry point. 34 * 35 * We emulate _DLL_InitTerm for EMX and VAC compatibility up to a point. 36 * That is, we don't let the extra termination call on load failure get 37 * to _DLL_InitTerm(). Should a fatal exception arise during init we 38 * will catch it and make the load fail. 39 * 40 * EAX = EBX = ECX = EDX = ESI = EDI = EBP = GS = 0. 41 * CS = flat code selector. 42 * DS = ES = SS = flat data selector. 43 * FS = TIB selector. 44 * EFLAGS=undefined 45 * 46 * 47 * @returns exit code to pass to DosExit(1, rc); 48 * @param hmod [ebp + 8h] The executable module handle. 49 * @param fFlag [ebp + 0ch] Why we're called. 50 * 51 */ 52 .text 53 .global __text 54 __text: 55 /* 56 * Clear DF, create a stack frame, and setup the exception handler. 57 */ 58 cld 59 pushl %ebp 60 movl %esp, %ebp 61 62 pushl $dll0_exception_handler 63 pushl %fs:0 /* tib_pexchain */ 64 movl %esp, %fs:0 65 66 subl $0x1c, %esp 67 68 /* 69 * What are we in for? 70 */ 71 movl 0xc(%ebp), %eax 72 orl %eax, %eax 73 je dll0_init 74 cmpl $1, %eax 75 je dll0_term 76 jmp return_failure /* something's busted. */ 77 78 79 /* 80 * Initialize the DLL. 81 */ 82 dll0_init: 83 #if !defined(NOFORK) && !defined(NOUNIX) 84 /* 85 * Update g_ForkModule.hmod and call __libc_ForkRegisterModule(&g_ForkModule) to 86 * register the fork module. The return code is < 0 on error, 0 on normal load, > 0 on fork. 87 */ 88 movl 8(%ebp), %eax 89 movl %eax, g_ForkModule_hmod 90 91 movl $g_ForkModule, (%esp) 92 call ___libc_ForkRegisterModule 93 cmpl $0, %eax 94 je dll0_init_not_forking 95 jg return_success /* %eax > 0: we're forking; no init. */ 96 jmp return_failure /* %eax < 0: the call failed. */ 97 dll0_init_not_forking: 98 movb $1, g_fCalledForkRegisterModule 99 #endif 100 101 /* 102 * Call __libc_InitDll(hmod, NULL, fFlags) to initialized the CRT for this DLL. 103 */ 104 #if defined(HIGHMEM) 105 # define F1 __LIBC_INIT_FLAGS_MEM_HIGH 106 #else 107 # define F1 0 108 #endif 109 #if defined(NOUNIX) 110 # define F2 __LIBC_INIT_FLAGS_NO_UNIX 111 #else 112 # define F2 0 113 #endif 114 #if defined(ARGS_RESP) 115 # define F3 __LIBC_INIT_FLAGS_EXPAND_RESPONSE_FILE 116 #else 117 # define F3 0 118 #endif 119 #if defined(ARGS_WILD) 120 # define F4 __LIBC_INIT_FLAGS_EXPAND_WILDCARDS 121 #else 122 # define F4 0 123 #endif 124 movl $(F1+F2+F3+F4), 8(%esp) /* fFlags */ 125 movl $0, 4(%esp) /* pvOS */ 126 movl 8(%ebp), %eax 127 movl %eax, (%esp) /* hmod */ 128 call ___libc_InitDll 129 orl %eax, %eax 130 jnz dll0_term_fork_module 131 movb $1, g_fCalledInitDll 132 133 /* 134 * We can now invoke _DLL_InitTerm(hmod, 0). 135 */ 136 movl $0, 4(%esp) /* fFlags = 0 */ 137 movl 8(%ebp), %eax 138 movl %eax, (%esp) /* hmod */ 139 call _DLL_InitTerm 140 orl %eax, %eax 141 jz dll0_term_crt /* it failed. */ 142 movb $1, g_fCalled_DLL_InitTerm 143 144 return_success: 145 movl -8(%ebp), %edx 146 mov %edx, %fs:0 147 148 movl $1, %eax 149 leave 150 ret 151 152 153 /* 154 * DLL Termination / Init Bailout. 155 * 156 * The termination return code is ignored, so we return 'failure' (0) regardless 157 * of we're cleaning up from a failed init or are actually in a real termination call. 158 */ 159 dll0_term: 160 /* 161 * _DLL_InitTerm(hmod, 1). 162 */ 163 cmpb $1, g_fCalled_DLL_InitTerm 164 jnz dll0_term_crt 165 166 movl $1, 4(%esp) /* fFlags = 1 = termination */ 167 movl 8(%ebp), %eax 168 movl %eax, (%esp) /* hmod */ 169 movb $0, g_fCalled_DLL_InitTerm 170 call _DLL_InitTerm 171 172 /* 173 * Call __libc_TermDll(hmod, NULL, fFlags). 174 */ 175 dll0_term_crt: 176 cmpb $1, g_fCalledInitDll 177 jnz dll0_term_fork_module 178 179 movl $(F1+F2+F3+F4), 8(%esp) /* fFlags */ 180 movl $0, 4(%esp) /* pvOS */ 181 movl 8(%ebp), %eax 182 movl %eax, (%esp) /* hmod */ 183 movb $0, g_fCalledInitDll 184 call ___libc_TermDll 185 186 /* 187 * __libc_ForkDeregisterModule($g_ForkModule) 188 */ 189 dll0_term_fork_module: 190 #if !defined(NOFORK) && !defined(NOUNIX) 191 cmpb $1, g_fCalledForkRegisterModule 192 jnz dll0_term_done 193 194 movl $g_ForkModule, (%esp) 195 movb $0, g_fCalledForkRegisterModule 196 call ___libc_ForkDeregisterModule 197 198 dll0_term_done: 199 #endif 200 201 return_failure: 202 movl -8(%ebp), %edx 203 mov %edx, %fs:0 204 205 xorl %eax, %eax 206 leave 207 ret 208 209 210 /** 211 * Exception handler. 212 * 213 * @param pXcptRepRec [ebp + 0x08] 214 * @param pXcptRegRec [ebp + 0x0c] 215 * @param pCtx [ebp + 0x10] 216 * @param pvWhatever [ebp + 0x14] 217 */ 1 ; $Id$ 2 ;; @file 3 ; kNIX - Pre-_DLL_InitTerm() startup code, OS/2. 4 ; 5 ; @copyright Copyright (C) 2006-2014 knut st. osmundsen <bird-klibc-spam-xiv@anduin.net> 6 ; @licenses MIT, BSD2, BSD3, BSD4, LGPLv2.1, LGPLv3, LGPLvFuture. 7 ; 8 9 10 ;******************************************************************************* 11 ;* Header Files * 12 ;******************************************************************************* 13 %include "klibc/asmdefs.mac" 14 %include "klibc/initterm.mac" 15 16 17 18 extern _DLL_InitTerm ; System 19 extern NAME_FUNC(__libc_ForkRegisterModule) 20 extern NAME_FUNC(__libc_ForkDeregisterModule) 21 extern NAME_FUNC(__libc_InitDll) 22 extern NAME_FUNC(__libc_TermDll) 23 extern NAME_FUNC(__libc_Back_initDllLoadException) 24 extern NAME_FUNC(_atfork_callback) 25 ; Add a symbol table entry which drags _end in libend into OMF links. 26 extern __end 27 extern _end 28 29 30 SEG_BEGIN_CODE 31 32 ;; 33 ; The OS/2 library entry point. 34 ; 35 ; We emulate _DLL_InitTerm for EMX and VAC compatibility up to a point. 36 ; That is, we don't let the extra termination call on load failure get 37 ; to _DLL_InitTerm(). Should a fatal exception arise during init we 38 ; will catch it and make the load fail. 39 ; 40 ; EAX = EBX = ECX = EDX = ESI = EDI = EBP = GS = 0. 41 ; CS = flat code selector. 42 ; DS = ES = SS = flat data selector. 43 ; FS = TIB selector. 44 ; EFLAGS=undefined 45 ; 46 ; 47 ; @returns exit code to pass to DosExit(1, rc); 48 ; @param hmod [ebp + 8h] The executable module handle. 49 ; @param fFlag [ebp + 0ch] Why we're called. 50 ; 51 GLOBAL_FUNC _text 52 ..start: 53 NAME_FUNC(_text): 54 ; 55 ; Clear DF, create a stack frame, and setup the exception handler. 56 ; 57 cld 58 push ebp 59 mov ebp, esp 60 61 push dll0_exception_handler 62 push dword [fs:0] ; tib_pexchain 63 mov dword [fs:0], esp 64 65 sub esp, 01ch 66 67 ; 68 ; What are we in for? 69 ; 70 mov eax, [ebp + 0ch] 71 or eax, eax 72 je .dll0_init 73 cmp eax, 1 74 je .dll0_term 75 jmp .return_failure ; something's busted. 76 77 78 ; 79 ; Initialize the DLL. 80 ; 81 .dll0_init: 82 %ifndef NOFORK 83 %ifndef NOUNIX 84 ; 85 ; Update g_ForkModule.hmod and call __libc_ForkRegisterModule(&g_ForkModule) to 86 ; register the fork module. The return code is < 0 on error, 0 on normal load, > 0 on fork. 87 ; 88 mov eax, [ebp + 8] ; hmod 89 mov [g_ForkModule_hmod], eax 90 91 mov dword [esp], g_ForkModule 92 call NAME_FUNC(__libc_ForkRegisterModule) 93 cmp eax, 0 94 je .dll0_init_not_forking 95 jg .return_success ; %eax > 0: we're forking; no init. 96 jmp .return_failure ; %eax < 0: the call failed. 97 .dll0_init_not_forking: 98 mov byte [g_fCalledForkRegisterModule], 1 99 %endif 100 %endif 101 102 ; 103 ; Call __libc_InitDll(hmod, NULL, fFlags) to initialized the CRT for this DLL. 104 ; 105 %ifdef HIGHMEM 106 %define F1 __LIBC_INIT_FLAGS_MEM_HIGH 107 %else 108 %define F1 0 109 %endif 110 %ifdef NOUNIX 111 %define F2 __LIBC_INIT_FLAGS_NO_UNIX 112 %else 113 %define F2 0 114 %endif 115 %ifdef ARGS_RESP 116 %define F3 __LIBC_INIT_FLAGS_EXPAND_RESPONSE_FILE 117 %else 118 %define F3 0 119 %endif 120 %ifdef ARGS_WILD 121 %define F4 __LIBC_INIT_FLAGS_EXPAND_WILDCARDS 122 %else 123 %define F4 0 124 %endif 125 mov dword [esp + 8], F1+F2+F3+F4 ; fFlags 126 mov dword [esp + 4], 0 ; pvOS 127 mov eax, [ebp + 8] 128 mov [esp], eax ; hmod 129 call NAME_FUNC(__libc_InitDll) 130 or eax, eax 131 jnz .dll0_term_fork_module 132 mov byte [g_fCalledInitDll], 1 133 134 ; 135 ; We can now invoke _DLL_InitTerm(hmod, 0). 136 ; 137 mov dword [esp + 4], 0 ; fFlags = 0 138 mov eax, [ebp + 8] 139 mov [esp], eax ; hmod 140 call _DLL_InitTerm 141 or eax, eax, 142 jz .dll0_term_crt ; it failed. 143 mov byte [g_fCalled_DLL_InitTerm], 1 144 145 .return_success: 146 mov edx, [ebp -8] 147 mov [fs:0], edx 148 149 mov eax, 1 150 leave 151 ret 152 153 154 ; 155 ; DLL Termination / Init Bailout. 156 ; 157 ; The termination return code is ignored, so we return 'failure' (0) regardless 158 ; of we're cleaning up from a failed init or are actually in a real termination call. 159 ; 160 .dll0_term: 161 ; 162 ; _DLL_InitTerm(hmod, 1). 163 ; 164 cmp byte [g_fCalled_DLL_InitTerm], 1 165 jne .dll0_term_crt 166 167 mov dword [esp + 4], 1 ; fFlags = 1 = termination 168 mov eax, [ebp + 8] 169 mov [esp], eax ; hmod 170 mov byte [g_fCalled_DLL_InitTerm], 0 171 call _DLL_InitTerm 172 173 ; 174 ; Call __libc_TermDll(hmod, NULL, fFlags). 175 ; 176 .dll0_term_crt: 177 cmp byte [g_fCalledInitDll], 1 178 jne .dll0_term_fork_module 179 180 mov dword [esp + 8], F1+F2+F3+F4 ; fFlags 181 mov dword [esp + 4], 0 ; pvOS 182 mov eax, [ebp + 8] 183 mov [esp], eax ; hmod 184 mov byte [g_fCalledInitDll], 0 185 call NAME_FUNC(__libc_TermDll) 186 187 ; 188 ; __libc_ForkDeregisterModule($g_ForkModule) 189 ; 190 .dll0_term_fork_module: 191 %ifndef NOFORK 192 %ifndef NOUNIX 193 cmp byte [g_fCalledForkRegisterModule], 1 194 jne .dll0_term_done 195 196 mov dword [esp], g_ForkModule 197 mov byte [g_fCalledForkRegisterModule], 0 198 call NAME_FUNC(__libc_ForkDeregisterModule) 199 200 .dll0_term_done: 201 %endif 202 %endif 203 204 .return_failure: 205 mov edx, [ebp - 8] 206 mov [fs:0], edx 207 208 xor eax, eax 209 leave 210 ret 211 212 213 ;; 214 ; Exception handler. 215 ; 216 ; @param pXcptRepRec [ebp + 0x08] 217 ; @param pXcptRegRec [ebp + 0x0c] 218 ; @param pCtx [ebp + 0x10] 219 ; @param pvWhatever [ebp + 0x14] 220 ; 218 221 dll0_exception_handler: 219 cld 220 pushl %ebp 221 mov %esp, %ebp 222 223 /* 224 * Call ___libc_Back_initDllLoadException and let it decide what to do. 225 * It returns 0 if we should continue search the exception handler chain. 226 * It returns -1 if we resume execution. 227 * All other return codes means that we should abort the DLL load. 228 */ 229 pushl 0x14(%ebp) 230 pushl 0x10(%ebp) 231 pushl 0x0c(%ebp) 232 pushl 0x08(%ebp) 233 call ___libc_Back_initDllLoadException 234 orl %eax, %eax 235 jz dll0_xcpt_return 236 cmp $0xffffffff, %eax 237 je dll0_xcpt_return 238 239 /* 240 * Abort the loading / termination. 241 * We pXcptRegRec as a navigation point to calculate %ebp and %esp. 242 */ 243 mov 0x0c(%ebp), %eax 244 lea 0x08(%eax), %ebp 245 lea -0x14(%eax), %esp 246 jmp dll0_term 247 248 /* 249 * Continue search or execution. 250 */ 251 dll0_xcpt_return: 252 leave 253 ret 254 255 256 257 /** 258 * __data_start (and __data) marks the start of the data segment. 259 * 260 * By convention required by emxbind, the datasegment starts with 261 * a magic number followed by a pointer to the list of OS/2 DLL 262 * references. When linking OMF this is not used by anyone. 263 */ 264 .data 265 .global ___data_start 266 .global __data 267 ___data_start: 268 __data: 269 .long 0x00ba0bab /* Magic number (error detection). */ 270 .long __os2dll /* List of OS/2 DLL references. */ 271 272 /** Indicates that we've called __libc_InitDll() and should call __libc_TermDll(). */ 222 cld 223 push ebp 224 mov ebp, esp 225 226 ; 227 ; Call ___libc_Back_initDllLoadException and let it decide what to do. 228 ; It returns 0 if we should continue search the exception handler chain. 229 ; It returns -1 if we resume execution. 230 ; All other return codes means that we should abort the DLL load. 231 ; 232 push dword [ebp + 14h] 233 push dword [ebp + 10h] 234 push dword [ebp + 0ch] 235 push dword [ebp + 08h] 236 call NAME_FUNC(__libc_Back_initDllLoadException) 237 or eax, eax 238 jz .dll0_xcpt_return 239 cmp eax, 0ffffffffh 240 je .dll0_xcpt_return 241 242 ; 243 ; Abort the loading / termination. 244 ; We use pXcptRegRec as a navigation point to calculate %ebp and %esp. 245 ; 246 mov eax, [ebp + 0ch] 247 lea ebp, [eax + 8] 248 lea esp, [eax - 14h] 249 ;; @todo Have to save non-volatile registes for this to really work! 250 jmp NAME_FUNC(_text).dll0_term 251 252 ; 253 ; Continue search or execution. 254 ; 255 .dll0_xcpt_return: 256 leave 257 ret 258 259 260 261 ; 262 ; __data_start (and __data) marks the start of the data segment. 263 ; 264 ; By convention required by emxbind, the datasegment starts with 265 ; a magic number followed by a pointer to the list of OS/2 DLL 266 ; references. When linking OMF this is not used by anyone. 267 ; 268 SEG_BEGIN_DATA 269 GLOBAL_DATA __data_start 270 GLOBAL_DATA _data 271 NAME_DATA(__data_start): 272 NAME_DATA(_data): 273 dd 0x00ba0bab ; Magic number (error detection). 274 dd NAME_DATA(_os2dll) ; List of OS/2 DLL references. 275 276 ;; Indicates that we've called __libc_InitDll() and should call __libc_TermDll(). 273 277 g_fCalledInitDll: 274 .byte0275 /** Indicates that we've called _DLL_InitTerm(,0) and should call _DLL_InitTerm(,1). */ 278 db 0 279 ;; Indicates that we've called _DLL_InitTerm(,0) and should call _DLL_InitTerm(,1). 276 280 g_fCalled_DLL_InitTerm: 277 .byte0278 /** Indicates that we've called __libc_ForkRegisterModule() and should call __libc_ForkDeregisterModule(). */ 281 db 0 282 ;; Indicates that we've called __libc_ForkRegisterModule() and should call __libc_ForkDeregisterModule(). 279 283 g_fCalledForkRegisterModule: 280 .byte 0 281 .byte 0 /* alignment */ 282 .long 0 /* alignment */ 283 284 #if !defined(NOFORK) && !defined(NOUNIX) 285 /** 286 * The fork module structure. 287 */ 284 db 0 285 db 0 ; alignment 286 dd 0 ; alignment 287 288 %ifndef NOFORK 289 %ifndef NOUNIX 290 ;; 291 ; The fork module structure. 292 ; 288 293 g_ForkModule: 289 .long 0x00010001 /* uVersion (__LIBC_FORK_MODULE_VERSION) */290 .long __atfork_callback /* pfnAtFork */291 .long ___fork_parent1__ /* papParent1 */292 .long ___fork_child1__ /* papChild1 */293 .long ___data_start /* pvDataSegBase */294 .long _end /* pvDataSegEnd */295 .long 0x00000000 /* fFlags */296 .long 0 /* pNext */294 dd 0x00010001 ; uVersion (__LIBC_FORK_MODULE_VERSION) 295 dd NAME_FUNC(_atfork_callback) ; pfnAtFork 296 dd ___fork_parent1__ ; papParent1 297 dd ___fork_child1__ ; papChild1 298 dd ___data_start ; pvDataSegBase 299 dd _end ; pvDataSegEnd 300 dd 0x00000000 ; fFlags 301 dd 0 ; pNext 297 302 g_ForkModule_hmod: 298 .long 0 /* hmod */ 299 .long 0 /* uReserved[7] */ 300 .long 0 /* uReserved[7] */ 301 .long 0 /* uReserved[7] */ 302 .long 0 /* uReserved[7] */ 303 .long 0 /* uReserved[7] */ 304 .long 0 /* uReserved[7] */ 305 .long 0 /* uReserved[7] */ 306 #endif 307 308 309 /** 310 * __bss_start marks where the BSS segment starts. 311 */ 312 .bss 313 .global ___bss_start 314 ___bss_start: 315 316 317 /** 318 * Start all the a.out SETs the CRT and GCC are making use of. 319 * 320 * _os2dll is used by emxbind/ld for dll imports. 321 * __CTOR_LIST__ and __DTOR_LIST__ are lists of static constructors and destructors. 322 * __crtinit1__ is the list of static crt init routines. 323 * __crtinit2__ is the list of static crt termination routines. 324 * __eh_frame__, __eh_init__ and __eh_term__ are GCC exception handling info. 325 * __fork_parent1__ and __fork_child1__ are lists with fork time callbacks. 326 */ 327 .stabs "__os2dll", 21, 0, 0, 0xffffffff 328 .stabs "___CTOR_LIST__", 21, 0, 0, 0xffffffff 329 .stabs "___DTOR_LIST__", 21, 0, 0, 0xffffffff 330 .stabs "___crtinit1__", 21, 0, 0, 0xffffffff 331 .stabs "___crtexit1__", 21, 0, 0, 0xffffffff 332 .stabs "___eh_frame__", 21, 0, 0, 0xffffffff 333 .stabs "___eh_init__", 21, 0, 0, 0xffffffff 334 .stabs "___eh_term__", 21, 0, 0, 0xffffffff 335 #if !defined(NOFORK) && !defined(NOUNIX) 336 .stabs "___fork_parent1__", 21, 0, 0, 0xffffffff 337 .stabs "___fork_child1__", 21, 0, 0, 0xffffffff 338 #endif 339 340 341 /** 342 * Add a symbol table entry which drags _end in libend into OMF links. 343 */ 344 .stabs "__end",1,0,0,0 345 303 dd 0 ; hmod 304 dd 0 ; uReserved[7] 305 dd 0 ; uReserved[7] 306 dd 0 ; uReserved[7] 307 dd 0 ; uReserved[7] 308 dd 0 ; uReserved[7] 309 dd 0 ; uReserved[7] 310 dd 0 ; uReserved[7] 311 %endif 312 %endif 313 314 315 316 ; 317 ; Start all the a.out SETs the CRT and GCC are making use of. 318 ; 319 ; _os2dll is used by emxbind/ld for dll imports. 320 ; __CTOR_LIST__ and __DTOR_LIST__ are lists of static constructors and destructors. 321 ; __crtinit1__ is the list of static crt init routines. 322 ; __crtinit2__ is the list of static crt termination routines. 323 ; __eh_frame__, __eh_init__ and __eh_term__ are GCC exception handling info. 324 ; __fork_parent1__ and __fork_child1__ are lists with fork time callbacks. 325 ; __libc_sysctl__ are lists with sysctl registration structure pointers. 326 ; 327 %if KLIBC_OBJFMT == KLIBC_OBJFMT_AOUT 328 %fatal "AOUT is not suported. 329 %endif 330 KLIBC_OS2_SET_VECTOR_DEFINE _os2dll 331 KLIBC_OS2_SET_VECTOR_DEFINE __CTOR_LIST__ 332 KLIBC_OS2_SET_VECTOR_DEFINE __DTOR_LIST__ 333 KLIBC_OS2_SET_VECTOR_DEFINE __crtinit1__ 334 KLIBC_OS2_SET_VECTOR_DEFINE __crtexit1__ 335 KLIBC_OS2_SET_VECTOR_DEFINE __libc_sysctl__ 336 %ifndef NOFORK 337 %ifndef NOUNIX 338 KLIBC_OS2_SET_VECTOR_DEFINE __fork_child1__ 339 KLIBC_OS2_SET_VECTOR_DEFINE __fork_parent1__ 340 %endif 341 %endif 342 KLIBC_OS2_SET_VECTOR_DEFINE __eh_frame__ 343 KLIBC_OS2_SET_VECTOR_DEFINE __eh_init__ 344 KLIBC_OS2_SET_VECTOR_DEFINE __eh_term__ 345 346 347 ;; 348 ; __bss_start marks where the BSS segment starts. 349 ; 350 SEG_BEGIN_BSS 351 GLOBAL_DATA __bss_start 352 NAME_DATA(__bss_start): 353
Note:
See TracChangeset
for help on using the changeset viewer.