Changeset 2942
- Timestamp:
- Jan 8, 2007, 9:15:42 AM (19 years ago)
- Location:
- trunk/libc
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libc/Config.kmk
r2901 r2942 112 112 TEMPLATE_libcasm_TOOL = GCC3 113 113 TEMPLATE_libcasm_TOOL.os2 = GCC3OMF 114 TEMPLATE_libcasm_ASTOOL = ALP115 114 TEMPLATE_libcasm_INCS = $(PATH_LIBC_INC) $(dir $(LIBC-STD.H)) 116 115 TEMPLATE_libcasm_INST = usr/lib/ 116 ifeq (1,0) # ALP sucks. 117 TEMPLATE_libcasm_ASTOOL = ALP 117 118 TEMPLATE_libcasm_ASFLAGS = -Sv:ALP 119 else # NASM sucks too, but differently. 120 TEMPLATE_libcasm_ASTOOL = NASM 121 TEMPLATE_libcasm_ASFLAGS = -f obj -w+orphan-labels 122 endif 118 123 119 124 TEMPLATE_libcasm.logstrict = -
trunk/libc/Makefile.kmk
r2939 r2942 120 120 # libc.a 121 121 # 122 LIBRARIES += libc 123 libc_ TEMPLATE = libc124 libc_ SOURCES = \122 LIBRARIES += libc_s 123 libc_s_TEMPLATE = libc 124 libc_s_SOURCES = \ 125 125 $(TARGET_libc_frontend) \ 126 126 $(TARGET_libc_kNIX) 127 libc_ SOURCES.nt = $(TARGET_kNIX.nt)127 libc_s_SOURCES.nt = $(TARGET_kNIX.nt) 128 128 129 129 ifdef CFG_LIBC_LOGSTRICT_LIBS 130 LIBRARIES += libc_ l131 libc_ l_TEMPLATE = libc.profiled132 libc_ l_SOURCES = \130 LIBRARIES += libc_s_l 131 libc_s_l_TEMPLATE = libc.profiled 132 libc_s_l_SOURCES = \ 133 133 $(TARGET_libc_frontend_l) \ 134 134 $(TARGET_libc_kNIX_l) 135 libc_ l_SOURCES.nt = $(TARGET_kNIX_l.nt)136 endif 137 138 ifdef CFG_LIBC_PROFILED_LIBS 139 LIBRARIES += libc_ p140 libc_ p_TEMPLATE = libc.profiled141 libc_ p_SOURCES = \135 libc_s_l_SOURCES.nt = $(TARGET_kNIX_l.nt) 136 endif 137 138 ifdef CFG_LIBC_PROFILED_LIBS 139 LIBRARIES += libc_s_p 140 libc_s_p_TEMPLATE = libc.profiled 141 libc_s_p_SOURCES = \ 142 142 $(TARGET_libc_frontend_p) \ 143 143 $(TARGET_libc_kNIX_p) 144 libc_ p_SOURCES.nt = $(TARGET_kNIX_p.nt)144 libc_s_p_SOURCES.nt = $(TARGET_kNIX_p.nt) 145 145 endif 146 146 … … 184 184 libc07_LDFLAGS = -g -Zomf -nostdlib 185 185 libc07_LIBS = \ 186 $(TARGET_libc ) \186 $(TARGET_libc_s) \ 187 187 $(TARGET_libc_asm) \ 188 188 $(TARGET_libos2_unicode_lazy) \ … … 204 204 libc07.logstrict_LDFLAGS = -g -Zomf -nostdlib 205 205 libc07.logstrict_LIBS = \ 206 $(TARGET_libc_ l) \206 $(TARGET_libc_s_l) \ 207 207 $(TARGET_libc_asm_l) \ 208 208 $(TARGET_libos2_unicode_lazy) \ … … 225 225 libc07.profiled_LDFLAGS = -g -Zomf -nostdlib 226 226 libc07.profiled_LIBS = \ 227 $(TARGET_libc_ p) \227 $(TARGET_libc_s_p) \ 228 228 $(TARGET_libc_asm_p) \ 229 229 $(TARGET_libos2_unicode_lazy) \ … … 246 246 libc_dll_SOURCES = \ 247 247 $(PATH_TARGET)/libc.def 248 libc_dll_SOURCES.os2 = \ 249 src/libc/startup/os2/dllinit-os2.c 250 248 251 # todo add socket ++. 249 252 … … 252 255 # 253 256 $(PATH_TARGET)/libc.def: \ 254 $(TARGET_libc ) \257 $(TARGET_libc_s) \ 255 258 $(PATH_LIBC_SRC)/libc/libc.def 256 259 $(RM) -f $@ $@.tmp.def … … 260 263 $(APPEND) $@.tmp.def "CODE SHARED" 261 264 $(APPEND) $@.tmp.def "EXPORTS" 262 emxexp $(TARGET_libc ) \265 emxexp $(TARGET_libc_s) \ 263 266 | $(SED) -e "/\"___pfn/d" -e "/\"__sys_/d" -e "/\"___sys_/d" -e "/\"___libc_[a-z]/d" -e "/\"__nsyy/d" \ 264 267 >> $@.tmp.def … … 289 292 $(foreach hdr, $(wildcard include/emx/*.h), $(hdr)=>$(subst include/,,$(hdr))) \ 290 293 $(foreach hdr, $(wildcard include/InnoTekLIBC/*.h), $(hdr)=>$(subst include/,,$(hdr))) \ 294 $(foreach hdr, $(wildcard include/klibc/*.h), $(hdr)=>$(subst include/,,$(hdr))) \ 295 $(foreach hdr, $(wildcard include/klibc/*/*.h), $(hdr)=>$(subst include/,,$(hdr))) \ 291 296 $(foreach hdr, $(wildcard include/machine/*.h), $(hdr)=>$(subst include/,,$(hdr))) \ 292 297 $(foreach hdr, $(wildcard include/net/*.h), $(hdr)=>$(subst include/,,$(hdr))) \ -
trunk/libc/include/klibc/backend.h
r2941 r2942 69 69 * @param pvOS OS specific argument. 70 70 * @param fFlags Termination flags. 71 * __LIBC_INIT_FLAGS_PROCESS is set when doing the process init call (__libc_InitExe). 71 72 */ 72 73 int __libc_Back_init(uintptr_t hmod, void *pvOS, unsigned fFlags); … … 81 82 * When invoked via _exit() it's NULL. 82 83 * @param fFlags Termination flags. 83 * When invoked via _exit() it's 0.84 * When invoked via _exit() it's __LIBC_INIT_FLAGS_PROCESS. 84 85 */ 85 86 void __libc_Back_term(uintptr_t hmod, void *pvOS, unsigned fFlags); -
trunk/libc/include/klibc/initterm.h
r2941 r2942 66 66 #define __LIBC_INIT_FLAGS_EXPAND_RESPONSE_FILE 4 67 67 #define __LIBC_INIT_FLAGS_EXPAND_WILDCARDS 8 68 /** @internal */ 69 #define __LIBC_INIT_FLAGS_PROCESS 0x40000000 68 70 /** @} */ 69 71 -
trunk/libc/src/kNIX/b_initterm.c
r2941 r2942 50 50 * @param pvOS OS specific argument. 51 51 * @param fFlags Initialization flags, a combination of the __LIBC_INIT_FLAGS_* \#defines. 52 * __LIBC_INIT_FLAGS_PROCESS is set when doing the process init call (__libc_InitExe). 52 53 */ 53 54 static int __libc_back_init(uintptr_t hmod, void *pvOS, unsigned fFlags) … … 138 139 rc = __libc_back_init(hmod, pvOS, fFlags); 139 140 else 140 /* (Might later add initialization code for every module here.) */ 141 rc = 0; 141 { 142 #ifdef __OS2__ 143 /* Install the 16-bit signal handler. */ 144 if (fFlags & __LIBC_INIT_FLAGS_PROCESS) 145 rc = __libc_back_signalInitExe(); 146 else 147 #endif 148 rc = 0; 149 150 } 142 151 if (!rc) 143 152 LIBCLOG_RETURN_INT(0); … … 184 193 * When invoked via _exit() it's NULL. 185 194 * @param fFlags Termination flags. 186 * When invoked via _exit() it's 0.195 * When invoked via _exit() it's __LIBC_INIT_FLAGS_PROCESS. 187 196 */ 188 197 void __libc_Back_term(uintptr_t hmod, void *pvOS, unsigned fFlags) -
trunk/libc/src/kNIX/os2/386/signal16bit.asm
r2929 r2942 2 2 ;; @file 3 3 ; 4 ; LIBC SYS Backend - Signals,16-bit handler.4 ; kNIX - Signals, OS/2 16-bit handler. 5 5 ; 6 ; Copyright (c) 2004 knut st. osmundsen <bird@innotek.de>6 ; Copyright (c) 2004-2007 knut st. osmundsen <bird-src-spam@anduin.net> 7 7 ; 8 8 ; … … 25 25 ; 26 26 27 .386 27 extern Dos32TIB 28 extern ___libc_back_signalOS2V1Handler32bit 28 29 29 extrn Dos32TIB:abs 30 extrn ___libc_back_signalOS2V1Handler32bit:near 31 32 33 CODE16 segment use16 para public 'CODE' 30 segment CODE16 use16 align=16 public class=CODE 34 31 35 32 ;; … … 38 35 ; void FAR PASCAL __libc_back_signalOS2V1Handler16bit(USHORT sig_arg, USHORT sig_num); 39 36 ; 40 public___libc_back_signalOS2V1Handler16bit37 global ___libc_back_signalOS2V1Handler16bit 41 38 ___libc_back_signalOS2V1Handler16bit: 42 39 ; save registers. … … 56 53 push edx ; dword old sp. 57 54 58 jmp far ptr FLAT:CODE32:thunked_32 59 CODE16 ends 60 CODE32 segment use32 para public 'CODE' 55 ;jmp far dword CODE32:thunked_32 wrt FLAT 56 db 066h 57 db 0eah 58 dd thunked_32 wrt FLAT 59 dw CODE32 wrt FLAT 60 61 segment CODE32 use32 flat align=16 public class=CODE 61 62 thunked_32: 63 62 64 ; thunk the stack. 63 65 mov edx, ss … … 65 67 shl edx, 13 66 68 mov dx, sp 67 mov eax, seg FLAT:DATA3269 mov ax, DATA32 wrt FLAT 68 70 mov esp, edx 69 71 mov ss, eax … … 72 74 mov ds, eax 73 75 mov es, eax 74 mov edx, Dos32TIB 76 mov edx, Dos32TIB ;wrt abs 75 77 mov fs, edx 76 78 77 79 ; call 32-bit worker 78 movzx eax, word ptr[esp + (4 * 5) + (2 * 4) + 6] ; sig_arg79 movzx edx, word ptr[esp + (4 * 5) + (2 * 4) + 4] ; sig_num80 movzx eax, word [esp + (4 * 5) + (2 * 4) + 6] ; sig_arg 81 movzx edx, word [esp + (4 * 5) + (2 * 4) + 4] ; sig_num 80 82 push eax 81 83 push edx 82 call ___libc_back_signalOS2V1Handler32bit 84 call ___libc_back_signalOS2V1Handler32bit wrt FLAT 83 85 add esp, 8h 84 86 85 87 ; restore the stack and jump to 16-bit. 86 88 lss esp, [esp] 87 jmp far ptr CODE16:thunked_16 88 CODE32 ends 89 CODE16 segment 89 ;jmp word far thunked_16 90 db 066h 91 db 0eah 92 dw thunked_16 wrt CODE16 93 dw CODE16 94 95 segment CODE16 90 96 thunked_16: 91 97 … … 100 106 101 107 retf 4 102 CODE16 ends103 108 104 DATA32 segment use32 para public 'DATA32' 105 DATA32 ends 109 segment DATA32 use32 flat align=16 public class=DATA32 106 110 107 end -
trunk/libc/src/kNIX/os2/fhOS2File.c
r2935 r2942 873 873 } 874 874 pStat->st_attr = rc; 875 rc = 0; 875 876 if (rc & FILE_READONLY) 876 877 pStat->st_mode |= S_IROTH | S_IRGRP | S_IRUSR; -
trunk/libc/src/kNIX/os2/kNIX-os2.h
r2936 r2942 261 261 262 262 int __libc_back_signalInit(void); 263 int __libc_back_signalInitExe(void *pvRegRec);263 int __libc_back_signalInitExe(void); 264 264 int __libc_back_signalSemRequest(void); 265 265 void __libc_back_signalSemRelease(void); -
trunk/libc/src/kNIX/os2/signals.c
r2929 r2942 613 613 * @returns 0 on success. 614 614 * @returns Negative error code (errno.h) on failure. 615 * @param pvRegRec Pointer to the exception registartion record to use. 616 */ 617 int __libc_back_signalInitExe(void *pvRegRec) 615 */ 616 int __libc_back_signalInitExe(void) 618 617 { 619 618 LIBCLOG_ENTER("\n"); 620 621 /* 622 * Exception handler. 623 */ 624 PEXCEPTIONREGISTRATIONRECORD pRegRec = (PEXCEPTIONREGISTRATIONRECORD)pvRegRec; 625 pRegRec->prev_structure = END_OF_CHAIN; 626 pRegRec->ExceptionHandler = __libc_Back_exceptionHandler; 627 int rc = DosSetExceptionHandler(pRegRec); 619 LIBC_ASSERT(!gfOS2V1Handler); 620 FS_VAR_SAVE_LOAD(); 628 621 629 622 /* 630 623 * Signal handling. 631 624 */ 632 rc = DosSetSigHandler((PFNSIGHANDLER)__libc_back_signalOS2V1Handler16bit, NULL, NULL, SIGA_ACCEPT, SIG_PFLG_A);625 int rc = DosSetSigHandler((PFNSIGHANDLER)__libc_back_signalOS2V1Handler16bit, NULL, NULL, SIGA_ACCEPT, SIG_PFLG_A); 633 626 if (!rc) 634 627 { … … 636 629 ULONG cTimes = 0; 637 630 DosSetSignalExceptionFocus(SIG_SETFOCUS, &cTimes); /* (Will fail with rc 303 for PM apps - which we ignore.) */ 631 FS_RESTORE(); 638 632 LIBCLOG_RETURN_INT(0); 639 633 } 640 634 LIBC_ASSERTM_FAILED("DosSetSigHandler failed with rc=%d\n", rc); 641 635 rc = -__libc_back_native2errno(rc); 636 FS_RESTORE(); 642 637 LIBCLOG_ERROR_RETURN_INT(rc); 643 638 } -
trunk/libc/src/libc/startup/initterm.c
r2941 r2942 27 27 28 28 /** @page pg_initterm Initialization and Termination 29 * 30 * kLIBC tries to provides a well defined, portable and hopefully relativly stable 31 * interface for initialization and termination of it's operation. The dll0 and 29 * 30 * kLIBC tries to provides a well defined, portable and hopefully relativly stable 31 * interface for initialization and termination of it's operation. The dll0 and 32 32 * crt0 objects are considered mere users of this interface. The days where the 33 33 * __init() function did cool stuff to ESP is over. 34 * 34 * 35 35 * The general event flow is as follows: 36 36 * -# dll0/crt0 calls __libc_InitDll()/__libc_initExe(). … … 39 39 * -# If __libc_InitExe() was invoked, the argument vector is initialized. 40 40 * -# exit() is called. 41 * 41 * 42 42 * Both the backend and the frontend performs usage accounting most of the work 43 43 * is done on the first call. Likewise for termination. 44 * 44 * 45 45 */ 46 46 … … 85 85 { 86 86 LIBCLOG_ENTER("hmod=%tx pvOS=%p fFlags=%#x\n", hmod, pvOS, fFlags); 87 LIBC_ASSERT(!(fFlags & __LIBC_INIT_FLAGS_PROCESS)); 87 88 int rc = __libc_init(hmod, pvOS, fFlags); 88 89 LIBCLOG_RETURN_INT(rc); … … 103 104 { 104 105 LIBCLOG_ENTER("hmod=%tx pvOS=%p fFlags=%#x pArgs=%p\n", hmod, pvOS, fFlags, (void *)pArgs); 106 LIBC_ASSERT(!(fFlags & __LIBC_INIT_FLAGS_PROCESS)); 105 107 106 108 /* Flag that we've been called. */ … … 111 113 * Do normal CRT init - necessary for static linking. 112 114 */ 115 fFlags |= __LIBC_INIT_FLAGS_PROCESS; 113 116 int rc = __libc_init(hmod, pvOS, fFlags); 114 117 if (rc) … … 135 138 * @param pvOS OS specific argument. 136 139 * @param fFlags Initialization flags, a combination of the __LIBC_INIT_FLAGS_* \#defines. 140 * __LIBC_INIT_FLAGS_PROCESS is set when doing the process init call (__libc_InitExe). 137 141 */ 138 142 static int __libc_init(uintptr_t hmod, void *pvOS, unsigned fFlags) … … 212 216 /** 213 217 * LIBC termination entry point used by an 'exit' function. 214 * 218 * 215 219 * This call is 'paired' with the __libc_InitExe call. 216 220 */ … … 225 229 LIBC_ASSERTM(cRefs >= 0, "cRefs=%d\n", cRefs); 226 230 if (cRefs >= 0) 227 __libc_term(0, NULL, 0);231 __libc_term(0, NULL, __LIBC_INIT_FLAGS_PROCESS); 228 232 229 233 LIBCLOG_RETURN_MSG_VOID("ret void (g_cExecUsers=%d)\n", cRefs); … … 242 246 * When invoked via _exit() it's NULL. 243 247 * @param fFlags Initialization flags, a combination of the __LIBC_INIT_FLAGS_* \#defines. 244 * When invoked via _exit() it's 0.248 * When invoked via _exit() it's __LIBC_INIT_FLAGS_PROCESS. 245 249 */ 246 250 static void __libc_term(uintptr_t hmod, void *pvOS, unsigned fFlags)
Note:
See TracChangeset
for help on using the changeset viewer.