Changeset 3906
- Timestamp:
- Oct 24, 2014, 1:50:44 AM (11 years ago)
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/libc-0.6/src/emx/include/os2emx.h
r3839 r3906 13347 13347 13348 13348 13349 /* --------------------- FS Save/Load/Restoremacros ---------------------- */13350 13351 #if defined(INCL_FSMACROS) 13349 /* --------------------- Register preservation macros ---------------------- */ 13350 13351 #if defined(INCL_FSMACROS) || defined(INCL_PRESERVE_REGISTER_MACROS) 13352 13352 13353 13353 #ifndef FS_DISABLED … … 13364 13364 #endif 13365 13365 13366 #endif /* INCL_FSMACROS */13367 13368 #if defined(INCL_FPCWMACROS) 13369 13370 #ifndef F SCW_DISABLED13366 #endif /* INCL_FSMACROS || INCL_PRESERVE_REGISTER_MACROS */ 13367 13368 #if defined(INCL_FPCWMACROS) || defined(INCL_PRESERVE_REGISTER_MACROS) 13369 13370 #ifndef FPCW_DISABLED 13371 13371 #define FSCW_VAR() volatile unsigned __fpcw__; 13372 13372 #define FSCW_SAVE() __asm__ __volatile__ ("fnstcw %0;" : : "m" (__fpcw__) ) … … 13378 13378 #endif 13379 13379 13380 #endif /* INCL_FPCWMACROS */ 13380 #endif /* INCL_FPCWMACROS || INCL_PRESERVE_REGISTER_MACROS */ 13381 13382 #if defined(INCL_PRESERVE_REGISTER_MACROS) || (defined(INCL_FSMACROS) && defined(INCL_FPCWMACROS)) 13383 # define PRESERVE_REGS_SAVE_LOAD_SAFE() FS_VAR(); FSCW_VAR(); PRESERVE_REGS_SAVE_LOAD_SAFE_AGAIN() 13384 # define PRESERVE_REGS_SAVE_LOAD_SAFE_AGAIN() do { FS_SAVE_LOAD(); FSCW_SAVE(); } while (0) 13385 # define PRESERVE_REGS_RESTORE() do { FSCW_RESTORE(); FS_RESTORE(); } while (0) 13386 #endif 13387 13381 13388 13382 13389 -
branches/libc-0.6/src/emx/src/lib/sys/DosFreeModuleEx.c
r2254 r3906 4 4 * DosFreeModuleEx. 5 5 * 6 * Copyright (c) 2004 knut st. osmundsen <bird-srcspam@anduin.net>6 * Copyright (c) 2004-2014 knut st. osmundsen <bird-srcspam@anduin.net> 7 7 * 8 8 * … … 31 31 #define INCL_ERRORS 32 32 #define INCL_DOSMODULEMGR 33 #define INCL_ FSMACROS33 #define INCL_PRESERVE_REGISTER_MACROS 34 34 #define INCL_EXAPIS 35 35 #include <os2emx.h> … … 45 45 { 46 46 LIBCLOG_ENTER("hmod=%lx\n", hmod); 47 int rc; 48 FS_VAR(); 47 int rc; 49 48 50 49 /* … … 57 56 * Free module. 58 57 */ 59 FS_SAVE_LOAD();60 58 rc = __libc_dosexFree(DOSEX_TYPE_LOAD_MODULE, (unsigned)hmod); 61 59 if (rc == -1) 60 { 61 PRESERVE_REGS_SAVE_LOAD_SAFE(); 62 62 rc = DosFreeModule(hmod); 63 FS_RESTORE(); 63 PRESERVE_REGS_RESTORE(); 64 } 64 65 if (!rc) 65 66 LIBCLOG_RETURN_INT(rc); -
branches/libc-0.6/src/emx/src/lib/sys/DosLoadModuleEx.c
r2254 r3906 4 4 * DosCreateEventSemEx. 5 5 * 6 * Copyright (c) 2004 knut st. osmundsen <bird-srcspam@anduin.net>6 * Copyright (c) 2004-2014 knut st. osmundsen <bird-srcspam@anduin.net> 7 7 * 8 8 * … … 31 31 #define INCL_ERRORS 32 32 #define INCL_DOSMODULEMGR 33 #define INCL_ FSMACROS33 #define INCL_PRESERVE_REGISTER_MACROS 34 34 #define INCL_EXAPIS 35 35 #include <os2emx.h> … … 50 50 HMODULE hmte; 51 51 int rc; 52 FS_VAR();53 52 54 53 /* 55 54 * Create the semaphore. 56 55 */ 57 FS_SAVE_LOAD();56 PRESERVE_REGS_SAVE_LOAD_SAFE(); 58 57 rc = DosLoadModule(pszObject, cbObject, pszModule, phmod); 58 PRESERVE_REGS_RESTORE(); 59 59 if (rc) 60 {61 FS_RESTORE();62 60 LIBCLOG_ERROR_RETURN_INT(rc); 63 }64 61 65 62 /* … … 82 79 if (!pDosEx) 83 80 { 81 PRESERVE_REGS_SAVE_LOAD_SAFE_AGAIN(); 84 82 DosFreeModule(hmte); 85 FS_RESTORE();83 PRESERVE_REGS_RESTORE(); 86 84 LIBCLOG_ERROR_RETURN_INT(ERROR_NOT_ENOUGH_MEMORY); 87 85 } … … 94 92 } 95 93 96 FS_RESTORE();97 94 LIBCLOG_RETURN_MSG(0, "ret 0 *phmod=%#lx\n", hmte); 98 95 } -
branches/libc-0.6/src/emx/src/lib/sys/__read.c
r3776 r3906 3 3 4 4 #include "libc-alias.h" 5 #define INCL_FSMACROS 6 #define INCL_FPCWMACROS 5 #define INCL_PRESERVE_REGISTER_MACROS 7 6 #define INCL_ERRORS 8 7 #include <os2emx.h> … … 41 40 */ 42 41 void *pvBuf_safe = NULL; 43 FS_VAR();44 FSCW_VAR();45 42 46 43 /* … … 60 57 } 61 58 62 FS_SAVE_LOAD(); 63 FSCW_SAVE(); 59 PRESERVE_REGS_SAVE_LOAD_SAFE(); 64 60 rc = DosRead(handle, pvBuf_safe ? pvBuf_safe : buf, cbToRead, &cbRead); 65 FSCW_RESTORE(); 66 FS_RESTORE(); 61 PRESERVE_REGS_RESTORE(); 67 62 if (pvBuf_safe) 68 63 { -
branches/libc-0.6/src/emx/src/lib/sys/__write.c
r2647 r3906 3 3 4 4 #include "libc-alias.h" 5 #define INCL_FSMACROS 6 #define INCL_FPCWMACROS 5 #define INCL_PRESERVE_REGISTER_MACROS 7 6 #define INCL_ERRORS 8 7 #include <os2emx.h> … … 24 23 int rc; 25 24 ULONG cbWritten; 26 FS_VAR();27 FSCW_VAR();28 29 25 30 26 /* … … 71 67 } 72 68 73 FS_SAVE_LOAD(); 74 FSCW_SAVE(); 69 PRESERVE_REGS_SAVE_LOAD_SAFE(); 75 70 rc = DosWrite(handle, buf, cbToWrite, &cbWritten); 76 FSCW_RESTORE(); 77 FS_RESTORE(); 71 PRESERVE_REGS_RESTORE(); 78 72 79 73 if (pvBuf_safe) -
trunk/libc/include/klibc/os2/os2.h
r3897 r3906 4 4 * Wrapper for the OS/2 API headers. 5 5 * 6 * Copyright (c) 2006 knut st. osmundsen <bird@innotek.de>6 * Copyright (c) 2006-2014 knut st. osmundsen <bird@innotek.de> 7 7 * 8 8 * … … 36 36 #define INCL_FSMACROS 37 37 #define INCL_FPCWMACROS 38 #define INCL_PRESERVE_REGISTER_MACROS 38 39 #define INCL_EXAPIS 39 40 -
trunk/libc/include/os2emx.h
r3897 r3906 13350 13350 13351 13351 13352 /* --------------------- FS Save/Load/Restoremacros ---------------------- */13353 13354 #if defined(INCL_FSMACROS) 13352 /* --------------------- Register preservation macros ---------------------- */ 13353 13354 #if defined(INCL_FSMACROS) || defined(INCL_PRESERVE_REGISTER_MACROS) 13355 13355 13356 13356 #ifndef FS_DISABLED … … 13384 13384 #endif 13385 13385 13386 #endif /* INCL_FSMACROS */13387 13388 #if defined(INCL_FPCWMACROS) 13386 #endif /* INCL_FSMACROS || INCL_PRESERVE_REGISTER_MACROS */ 13387 13388 #if defined(INCL_FPCWMACROS) || defined(INCL_PRESERVE_REGISTER_MACROS) 13389 13389 13390 13390 #ifndef FSCW_DISABLED … … 13412 13412 #endif 13413 13413 13414 #endif /* INCL_FPCWMACROS */ 13414 #endif /* INCL_FPCWMACROS || INCL_PRESERVE_REGISTER_MACROS */ 13415 13416 #if defined(INCL_PRESERVE_REGISTER_MACROS) || (defined(INCL_FSMACROS) && defined(INCL_FPCWMACROS)) 13417 # define PRESERVE_REGS_SAVE_LOAD_SAFE() FS_VAR(); FSCW_VAR(); PRESERVE_REGS_SAVE_LOAD_SAFE_AGAIN() 13418 # define PRESERVE_REGS_SAVE_LOAD_SAFE_AGAIN() do { FS_SAVE_LOAD(); FSCW_SAVE(); } while (0) 13419 # define PRESERVE_REGS_RESTORE() do { FSCW_RESTORE(); FS_RESTORE(); } while (0) 13420 #endif 13415 13421 13416 13422 -
trunk/libc/src/kNIX/os2/DosFreeModuleEx.c
r3862 r3906 4 4 * kNIX - DosFreeModuleEx. 5 5 * 6 * Copyright (c) 2004-20 06knut st. osmundsen <bird-src-spam@anduin.net>6 * Copyright (c) 2004-2014 knut st. osmundsen <bird-src-spam@anduin.net> 7 7 * 8 8 * … … 37 37 LIBCLOG_ENTER("hmod=%lx\n", hmod); 38 38 int rc; 39 FS_VAR();40 39 41 40 /* … … 48 47 * Free module. 49 48 */ 50 FS_SAVE_LOAD();51 49 rc = __libc_dosexFree(DOSEX_TYPE_LOAD_MODULE, (unsigned)hmod); 52 50 if (rc == -1) 51 { 52 PRESERVE_REGS_SAVE_LOAD_SAFE(); 53 53 rc = DosFreeModule(hmod); 54 FS_RESTORE(); 54 PRESERVE_REGS_RESTORE(); 55 } 55 56 if (!rc) 56 57 LIBCLOG_RETURN_INT(rc); -
trunk/libc/src/kNIX/os2/DosLoadModuleEx.c
r3862 r3906 2 2 /** @file 3 3 * 4 * kNIX - Dos CreateEventSemEx.4 * kNIX - DosLoadModuleEx. 5 5 * 6 * Copyright (c) 2004-20 06knut st. osmundsen <bird-src-spam@anduin.net>6 * Copyright (c) 2004-2014 knut st. osmundsen <bird-src-spam@anduin.net> 7 7 * 8 8 * … … 25 25 */ 26 26 27 #define INCL_PRESERVE_REGISTER_MACROS 27 28 #include "kNIX.h" 28 29 #include "DosEx.h" … … 42 43 HMODULE hmte; 43 44 int rc; 44 FS_VAR();45 45 46 46 /* 47 47 * Create the semaphore. 48 48 */ 49 FS_SAVE_LOAD();49 PRESERVE_REGS_SAVE_LOAD_SAFE(); 50 50 rc = DosLoadModule(pszObject, cbObject, pszModule, phmod); 51 PRESERVE_REGS_RESTORE(); 51 52 if (rc) 52 {53 FS_RESTORE();54 53 LIBCLOG_ERROR_RETURN_INT(rc); 55 }56 54 57 55 /* … … 74 72 if (!pDosEx) 75 73 { 74 PRESERVE_REGS_SAVE_LOAD_SAFE_AGAIN(); 76 75 DosFreeModule(hmte); 77 FS_RESTORE();76 PRESERVE_REGS_RESTORE(); 78 77 LIBCLOG_ERROR_RETURN_INT(ERROR_NOT_ENOUGH_MEMORY); 79 78 } … … 86 85 } 87 86 88 FS_RESTORE();89 87 LIBCLOG_RETURN_MSG(0, "ret 0 *phmod=%#lx\n", hmte); 90 88 } -
trunk/libc/src/kNIX/os2/fhOS2File.c
r3861 r3906 84 84 { 85 85 LIBCLOG_ENTER("pFH=%p:{.fh=%d} pvBuf=%p cbToRead=%zu pcbRead=%p\n", pFH, pFH->fh, pvBuf, cbToRead, pcbRead); 86 FS_VAR_SAVE_LOAD();87 FSCW_VAR();88 FSCW_SAVE();89 86 90 87 /* … … 92 89 * Allocate a buffer in the low heap. 93 90 */ 91 PRESERVE_REGS_SAVE_LOAD_SAFE(); 94 92 int rc; 95 93 ULONG cbActuallyRead = 0; … … 110 108 else 111 109 rc = DosRead(pFH->hNative, pvBuf, cbToRead, &cbActuallyRead); 112 110 PRESERVE_REGS_RESTORE(); 113 111 114 112 /* deal with the return code. */ … … 136 134 { 137 135 LIBCLOG_ENTER("pFH=%p:{.fh=%d} pvBuf=%p cbToWrite=%zu pcbWritten=%p\n", pFH, pFH->fh, pvBuf, cbToWrite, (void *)pcbWritten); 138 FS_VAR_SAVE_LOAD();139 FSCW_VAR();140 FSCW_SAVE();141 136 142 137 /* … … 144 139 * Allocate a buffer in the low heap. 145 140 */ 141 PRESERVE_REGS_SAVE_LOAD_SAFE(); 146 142 int rc; 147 143 ULONG cbActuallyWritten = 0; … … 161 157 else 162 158 rc = DosWrite(pFH->hNative, pvBuf, cbToWrite, &cbActuallyWritten); 159 PRESERVE_REGS_RESTORE(); 163 160 164 161 /* deal with the return code. */
Note:
See TracChangeset
for help on using the changeset viewer.