Changeset 3861 for trunk


Ignore:
Timestamp:
Jun 26, 2014, 2:12:11 PM (11 years ago)
Author:
bird
Message:

More watcom compilation changes & fixes.

Location:
trunk/libc
Files:
3 added
2 deleted
34 edited
3 copied

Legend:

Unmodified
Added
Removed
  • trunk/libc/Config.kmk

    r3845 r3861  
    9393 TEMPLATE_libc_CFLAGS.os2 = $(TEMPLATE_lib_CFLAGS.os2)
    9494 TEMPLATE_libc_CFLAGS.release = $(TEMPLATE_lib_CFLAGS.release)
     95 TEMPLATE_libc_ASTOOL  = $(TEMPLATE_libcasm_ASTOOL)
     96 TEMPLATE_libc_ASFLAGS = $(TEMPLATE_libcasm_ASFLAGS)
    9597else
    9698 TEMPLATE_libc_TOOL = GCC3
     
    123125
    124126
    125 # Intel assembly libs (default templates uses AT&T assembly).
     127# Intel assembly libs (default templates uses AT&T assembly with gcc).
    126128
    127129TEMPLATE_libcasm = .
  • trunk/libc/include/386/builtin.h

    r3860 r3861  
    535535
    536536
    537 #ifndef __WATCOMC__ /** @todo port me later. */
    538537/**
    539538 * Atomically compare and exchange a 32-bit word.
     
    544543 * @param   u32Cur  The current value. Only update if *pu32 equals this one.
    545544 */
     545#ifdef __WATCOMC__
     546unsigned __atomic_cmpxchg32(volatile uint32_t *pu32, uint32_t u32New, uint32_t u32Old);
     547# pragma aux __atomic_cmpxchg32 = \
     548    "lock cmpxchg [edx], ecx" \
     549    "setz  al" \
     550    "movzx eax, al" \
     551    parm [edx] [ecx] [eax]  value [eax]
     552#else
    546553static inline unsigned __atomic_cmpxchg32(volatile uint32_t *pu32, uint32_t u32New, uint32_t u32Old)
    547554{
     555# ifdef _MSC_VER
     556    uint32_t uOrg = _InterlockedCompareExchange((long volatile *)pu32, u32New, u32Old)
     557    return uOrg == u32Old;
     558# else
    548559    __asm__ __volatile__("lock; cmpxchgl %2, %1\n\t"
    549560                         "setz  %%al\n\t"
     
    553564                         : "r"  (u32New),
    554565                           "0" (u32Old));
    555     return (unsigned)u32Old;
    556 }
    557 
    558 
     566    return u32Old;
     567# endif
     568}
     569#endif
     570
     571
     572#ifndef __WATCOMC__ /** @todo port me later. */
    559573/**
    560574 * Atomically compare and exchange a pointer.
  • trunk/libc/include/InnoTekLIBC/fork.h

    r3860 r3861  
    525525 * @param   pfnCallback     Callback function. See __LIBC_PFNFORKCALLBACK for prototype.
    526526 */
    527 #ifdef __WATCOMC__
    528 # define _FORK_PARENT1(uPriority, pfnCallback) \
    529     static const __LIBC_FORKCALLBACK _FORK_DATA_USED() __fork_parent1_##pfnCallback = { pfnCallback, uPriority }; \
    530     const __LIBC_FORKCALLBACK * __based(__segname("forkpar1")) __fork_parent1_ptr_##pfnCallback = &__fork_parent1_##pfnCallback
    531 
    532 #elif defined(_MSC_VER)
    533 # define _FORK_PARENT1(uPriority, pfnCallback) \
    534     __Pragma(section("forkpar1", read, write)); \
    535     static const __LIBC_FORKCALLBACK _FORK_DATA_USED() __fork_parent1_##pfnCallback = { pfnCallback, uPriority }; \
    536     const __LIBC_FORKCALLBACK * __declspec(allocate("forkpar1")) __fork_parent1_ptr_##pfnCallback = &__fork_parent1_##pfnCallback
    537 
    538 #else
    539 # define _FORK_PARENT1(uPriority, pfnCallback) \
    540     static const __LIBC_FORKCALLBACK _FORK_DATA_USED() __fork_parent1_##pfnCallback = \
    541     { pfnCallback, uPriority + (unsigned)(&__fork_parent1_##pfnCallback - &__fork_parent1_##pfnCallback) }; \
    542     __asm__ (".stabs \"___fork_parent1__\", 23, 0, 0, ___fork_parent1_" #pfnCallback)
    543 #endif
    544527
    545528/** @def _FORK_CHILD1
     
    552535 * @param   pfnCallback     Callback function. See __LIBC_PFNFORKCALLBACK for prototype.
    553536 */
    554 #ifdef __WATCOMC__
    555 # define _FORK_CHILD1(uPriority, pfnCallback) \
     537#ifdef __OS2__
     538# ifdef __WATCOMC__
     539#  define _FORK_PARENT1(uPriority, pfnCallback) \
     540    static const __LIBC_FORKCALLBACK _FORK_DATA_USED() __fork_parent1_##pfnCallback = { pfnCallback, uPriority }; \
     541    const __LIBC_FORKCALLBACK * __based(__segname("SET2___fork_parent1__")) __fork_parent1_ptr_##pfnCallback = &__fork_parent1_##pfnCallback
     542#  define _FORK_CHILD1(uPriority, pfnCallback) \
     543    static const __LIBC_FORKCALLBACK _FORK_DATA_USED() __fork_parent1_##pfnCallback = { pfnCallback, uPriority }; \
     544    const __LIBC_FORKCALLBACK * __based(__segname("SET2___fork_child1__")) __fork_parent1_ptr_##pfnCallback = &__fork_parent1_##pfnCallback
     545# else
     546#  define _FORK_PARENT1(uPriority, pfnCallback) \
     547    static const __LIBC_FORKCALLBACK _FORK_DATA_USED() __fork_parent1_##pfnCallback = \
     548    { pfnCallback, uPriority + (unsigned)(&__fork_parent1_##pfnCallback - &__fork_parent1_##pfnCallback) }; \
     549    __asm__ (".stabs \"___fork_parent1__\", 23, 0, 0, ___fork_parent1_" #pfnCallback)
     550#  define _FORK_CHILD1(uPriority, pfnCallback) \
     551    static const __LIBC_FORKCALLBACK _FORK_DATA_USED() __fork_child1_##pfnCallback  = { pfnCallback, uPriority + (unsigned)(&__fork_child1_##pfnCallback - &__fork_child1_##pfnCallback) }; \
     552    __asm__ (".stabs \"___fork_child1__\",  23, 0, 0, ___fork_child1_" #pfnCallback )
     553# endif
     554
     555#elif defined(__NT__) || defined(__WIN32__) || defined(__WIN64__)
     556# ifdef __WATCOMC__
     557#  define _FORK_PARENT1(uPriority, pfnCallback) \
     558    static const __LIBC_FORKCALLBACK _FORK_DATA_USED() __fork_parent1_##pfnCallback = { pfnCallback, uPriority }; \
     559    const __LIBC_FORKCALLBACK * __based(__segname("forkpar1")) __fork_parent1_ptr_##pfnCallback = &__fork_parent1_##pfnCallback
     560#  define _FORK_CHILD1(uPriority, pfnCallback) \
    556561    static const __LIBC_FORKCALLBACK _FORK_DATA_USED() __fork_child1_##pfnCallback = { pfnCallback, uPriority }; \
    557562    const __LIBC_FORKCALLBACK * __based(__segname("forkcld1")) __fork_child1_ptr_##pfnCallback = &__fork_child1_##pfnCallback
    558563
    559 #elif defined(_MSC_VER)
    560 # define _FORK_CHILD1(uPriority, pfnCallback) \
     564# elif defined(_MSC_VER)
     565#  define _FORK_PARENT1(uPriority, pfnCallback) \
    561566    __Pragma(section("forkpar1", read, write)); \
     567    static const __LIBC_FORKCALLBACK _FORK_DATA_USED() __fork_parent1_##pfnCallback = { pfnCallback, uPriority }; \
     568    const __LIBC_FORKCALLBACK * __declspec(allocate("forkpar1")) __fork_parent1_ptr_##pfnCallback = &__fork_parent1_##pfnCallback
     569#  define _FORK_CHILD1(uPriority, pfnCallback) \
     570    __Pragma(section("forkcld1", read, write)); \
    562571    static const __LIBC_FORKCALLBACK _FORK_DATA_USED() __fork_child1_##pfnCallback = { pfnCallback, uPriority }; \
    563572    const __LIBC_FORKCALLBACK * __declspec(allocate("forkcld1")) __fork_child1_ptr_##pfnCallback = &__fork_child1_##pfnCallback
    564573
     574# else
     575#  error "Port me"
     576# endif
    565577#else
    566 # define _FORK_CHILD1(uPriority, pfnCallback) \
    567     static const __LIBC_FORKCALLBACK _FORK_DATA_USED() __fork_child1_##pfnCallback  = { pfnCallback, uPriority + (unsigned)(&__fork_child1_##pfnCallback - &__fork_child1_##pfnCallback) }; \
    568     __asm__ (".stabs \"___fork_child1__\",  23, 0, 0, ___fork_child1_" #pfnCallback )
     578# error "Port me"
    569579#endif
    570580
  • trunk/libc/include/emx/startup.h

    r3804 r3861  
    5656 * Arrange that FUN will be called by _CRT_term(). */
    5757#ifdef __OS2__
    58 # define _CRT_INIT1(fun) __asm__ (".stabs \"___crtinit1__\", 23, 0, 0, _" #fun);
    59 # define _CRT_EXIT1(fun) __asm__ (".stabs \"___crtexit1__\", 23, 0, 0, _" #fun);
    60 #elif defined(__NT__)
    61 # define _CRT_INIT1(fun) void *__crtinit1__##fun##__  __attribute__((__section__("crtinit1"))) = (void *)fun;
    62 # define _CRT_EXIT1(fun) void *__crtexit1__##fun##__  __attribute__((__section__("crtexit1"))) = (void *)fun;
     58# ifdef __WATCOMC__
     59#  define _CRT_INIT1(fun) void * __based(__segname("SET2___crtinit1__")) __crtinit1__##fun##__ = (void *)fun
     60#  define _CRT_EXIT1(fun) void * __based(__segname("SET2___crtexit1__")) __crtexit1__##fun##__ = (void *)fun
     61# else
     62#  define _CRT_INIT1(fun) __asm__ (".stabs \"___crtinit1__\", 23, 0, 0, _" #fun)
     63#  define _CRT_EXIT1(fun) __asm__ (".stabs \"___crtexit1__\", 23, 0, 0, _" #fun)
     64# endif
     65#elif defined(__NT__) || defined(__WIN32__) || defined(__WIN64__)
     66# ifdef __WATCOMC__
     67#  define _CRT_INIT1(fun) void * __based(__segname("crtinit1")) __crtinit1__##fun##__ = (void *)fun
     68#  define _CRT_EXIT1(fun) void * __based(__segname("crtexit1")) __crtexit1__##fun##__ = (void *)fun
     69# elif defined(_MSC_VER)
     70#  define _CRT_INIT1(fun) __declspec(allocate("crtinit1")) void * __crtinit1__##fun##__ = (void *)fun
     71#  define _CRT_EXIT1(fun) __declspec(allocate("crtexit1")) void * __crtexit1__##fun##__ = (void *)fun
     72# else
     73#  define _CRT_INIT1(fun) void *__crtinit1__##fun##__  __attribute__((__section__("crtinit1"))) = (void *)fun
     74#  define _CRT_EXIT1(fun) void *__crtexit1__##fun##__  __attribute__((__section__("crtexit1"))) = (void *)fun
     75# endif
    6376#else
    6477# error "port me"
  • trunk/libc/include/klibc/logstrict.h

    r2918 r3861  
    7272#endif
    7373
     74/** Function name macro. */
     75#ifdef __GNUC__
     76# define __LIBCLOG_FUNC_NM __PRETTY_FUNCTION__
     77#else
     78# define __LIBCLOG_FUNC_NM __FUNCTION__
     79#endif
     80
    7481
    7582/** Macro to, in release mode too, log a generic message within a function. */
    7683#define LIBCLOG_REL(...) \
    77     __libc_LogMsg(~0, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__)
     84    __libc_LogMsg(~0, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __LIBCLOG_FUNC_NM, __VA_ARGS__)
    7885
    7986
     
    8188#ifdef DEBUG_LOGGING
    8289# define LIBCLOG_ENTER(...) \
    83     unsigned __libclog_uEnterTS__ = __libc_LogEnter(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__)
     90    unsigned __libclog_uEnterTS__ = __libc_LogEnter(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __LIBCLOG_FUNC_NM, __VA_ARGS__)
    8491#else
    8592# define LIBCLOG_ENTER(...)      //...
     
    8996#ifdef DEBUG_LOGGING
    9097# define LIBCLOG_MSG(...) \
    91     __libc_LogMsg(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__)
     98    __libc_LogMsg(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __LIBCLOG_FUNC_NM, __VA_ARGS__)
    9299#else
    93100# define LIBCLOG_MSG(...)        ((void)0)
     
    97104#ifdef DEBUG_LOGGING
    98105# define LIBCLOG_MSG2(...) \
    99     __libc_LogMsg(~0, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__)
     106    __libc_LogMsg(~0, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __LIBCLOG_FUNC_NM, __VA_ARGS__)
    100107#else
    101108# define LIBCLOG_MSG2(...)       ((void)0)
     
    105112#ifdef DEBUG_LOGGING
    106113# define LIBCLOG_ERROR(...) \
    107     __libc_LogError(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
     114    __libc_LogError(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __LIBCLOG_FUNC_NM, __FILE__, __LINE__, __VA_ARGS__)
    108115#else
    109116# define LIBCLOG_ERROR(...)      ((void)0)
     
    113120#ifdef DEBUG_LOGGING
    114121# define LIBCLOG_ERROR2(...) \
    115     __libc_LogError(~0, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
     122    __libc_LogError(~0, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __LIBCLOG_FUNC_NM, __FILE__, __LINE__, __VA_ARGS__)
    116123#else
    117124# define LIBCLOG_ERROR2(...)     ((void)0)
     
    121128#ifdef DEBUG_LOGGING
    122129# define LIBCLOG_ERROR_CHECK(expr, ...) \
    123     (!(expr) ? __libc_LogError(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) : ((void)0) )
     130    (!(expr) ? __libc_LogError(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __LIBCLOG_FUNC_NM, __FILE__, __LINE__, __VA_ARGS__) : ((void)0) )
    124131#else
    125132# define LIBCLOG_ERROR_CHECK(expr, ...) ((void)0)
     
    129136#ifdef DEBUG_LOGGING
    130137# define LIBCLOG_ERROR2_CHECK(expr, ...) \
    131     (!(expr) ? __libc_LogError(~0, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, __VA_ARGS__) : ((void)0) )
     138    (!(expr) ? __libc_LogError(~0, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __LIBCLOG_FUNC_NM, __FILE__, __LINE__, __VA_ARGS__) : ((void)0) )
    132139#else
    133140# define LIBCLOG_ERROR2_CHECK(expr, ...) ((void)0)
     
    145152#ifdef DEBUG_LOGGING
    146153# define LIBCLOG_LEAVE(...) \
    147     __libc_LogLeave(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __VA_ARGS__)
     154    __libc_LogLeave(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __LIBCLOG_FUNC_NM, __VA_ARGS__)
    148155#else
    149156# define LIBCLOG_LEAVE(...)      ((void)0)
     
    176183#ifdef DEBUG_LOGGING
    177184# define LIBCLOG_ERROR_LEAVE(...) \
    178     __libc_LogErrorLeave(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, __VA_ARGS__)
     185    __libc_LogErrorLeave(__libclog_uEnterTS__, __LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __LIBCLOG_FUNC_NM, __FILE__, __LINE__, __VA_ARGS__)
    179186#else
    180187# define LIBCLOG_ERROR_LEAVE(...)      ((void)0)
     
    328335#ifdef __LIBC_STRICT
    329336# define LIBC_ASSERT(expr) ((expr) ? (void)0 \
    330     : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #expr, NULL))
     337    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __LIBCLOG_FUNC_NM, __FILE__, __LINE__, #expr, NULL))
    331338#else
    332339# define LIBC_ASSERT(expr) ((void)0)
     
    337344 */
    338345#ifdef __LIBC_STRICT
    339 # define LIBC_ASSERT_FAILED() __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, "0", NULL)
     346# define LIBC_ASSERT_FAILED() __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __LIBCLOG_FUNC_NM, __FILE__, __LINE__, "0", NULL)
    340347#else
    341348# define LIBC_ASSERT_FAILED() ((void)0)
     
    348355#ifdef __LIBC_STRICT
    349356# define LIBC_ASSERT_MEM_R(pv, cb) (__libc_StrictMemoryR((pv), (cb)) ? (void)0 \
    350     : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #pv "; " #cb, \
     357    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __LIBCLOG_FUNC_NM, __FILE__, __LINE__, #pv "; " #cb, \
    351358                       "Memory buffer at %p of %d bytes isn't readable!\n", (pv), (cb)))
    352359#else
     
    360367#ifdef __LIBC_STRICT
    361368# define LIBC_ASSERT_MEM_RW(pv, cb) (__libc_StrictMemoryRW((pv), (cb)) ? (void)0 \
    362     : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #pv "; " #cb, \
     369    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __LIBCLOG_FUNC_NM, __FILE__, __LINE__, #pv "; " #cb, \
    363370                       "Memory buffer at %p of %d bytes isn't readable and writable!\n", (pv), (cb)))
    364371#else
     
    371378#ifdef __LIBC_STRICT
    372379# define LIBC_ASSERT_STR(psz) (__libc_StrictStringR((psz), ~0) ? (void)0 \
    373     : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #psz, \
     380    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __LIBCLOG_FUNC_NM, __FILE__, __LINE__, #psz, \
    374381                       "String at %p isn't readable!\n", (psz)))
    375382#else
     
    383390#ifdef __LIBC_STRICT
    384391# define LIBC_ASSERT_NSTR(psz, cchMax) (__libc_StrictStringR((psz), cchMax) ? (void)0 \
    385     : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #psz " " #cchMax, \
     392    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __LIBCLOG_FUNC_NM, __FILE__, __LINE__, #psz " " #cchMax, \
    386393                       "String at %p of maximum %d bytes isn't readable!\n", (psz), (cchMax)))
    387394#else
     
    396403#ifdef __LIBC_STRICT
    397404# define LIBC_ASSERTM(expr, ...) ((expr) ? (void)0 \
    398     : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #expr, \
     405    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __LIBCLOG_FUNC_NM, __FILE__, __LINE__, #expr, \
    399406                       __VA_ARGS__))
    400407#else
     
    407414 */
    408415#ifdef __LIBC_STRICT
    409 # define LIBC_ASSERTM_FAILED(...) __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, "0", __VA_ARGS__)
     416# define LIBC_ASSERTM_FAILED(...) __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __LIBCLOG_FUNC_NM, __FILE__, __LINE__, "0", __VA_ARGS__)
    410417#else
    411418# define LIBC_ASSERTM_FAILED(...) ((void)0)
     
    418425#ifdef __LIBC_STRICT
    419426# define LIBC_ASSERTM_MEM_R(pv, cb, ...) (__libc_StrictMemoryR((pv), (cb)) ? (void)0 \
    420     : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #pv "; " #cb, \
     427    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __LIBCLOG_FUNC_NM, __FILE__, __LINE__, #pv "; " #cb, \
    421428                       __VA_ARGS__))
    422429#else
     
    430437#ifdef __LIBC_STRICT
    431438# define LIBC_ASSERTM_MEM_RW(pv, cb, ...) (__libc_StrictMemoryRW((pv), (cb)) ? (void)0 \
    432     : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #pv "; " #cb, \
     439    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __LIBCLOG_FUNC_NM, __FILE__, __LINE__, #pv "; " #cb, \
    433440                       __VA_ARGS__))
    434441#else
     
    441448#ifdef __LIBC_STRICT
    442449# define LIBC_ASSERTM_STR(psz, ...) (__libc_StrictStringR((psz), ~0) ? (void)0 \
    443     : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #psz, \
     450    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __LIBCLOG_FUNC_NM, __FILE__, __LINE__, #psz, \
    444451                       __VA_ARGS__))
    445452#else
     
    453460#ifdef __LIBC_STRICT
    454461# define LIBC_ASSERTM_NSTR(psz, cchMax, ...) (__libc_StrictStringR((psz), cchMax) ? (void)0 \
    455     : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #psz " " #cchMax, \
     462    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __LIBCLOG_FUNC_NM, __FILE__, __LINE__, #psz " " #cchMax, \
    456463                       __VA_ARGS__))
    457464#else
  • trunk/libc/include/os2emx.h

    r3860 r3861  
    1339513395
    1339613396# elif defined(__WATCOMC__)
    13397 void FSCW_INTERNAL_SAVE(unsigned *);
     13397void FSCW_INTERNAL_SAVE(volatile unsigned *);
    1339813398#  pragma aux  FSCW_INTERNAL_SAVE = "fnstcw [edx]" parm [edx]
    13399 void FSCW_INTERNAL_RESTORE(unsigned *);
     13399void FSCW_INTERNAL_RESTORE(volatile unsigned *);
    1340013400#  pragma aux  FS_INTERNAL_RESTORE = "fldcw [edx]" parm [edx]
    1340113401#  define FSCW_VAR()        volatile unsigned __fpcw__;
  • trunk/libc/include/os2thunk.h

    r1517 r3861  
    1212
    1313typedef unsigned long _far16ptr;
    14 
    15 _far16ptr _libc_32to16 (void *ptr);
    16 void *_libc_16to32 (_far16ptr ptr);
     14extern _far16ptr _Optlink DosFlatToSel(void *ptr);
     15extern void    * _Optlink DosSelToFlat(_far16ptr ptr);
     16#define _libc_32to16 DosFlatToSel
     17#define _libc_16to32 DosSelToFlat
    1718
    1819typedef union _thunk_u
  • trunk/libc/include/sys/cdefs.h

    r3836 r3861  
    178178#endif
    179179
    180 /** @}  */
     180/** @} */
     181
     182/** @name Misc
     183 * @{ */
     184#ifdef __WATCOMC__
     185# define __KLIBC_BREAKPOINT()       __asm { int 3 }
     186# define __KLIBC_CLEAR_DIR_FLAG()   __asm { cld }
     187#elif defined(_MSC_VER)
     188# define __KLIBC_BREAKPOINT()       __debugbreak()
     189# define __KLIBC_CLEAR_DIR_FLAG()   __asm { cld }
     190#else
     191# define __KLIBC_BREAKPOINT()       __asm__ __volatile__ ("int3")
     192# define __KLIBC_CLEAR_DIR_FLAG()   __asm__ __volatile__ ("cld")
     193#endif
     194/** @} */
     195
    181196
    182197#endif
  • trunk/libc/include/sys/shm.h

    r1987 r3861  
    8686#define SHM_INFO        14
    8787
    88 #ifdef __EMX__
    89 typedef __uint32_t shmatt_t;
     88#ifdef __KLIBC__
     89typedef __int32_t shmatt_t;
    9090#endif
    9191
    9292struct shmid_ds {
    9393        struct ipc_perm shm_perm;       /* operation permission structure */
    94 #ifdef __EMX__
     94#ifdef __KLIBC__
    9595        size_t          shm_segsz;      /* size of segment in bytes */
    9696#else
     
    9999        pid_t           shm_lpid;   /* process ID of last shared memory op */
    100100        pid_t           shm_cpid;       /* process ID of creator */
    101 #ifdef __EMX__
     101#ifdef __KLIBC__
    102102        shmatt_t        shm_nattch;     /* number of current attaches */
    103103#else
     
    123123                shmall;         /* max amount of shared memory (pages) */
    124124};
    125 #ifndef __EMX__
     125#ifndef __KLIBC__
    126126extern struct shminfo   shminfo;
    127127extern struct shmid_ds  *shmsegs;
     
    137137};
    138138
    139 #ifndef __EMX__
     139#ifndef __KLIBC__
    140140struct thread;
    141141struct proc;
     
    144144void    shmexit(struct vmspace *);
    145145void    shmfork(struct proc *, struct proc *);
    146 #endif /* !__EMX__ */
     146#endif /* !__KLIBC__ */
    147147#else /* !_KERNEL */
    148148
     
    155155
    156156__BEGIN_DECLS
    157 #ifndef __EMX__
     157#ifndef __KLIBC__
    158158int shmsys(int, ...);
    159159#endif
  • trunk/libc/src/kNIX/Makefile.kmk

    r3857 r3861  
    9292    $(PATH_LIBC_SRC)/kNIX/os2/b_initDllLoadException.c \
    9393    $(PATH_LIBC_SRC)/kNIX/os2/__libc_back_envInit.c \
    94     $(PATH_LIBC_SRC)/kNIX/os2/386/__libc_back_envInitAsm.s \
    9594    $(PATH_LIBC_SRC)/kNIX/os2/b_dir.c \
    9695    $(PATH_LIBC_SRC)/kNIX/os2/b_fsDirChangeRoot.c \
     
    184183    $(PATH_LIBC_SRC)/kNIX/os2/tcpipver43.c \
    185184    $(PATH_LIBC_SRC)/kNIX/os2/timebomb.c \
    186     $(PATH_LIBC_SRC)/kNIX/os2/386/thunk0.s \
    187     $(PATH_LIBC_SRC)/kNIX/os2/386/thunk1.s \
    188     $(PATH_LIBC_SRC)/kNIX/os2/386/unwind.s \
    189185    $(PATH_LIBC_SRC)/kNIX/os2/_os2_bad.c \
    190186    $(PATH_LIBC_SRC)/kNIX/os2/__spawnve.c \
    191187    $(PATH_LIBC_SRC)/kNIX/os2/__read_kbd.c \
    192188    $(PATH_LIBC_SRC)/kNIX/os2/__select.c
     189ifdef CFG_LIBC_USE_WATCOM
     190 libc_kNIX_SOURCES.os2 += \
     191        $(PATH_LIBC_SRC)/kNIX/os2/386/__libc_back_envInitAsm.asm \
     192        $(PATH_LIBC_SRC)/kNIX/os2/386/thunk1.asm \
     193        $(PATH_LIBC_SRC)/kNIX/os2/386/unwind.asm
     194else
     195 libc_kNIX_SOURCES.os2 += \
     196        $(PATH_LIBC_SRC)/kNIX/os2/386/__libc_back_envInitAsm.s \
     197        $(PATH_LIBC_SRC)/kNIX/os2/386/thunk1.s \
     198        $(PATH_LIBC_SRC)/kNIX/os2/386/unwind.s
     199endif
     200
    193201TODO= \
    194202    $(PATH_LIBC_SRC)/kNIX/os2/__init.c \
     
    196204    $(PATH_LIBC_SRC)/kNIX/os2/__ioctl1.c \
    197205    $(PATH_LIBC_SRC)/kNIX/os2/__ioctl2.c \
    198     $(PATH_LIBC_SRC)/kNIX/os2/__select.c \
     206    $(PATH_LIBC_SRC)/kNIX/os2/__select.c
     207
    199208
    200209
  • trunk/libc/src/kNIX/os2/386/__libc_back_envInitAsm.asm

    • Property svn:executable deleted
    r3859 r3861  
    1 /* $Id$
    2  *
    3  * Assembly stuff used by __initdll.c
    4  *
    5  * Copyright (c) 2003 InnoTek Systemberatung GmbH
    6  * Author: knut st. osmundsen <bird-src-spam@anduin.net>
    7  *
    8  *
    9  * This file is part of Innotek LIBC.
    10  *
    11  * Innotek LIBC 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  * Innotek LIBC 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 Innotek LIBC; if not, write to the Free Software
    23  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    24  *
    25  */
     1; $Id$
     2;; @file
     3; Assembly stuff used by __initdll.c
     4;
     5; @copyright   Copyright (C) 2003-2014 knut st. osmundsen <bird-klibc-spam-xiv@anduin.net>
     6; @licenses    MIT, BSD2, BSD3, BSD4, LGPLv2.1, LGPLv3.
     7;
    268
    27 #include <emx/asm386.h>
    289
    29         .text
     10%include "klibc/os2/asmdefs.mac"
    3011
    31 /**
    32  * Initialize __org_environ and _STD(environ).
    33  *
    34  * @cproto  int __libc_back_envInitAsm(const char *pszzEnv);
    35  * @sketch Assumes large amounts of stack so we can construct the a reverse array there.
    36  *
    37  */
    38     .globl ___libc_back_envInitAsm
     12extern __hmalloc
     13extern __org_environ
     14extern _STD(environ)
     15
     16BEGIN_CODE32
     17
     18;;
     19; Initalizes the two global environment variable arrays _STD(environ) and
     20; __org_environ.
     21;
     22; @returns  0 on success, -1 on failure.
     23; @param    pszzEnv [ebp + 8]   Pointer to the OS/2 environment.
     24; @cproto   int __libc_back_envInitAsm(const char *pszzEnv);
     25; @remarks  Requires lots of stack.
     26;
     27global ___libc_back_envInitAsm
    3928___libc_back_envInitAsm:
    40     pushl   %ebp
    41     movl    %esp, %ebp
    42     pushl   %edi
    43     pushl   %esi
     29        push    ebp
     30        mov     esp, ebp
     31        push    edi
    4432
    45     /*
    46      * Init registers.
    47      */
    48     movl    %esp, %esi
    49     xorl    %eax, %eax
    50     xorl    %ecx, %ecx
    51     decl    %ecx
    52     movl    8(%ebp), %edi
    53     cld
     33        ;
     34        ; Build a reverse environment vector on the stack.
     35        ;
     36        mov     edi, [ebp + 8]          ; pszzEnv
     37        xor     eax, eax                ; eax = zero (for scab and terminator).
     38        cld                             ; paranoia
    5439
    55     /*
    56      * Scan loop.
    57      */
    58 env_loop:
    59     push    %edi
    60     repnz   scasb
    61     cmpb    %al, (%edi)
    62     jnz     env_loop
    63     push    %eax
     40        or      edi, edi                ; Just in case the environment block is empty.
     41        jnz     .build_reverse_done
     42        cmp     [edi], al
     43        jne     .build_reverse_done
    6444
    65     /*
    66      * Calculate array size and allocate it.
    67      */
    68     movl    %esi, %ecx
    69     subl    %esp, %ecx
    70     / _org_environ = _hmalloc(size);
    71     pushl   %ecx
    72     call    __hmalloc
    73     addl    $4, %esp
    74     orl     %eax, %eax
    75     jz      env_ret
    76     mov     %eax, __org_environ
     45        mov     ecx, -1                 ; Scan until zero terminator.
     46.build_reverse_loop:
     47        push    edi                     ; Push the variable pointer.
     48        repne   scasb
     49        cmp     [edi], al               ; More variables?
     50        jne     .build_reverse_loop
    7751
    78     /*
    79      * Do a reverse copy of the array on the stack.
    80      */
    81     movl    __org_environ, %edi
    82     movl    %edi, _STD(environ)
    83     movl    %esi, %edx
    84 env_copy:
    85     subl    $4, %edx
    86     movl    (%edx), %eax
    87     stosl
    88     orl     %eax, %eax
    89     jnz     env_copy
     52.build_reverse_done:
     53        push    eax                     ; Null terminator.
    9054
    91 env_ret:
    92     mov     %esi, %esp
    93     popl    %esi
    94     popl    %edi
    95     leave
    96     ret
     55        ;
     56        ; Allocate the environment vector.
     57        ;
     58        lea     ecx, [ebp - 4]          ; ebp - 4 is the end of the vector we built above.
     59        sub     ecx, esp
    9760
     61        push    ecx
     62        call    __hmalloc
     63        add     esp, 4
     64        or      eax, eax
     65        jz      .return_error
     66
     67        mov     [__org_environ], eax
     68        mov     [_STD(environ)], eax
     69
     70        ;
     71        ; Initialize the environment vector by copying the vector we built on
     72        ; the stack in reverse order.
     73        ;
     74        mov     edi, eax
     75        lea     edx, [ebp - 4]          ; end of array.
     76.reverse_copy:
     77        sub     edx, 4
     78        mov     eax, [edx]
     79        stosd
     80        or      eax, eax
     81        jnz     .reverse_copy
     82
     83.return:
     84        lea     esp, [ebp - 4]
     85        pop     edi
     86        leave
     87        ret
     88
     89.return_error:
     90        mov     eax, -1
     91        jmp     .return
     92
  • trunk/libc/src/kNIX/os2/386/__libc_back_envInitAsm.s

    • Property svn:executable deleted
  • trunk/libc/src/kNIX/os2/386/signal16bit.asm

    • Property svn:executable deleted
    r3626 r3861  
    2525;
    2626
     27%include "klibc/os2/asmdefs.mac"
     28
    2729extern Dos32TIB
    2830extern ___libc_back_signalOS2V1Handler32bit
    29 
    30 ;; move to header.
    31 segment CODE32 use32 flat align=16 public class=CODE
    32 segment DATA32 use32 align=16 public class=DATA
    33 segment SET1___fork_child1__ use32 align=4 public class=DATA
    34 segment SET2___fork_child1__ use32 align=4 public class=DATA
    35 segment SET3___fork_child1__ use32 align=4 public class=DATA
    36 segment BSS32  use32 align=16 public class=BSS
    37 group DGROUP DATA32 BSS32 SET1___fork_child1__ SET2___fork_child1__ SET3___fork_child1__
    38 segment CODE16 use16 align=16 public class=CODE
    3931
    4032
  • trunk/libc/src/kNIX/os2/386/thunk1.asm

    • Property svn:executable deleted
    r3859 r3861  
    1 / thunk1.asm (emx+gcc) -- Copyright (c) 1992-1994 by Eberhard Mattes
     1; $Id$
     2;; @file
     3; 16-bit thunks.
     4;
     5; @copyright   Copyright (c) 1992-1994 by Eberhard Mattes
     6;              Copyright (C) 2004-2014 knut st. osmundsen <bird-klibc-spam-xiv@anduin.net>
     7; @licenses    MIT, BSD2, BSD3, BSD4, LGPLv2.1, LGPLv3.
     8;
    29
    3                 .globl  __libc_thunk1
     10%include "klibc/os2/asmdefs.mac"
    411
    5 /
    6 / unsigned long _libc_thunk1 (void *args, void *fun)
    7 /
    8 / Call 16-bit code
    9 /
    10 / In:   ARGS    Pointer to argument list. The first DWORD contains the
    11 /               number of argument bytes, excluding that DWORD. The
    12 /               remaining values are packed appropriately for calling
    13 /               a 16-bit function. Pointers have been converted to
    14 /               sel:offset format
    15 /
    16 /       FUN     16:16 address of 16-bit function to be called. Both
    17 /               `pascal' and `cdecl' calling conventions are supported.
    18 /               The function must not change the DI register
    19 /
    20 / Out:  EAX     Return value (DX:AX) of 16-bit function
    21 /
    22                 .p2align 2
    2312
    24                 .set    ARGS, 4*4               # Offset to ARGS relative to %ebp
    25                 .set    FUN, 5*4                # Offset to FUN relative to %ebp
    26                 .set    RETADDR, -4*4           # Offset to spare space relative to FUN
     13extern DosFlatToSel
    2714
    28 __libc_thunk1:  pushl   %ebp                    # Leave two dwords spare
    29                 pushl   %ebp                    # space for 32-bit return address
    30                 pushl   %ebp                    # Set up stack frame
    31                 movl    %esp, %ebp
    32                 pushl   %esi                    # Save %esi
    33                 pushl   %edi                    # Save %edi
    34                 pushl   %ebx                    # Save %ebx
    35                 pushl   %es                     # (2) Save %es
    36                 movl    %esp, %eax              # Check stack
    37                 cmpw    $0x1000, %ax            # 1000H bytes left in this 64K
    38                 jae     1f                      # segment? Yes => skip
    39                 xorw    %ax, %ax                # Move %esp down to next 64K seg
    40                 movb    $0, (%eax)              # Stack probe
    41                 xchgl   %esp, %eax              # Set new %esp, %eax := old %esp
    42 1:              pushl   %ss                     # Save original %ss:%esp on
    43                 pushl   %eax                    # stack (points to saved %ebx)
    44 /
    45 / Copy arguments
    46 /
    47                 movl    ARGS(%ebp), %esi
    48                 lodsl
    49                 movl    %eax, %ecx
    50                 subl    %ecx, %esp
    51                 movl    %esp, %edi
    52                 shrl    $2, %ecx
    53                 repne
    54                 movsl
    55                 movl    %eax, %ecx
    56                 andl    $3, %ecx
    57                 repne
    58                 movsb                           # %edi now points to %ss:%esp
    59                 leal    FUN(%ebp), %esi
    60 /
    61 / Convert %eip to %cs:%ip and %esp to %ss:%sp
    62 /
    63                 movw    %cs, RETADDR+4(%esi)
    64                 movl    $Lthunk1_ret, RETADDR(%esi)
     15segment CODE32
     16;;
     17; unsigned long _libc_thunk1 (void *args, void *fun)
     18;
     19; Call 16-bit code
     20;
     21; In:   ARGS    Pointer to argument list. The first DWORD contains the
     22;               number of argument bytes, excluding that DWORD. The
     23;               remaining values are packed appropriately for calling
     24;               a 16-bit function. Pointers have been converted to
     25;               sel:offset format
     26;
     27;       FUN     16:16 address of 16-bit function to be called. Both
     28;               `pascal' and `cdecl' calling conventions are supported.
     29;               The function must not change the DI register
     30;
     31; Out:  EAX     Return value (DX:AX) of 16-bit function
     32;
     33global __libc_thunk1
     34__libc_thunk1:
     35%define ARGS    (2*4)                   ; Offset to ARGS relative to ebp
     36%define FUN     (3*4)                   ; Offset to FUN relative to ebp
     37        push    ebp                     ; Set up stack frame
     38        mov     ebp, esp
     39        push    esi                     ; Save esi
     40        push    edi                     ; Save edi
     41        push    ebx                     ; Save ebx
     42        push    es                      ; (2) Save es
     43        mov     eax, esp                ; Check stack
     44        cmp     ax, 0x1000              ; 1000H bytes left in this 64K
     45        jae     .stack_good             ; segment? Yes => skip
     46        and     eax, 0ffff0000h         ; Move esp down to next 64K seg
     47        mov     word [eax], 0           ; Stack probe
     48        xchg    eax, esp                ; Set new esp, eax := old esp
     49.stack_good:
     50        push    ss                      ; Save original ss:esp on
     51        push    eax                     ; stack (points to saved es).
    6552
    66                 movl    $Lthunk16_call, %eax
    67                 call    DosFlatToSel
    68                 movzwl  %ax, %ecx               # %ecx = offset
    69                 shrl    $16, %eax               # %eax = segment
    70                 pushl   %eax
    71                 pushl   %ecx
     53        ;
     54        ; Copy arguments onto the stack.
     55        ;
     56        cld                             ; paranoia
     57        mov     esi, [ebp + ARGS]
     58        lodsd
     59        mov     ecx, eax                ; Size of arguments (and size).
     60        sub     esp, ecx
     61        mov     edi, esp
     62        shr     ecx, 2
     63        repne movsd
     64        mov     ecx, eax
     65        and     ecx, 3
     66        repne movsb                     ; edi now points to the saved ss:esp.
    7267
    73                 movl    %esp, %eax
    74                 call    DosFlatToSel
    75                 movzwl  %ax, %ecx               # %ecx = offset
    76                 shrl    $16, %eax               # %eax = segment
    77                 pushl   %eax
    78                 pushl   %ecx
     68        lea     esi, [ebp + FUN]
    7969
    80 /
    81 / Jump to 16-bit code
    82 /
    83                 lss     (%esp), %esp            # Switch to new %ss:%sp
    84                 lret
     70        ;
     71        ; Convert eip to cs:ip and esp to ss:sp.
     72        ;
     73        mov     eax, .thunk16_call
     74        call    DosFlatToSel
     75        movzx   ecx, ax                 ; ecx <- offset
     76        shr     eax, 16                 ; eax <- segment
     77        push    eax
     78        push    ecx
    8579
    86 /
    87 / Call 16-bit function
    88 /
    89 / In:    %esi   Points to 16:16 function address
    90 / Note:  Actually this is 16-bit code. It is put inside the 32-bit code
    91 /        since a.out format does not support 16-bit segments.
    92 /
    93                 .p2align 2
    94 Lthunk16_call:
    95 /               lcall   *(%esi)
    96                 .byte   0x67,0xff,0x1e
    97 /               ljmp    *RETADDR(%esi)
    98                 .byte   0x67,0x66,0xff,0x6e,RETADDR
     80        mov     eax, esp
     81        call    DosFlatToSel
     82        movzx   ecx, ax                 ; ecx <- offset
     83        shr     eax, 16                 ; eax <- segment
     84        push    eax
     85        push    ecx
    9986
    100                 .p2align 2
    101 Lthunk1_ret:    movzwl  %di, %esp               # (4) Remove arguments
    102                 lss     (%esp),%esp             # Get 32-bit stack pointer
    103                 popl    %es                     # Restore %es
    104                 popl    %ebx                    # Restore %ebx
    105                 popl    %edi                    # Restore %edi
    106                 popl    %esi                    # Restore %esi
    107                 popl    %ebp                    # Restore %ebp
    108                 addl    $4*2,%esp               # Skip spare space
    109                 movzwl  %ax, %eax               # Compute return value
    110                 movzwl  %dx, %edx
    111                 shll    $16, %edx
    112                 orl     %edx, %eax
    113                 ret                             # Return to 32-bit code
     87        ;
     88        ; Load 16-bit stack and jump (return) to the 16-bit code.
     89        ;
     90        lss     esp, [esp]
     91        retf
     92
     93;
     94; Call 16-bit function
     95;
     96; In:    esi   Points to 16:16 function address
     97;
     98segment CODE16
     99.thunk16_call:
     100        call    far dword [esi]
     101        jmp     dword seg .thunk1_ret:.thunk1_ret
     102
     103segment CODE32
     104.thunk1_ret:
     105        movzx   esp, di                 ; (4) Remove arguments
     106        lss     esp, [esp]              ; Get 32-bit stack pointer
     107        pop     es                      ; Restore es
     108        pop     ebx                     ; Restore ebx
     109        pop     edi                     ; Restore edi
     110        pop     esi                     ; Restore esi
     111        pop     ebp                     ; Restore ebp
     112
     113        movzx   eax, ax                 ; Compute 32-bit return value.
     114        shl     edx, 16
     115        or      eax, edx
     116        ret                             ; Return to caller of __libc_thunk1.
     117
  • trunk/libc/src/kNIX/os2/386/thunk1.s

    • Property svn:executable deleted
  • trunk/libc/src/kNIX/os2/386/unwind.asm

    • Property svn:executable deleted
    r3859 r3861  
    1 / sys/unwind.s (emx+gcc) -- Copyright (c) 1992-1994 by Eberhard Mattes */
     1; sys/unwind.s (emx+gcc) -- Copyright (c) 1992-1994 by Eberhard Mattes
     2;                           Copyright (c) 2014 by Knut St. Osmundsen
    23
    3         .globl  ___unwind2
     4%include "klibc/os2/asmdefs.mac"
    45
    5 / void __unwind2 (void *xcpt_reg_ptr)
     6extern DosUnwindException
    67
     8BEGIN_CODE32
     9; void __unwind2 (void *xcpt_reg_ptr)
     10global ___unwind2
    711___unwind2:
    8         movl    1*4(%esp), %eax         /* xcpt_reg_ptr */
    9         pushl   $0
    10         pushl   $L_cont
    11         pushl   %eax
     12        mov     eax, [esp + 4]
     13        push    0
     14        push    __unwind2_continue
     15        push    eax
    1216        call    DosUnwindException
    13 L_cont: addl    $3*4, %esp
     17__unwind2_continue:
     18        lea     esp, [esp + 12]
    1419        ret
     20
  • trunk/libc/src/kNIX/os2/386/unwind.s

    • Property svn:executable deleted
  • trunk/libc/src/kNIX/os2/DosEx.c

    r3860 r3861  
    155155 * All facts speaks for it being lazyingly initialized during loading.
    156156 */
    157 _CRT_INIT1(dosexInit)
     157_CRT_INIT1(dosexInit);
    158158
    159159/**
     
    164164{
    165165    LIBCLOG_ENTER("\n");
    166     FS_VAR()
     166    FS_VAR();
    167167    if (gfInited)
    168168        LIBCLOG_RETURN_VOID();
  • trunk/libc/src/kNIX/os2/b_dir.c

    r2929 r3861  
    4646static int dirIOControl(__LIBC_PFH pFH, unsigned long ulIOControl, va_list va, int *prc);
    4747static int dirSetFileMode(__LIBC_PFH pFH, mode_t fMode);
    48 static int dirSetOwner(__LIBC_PFH pFH, uid_t uid);
     48static int dirSetOwner(__LIBC_PFH pFH, uid_t uid, gid_t gid);
    4949static int dirSetTimes(__LIBC_PFH pFH, const struct timeval *paTimes);
    5050static int dirStat(__LIBC_PFH pFH, struct stat *pStat);
     
    191191
    192192/** @copydoc __LIBC_FHOPS::pfnSetOwner */
    193 static int dirSetOwner(__LIBC_PFH pFH, uid_t uid)
    194 {
    195     LIBCLOG_ENTER("pFH=%p:{.fd=%d} uid=%d\n", (void *)pFH, pFH->fh, uid);
     193static int dirSetOwner(__LIBC_PFH pFH, uid_t uid, gid_t gid)
     194{
     195    LIBCLOG_ENTER("pFH=%p:{.fd=%d} uid=%d gid=%d\n", (void *)pFH, pFH->fh, uid, gid);
    196196    int rc;
    197197    if (pFH->pszNativePath)
     
    542542         * Fill the buffer?
    543543         */
    544         if (pFHDir->cFiles <= 0)
     544        if (pFHDir->cFiles == 0)
    545545        {
    546546            FS_VAR_SAVE_LOAD();
  • trunk/libc/src/kNIX/os2/b_fsNativeFileModeSet.c

    r3816 r3861  
    178178            } EAs =
    179179            {
    180                 sizeof(EAs), 0, 0, sizeof(EA_MODE) - 1, sizeof(uint32_t) + 4, EA_MODE, EAT_BINARY, sizeof(uint32_t), Mode
     180                sizeof(EAs), 0, 0, sizeof(EA_MODE) - 1, sizeof(uint32_t) + 4, EA_MODE, EAT_BINARY, sizeof(uint32_t), 0
    181181            };
    182182            #pragma pack()
     183            EAs.u32Mode = Mode;
    183184
    184185            if (!S_ISREG(Mode) && !S_ISDIR(Mode))
  • trunk/libc/src/kNIX/os2/b_fsNativeFileOwnerSet.c

    r3816 r3861  
    9292                    /* .usUidType   =*/ EAT_BINARY,
    9393                    /* .cbUidData   =*/ sizeof(uint32_t),
    94                     /* .u32Uid      =*/ uid != (uid_t)-1 ? uid : StOrg.st_uid,
     94                    /* .u32Uid      =*/ 0,
    9595                    /* .achUidAlign =*/ "",
    9696
     
    102102                    /* .usGidType   =*/ EAT_BINARY,
    103103                    /* .cbGidData   =*/ sizeof(uint32_t),
    104                     /* .u32Gid      =*/ gid != (gid_t)-1 ? gid : StOrg.st_gid,
     104                    /* .u32Gid      =*/ 0,
    105105                    /* .achGidAlign =*/ "",
    106106                };
    107107                #pragma pack()
    108108
    109                 if (uid != -1 && uid != 0)
     109                EAs.u32Uid = uid != (uid_t)-1 ? uid : StOrg.st_uid;
     110                if (EAs.u32Uid != 0)
    110111                    EAs.fUidEA = FEA_NEEDEA;
    111                 if (gid != -1 && gid != 0)
     112
     113                EAs.u32Gid = gid != (gid_t)-1 ? gid : StOrg.st_gid;
     114                if (EAs.u32Gid != 0)
    112115                    EAs.fGidEA = FEA_NEEDEA;
    113116
     
    118121                    LIBCLOG_ERROR2("__libc_back_fsNativeSetEAs('%s',,,,) -> %d, oError=%#lx\n", pszNativePath, rc, EaOp2.oError);
    119122                    if (   rc == ERROR_EAS_NOT_SUPPORTED
    120                         && (uid == -1 || uid == 0)
    121                         && (gid == -1 || gid == 0) )
     123                        && (uid != (uid_t)-1 ? uid : StOrg.st_uid) == 0
     124                        && (gid != (gid_t)-1 ? gid : StOrg.st_gid) == 0 )
    122125                        rc = 0;
    123126                    else
  • trunk/libc/src/kNIX/os2/b_fsStat.c

    r2929 r3861  
    183183     * Query if anything is attached/mounted at the specified mount point.
    184184     */
    185     FS_VAR()
     185    FS_VAR();
    186186    FS_SAVE_LOAD();
    187187    ULONG       fError;
  • trunk/libc/src/kNIX/os2/b_panic.c

    r3848 r3861  
    390390    {
    391391        LIBCLOG_MSG("Breakpoint\n");
    392         __asm__ __volatile__ ("int3\n\t"
    393                               "nop\n\t");
     392        __KLIBC_BREAKPOINT();
    394393    }
    395394
  • trunk/libc/src/kNIX/os2/b_processWait.c

    r3860 r3861  
    137137
    138138
    139 _CRT_INIT1(waitInit)
    140 _CRT_EXIT1(__libc_back_processWaitNotifyTerm)
     139_CRT_INIT1(waitInit);
     140_CRT_EXIT1(__libc_back_processWaitNotifyTerm);
    141141
    142142/**
  • trunk/libc/src/kNIX/os2/exceptions.c

    r2929 r3861  
    3838*   External Functions                                                         *
    3939*******************************************************************************/
     40#ifndef __WATCOMC__ /** @todo figure out weak symbols in watcom C/C++ */
    4041/* from kLib/kHeapDbg.h */
    4142typedef enum
     
    4849                                       void *    pvOS);
    4950/* Weak on _Optlink and _System doesn't work because of underscoring. */
    50 asm (".weak kHeapDbgException");
     51__asm__ (".weak kHeapDbgException");
     52#endif /* !__WATCOMC__ */
    5153
    5254
     
    6668                                           PVOID                        pvWhatEver)
    6769{
     70#ifdef __WATCOMC__
     71    __asm {cld};                        /* usual paranoia.  */
     72#else
    6873    __asm__ ("cld");                    /* usual paranoia.  */
     74#endif
    6975    siginfo_t   SigInfo = {0};
    7076    int         rc;                     /* return from __libc_Back_signalRaise() */
     
    117123         */
    118124        case XCPT_ACCESS_VIOLATION:
     125#ifndef __WATCOMC__ /** @todo figure out weak symbols in watcom C/C++ */
    119126            /* If we're linking libc01.elh or someone is linking static libc
    120127               together with kLib the electric fence heap will get the opportunity
     
    143150                    return XCPT_CONTINUE_EXECUTION;
    144151            }
     152#endif /* !__WATCOMC__ */
    145153            /* take signal */
    146154            SigInfo.si_signo = SIGSEGV;
     
    290298                ||  (rc = __libc_back_signalRaisePoked(&pXcptRepRec, pXcptRepRec->ExceptionInfo[0])) < 0)
    291299            {
    292                 #if 0 /** bird: no so sure about this. */
     300#if 0 /** bird: no so sure about this. */
    293301                /*
    294302                 * For all but thread 1 we commit suicide.
     
    309317                }
    310318                FS_RESTORE();
    311                 #endif
     319#endif
    312320                return XCPT_CONTINUE_SEARCH;
    313321            }
  • trunk/libc/src/kNIX/os2/fhOS2File.c

    r3816 r3861  
    633633                } EAs =
    634634                {
    635                     sizeof(EAs), 0, 0, sizeof(EA_MODE) - 1, sizeof(uint32_t) + 4, EA_MODE, EAT_BINARY, sizeof(uint32_t), fMode
     635                    sizeof(EAs), 0, 0, sizeof(EA_MODE) - 1, sizeof(uint32_t) + 4, EA_MODE, EAT_BINARY, sizeof(uint32_t), 0
    636636                };
    637637                #pragma pack()
    638638
     639                EAs.u32Mode = fMode;
    639640                if (!S_ISREG(fMode) && !S_ISDIR(fMode))
    640641                    EAs.fEA = FEA_NEEDEA;
  • trunk/libc/src/kNIX/os2/fs-os2.c

    r3816 r3861  
    838838    char            _achBuffer[SIZEOF_ACHBUFFER + 4];
    839839    char           *pachBuffer = (char *)((uintptr_t)&_achBuffer[3] & ~3);
    840     unsigned        cLoopsLeft = 8;
     840    int             cLoopsLeft = 8;
    841841    int             fInUnixTree = __libc_gfInUnixTree;
    842842    int             rcRet = 0;
     
    844844    __LIBC_PFSINFO  pFsInfo = NULL;
    845845    int             fUnixEAs;
    846     FS_VAR()
     846    FS_VAR();
    847847    FS_SAVE_LOAD();
    848848    for (;;)
     
    12821282
    12831283                    /* Check if we've reached the max number of symlink loops before we continue. */
    1284                     if (cLoopsLeft-- <= 0)
     1284                    if (--cLoopsLeft <= 0)
    12851285                    {
    12861286                        rcRet = -ELOOP;
     
    14591459    if (!s_Seed.ausSeed[3])
    14601460    {
     1461#ifdef __WATCOMC__
     1462extern uint64_t __libc_back_fsUnixAttribsInit_RdTsc(void);
     1463# pragma aux __libc_back_fsUnixAttribsInit_RdTsc = "rdtsc" value [eax edx]
     1464        s_Seed.u64TSC = __libc_back_fsUnixAttribsInit_RdTsc();
     1465#else
    14611466        __asm__ __volatile__ ("rdtsc" : "=A" (s_Seed.u64TSC));
     1467#endif
    14621468        s_Seed.ausSeed[3] = 1;
    14631469    }
  • trunk/libc/src/kNIX/os2/libcfork.c

    r3804 r3861  
    210210static void                 forkBthCopyPagesDetect(void *pvDst, const void *pvSrc, size_t cb);
    211211static void                 forkBthCopyPagesPlain(void *pvDst, const void *pvSrc, size_t cb);
     212#ifdef __GNUC__
    212213static void                 forkBthCopyPagesMMX(void *pvDst, const void *pvSrc, size_t cb);
    213 #if 0
     214# if 0
    214215static void                 forkBthCopyPagesMMXNonTemporal(void *pvDst, const void *pvSrc, size_t cb);
    215216static void                 forkBthCopyPagesSSE2(void *pvDst, const void *pvSrc, size_t cb);
     217# endif
    216218#endif
    217219static void                 forkBthCallbacksSort(__LIBC_PFORKCALLBACK *papCallbacks);
     
    567569    uint32_t    u1;
    568570    uint32_t    u2;
     571#if defined(__WATCOMC__) || defined(_MSC_VER)
     572    __asm {
     573        pushf
     574        mov     eax, [esp]
     575        xor     [esp], 0200000h
     576        popf
     577        pushf
     578        cmp     eax, [esp]
     579        pop     eax
     580        setne   al
     581        and     eax, 1
     582        mov     [fRet], eax
     583    };
     584#else
    569585    __asm__ ("pushf\n\t"
    570586             "pop   %1\n\t"
     
    580596             "popf\n\t"
    581597             : "=m" (fRet), "=r" (u1), "=r" (u2));
     598#endif
    582599    return fRet;
    583600}
     
    590607 * @returns EDX after cpuid operation.
    591608 */
     609#ifdef __WATCOMC__
     610uint32_t CpuIdEDX(unsigned uOperator);
     611# pragma aux CpuIdEDX = "cpuid" parm [eax] value [edx] modify [eax ebx ecx edx]
     612#else
    592613static inline uint32_t CpuIdEDX(unsigned uOperator)
    593614{
     
    600621    return u32EDX;
    601622}
     623#endif
    602624
    603625
     
    617639     * Determine fxsave/fxrstor support.
    618640     */
    619     static int fHaveFXSR = -1;
    620     if (fHaveFXSR == -1)
    621         fHaveFXSR = HasCpuId() && (CpuIdEDX(1) & 0x1000000); /* bit 24 - fxsr */
     641    static int s_fHaveFXSR = -1;
     642    if (s_fHaveFXSR == -1)
     643        s_fHaveFXSR = HasCpuId() && (CpuIdEDX(1) & 0x1000000); /* bit 24 - fxsr */
    622644
    623645    /*
     
    626648    PX86FXSTATE pFPU = (PX86FXSTATE)alloca(512 + 16);
    627649    pFPU = (PX86FXSTATE)(((uintptr_t)pFPU + 15) & ~15);
    628     if (fHaveFXSR)
     650#if defined(__WATCOMC__) || defined(_MSC_VER)
     651    if (s_fHaveFXSR)
     652    {
     653        __asm {
     654            mov     eax, [pFPU]
     655            fxsave  [eax]
     656        }
     657    }
     658    else
     659    {
     660        __asm {
     661            mov     eax, [pFPU]
     662            fnsave  [eax]
     663        }
     664    }
     665#else
     666    if (s_fHaveFXSR)
    629667        __asm__ __volatile__ ("fxsave %0" : "=m" (*pFPU));
    630668    else
    631669        __asm__ __volatile__ ("fnsave %0" : "=m" (*pFPU));
     670#endif
    632671
    633672    /*
     
    663702     */
    664703    pid_t pid = -1;
     704#if defined(__WATCOMC__) || defined(_MSC_VER)
     705    __asm {
     706        lea     edx, [XcptRegRec]
     707        pushfd
     708        push    ebx
     709        push    ecx
     710        push    esi
     711        push    edi
     712        push    ebp
     713        push    gs
     714
     715        ;
     716        ; Call the fork worker, forkParDo().
     717        ;
     718        mov     eax, esp
     719        push    edx
     720        push    eax
     721        push    fork_ret
     722        call    forkParDo
     723        add     esp, 12             ; cdecl
     724        jmp     fork_skip_regs
     725
     726        ;
     727        ; The Child returns here.
     728        ;
     729fork_ret:
     730        pop     gs
     731        pop     ebp
     732        pop     edi
     733        pop     esi
     734        pop     ecx
     735        pop     ebx
     736        popfd
     737fork_skip_regs:
     738        mov     [pid], eax
     739    };
     740#else
    665741    __asm__ __volatile__ (
    666742        "pushf\n\t"
     
    695771        "fork_skip_regs:\n\t"
    696772        : "=a" (pid): "d" (&XcptRegRec) : "ecx");
     773#endif
    697774
    698775    /*
     
    710787     * Restore the FPU state.
    711788     */
    712     if (fHaveFXSR)
     789#if defined(__WATCOMC__) || defined(_MSC_VER)
     790    if (s_fHaveFXSR)
     791    {
     792        __asm {
     793            mov     eax, [pFPU]
     794            fxrstor [eax]
     795        }
     796    }
     797    else
     798    {
     799        __asm {
     800            mov     eax, [pFPU]
     801            frstor  [eax]
     802        }
     803    }
     804#else
     805    if (s_fHaveFXSR)
    713806        __asm__ __volatile__ ("fxrstor %0" : "=m" (*pFPU));
    714807    else
    715808        __asm__ __volatile__ ("frstor %0" : "=m" (*pFPU));
     809#endif
    716810
    717811    FS_RESTORE();
     
    14721566        }
    14731567    }
     1568#if defined(__WATCOMC__) || defined(_MSC_VER)
     1569    void *pvStackRet = pForkHandle->pvStackRet;
     1570    void *pvForkRet  = pForkHandle->pvForkRet;
     1571    __asm {
     1572        mov     edx, [pForkHandle]
     1573        mov     edi, [pvStackRet]
     1574        mov     esi, [pvForkRet]
     1575        mov     eax, [uNewESP]
     1576        push    edx
     1577        call    forkChlDoFork2
     1578        mov     esp, edi
     1579        jmp     esi
     1580    };
     1581#else
    14741582    __asm__ __volatile__("movl  %0, %%esp\n\t"
    14751583                         "pushl %1\n\t"
     
    14811589                           "D" ((uintptr_t)pForkHandle->pvStackRet),
    14821590                           "S" (pForkHandle->pvForkRet));
     1591#endif
    14831592    /* just for referencing the functions so GCC doesn't optimize them away - we'll never get here!!! */
    14841593    return forkChlDoFork2(pForkHandle) + forkParDo(NULL, NULL, NULL);
     
    27142823     */
    27152824    pfnForkBthCopyPages = forkBthCopyPagesPlain; /* default, always works. */
     2825#ifdef __GNUC__
    27162826    if (HasCpuId())
    27172827    {
     
    27202830        {
    27212831            pfnForkBthCopyPages = forkBthCopyPagesMMX;
    2722 #if 0  /* missing hardware to test this. */
     2832# if 0  /* missing hardware to test this. */
    27232833            /* hope this is right */
    27242834            if (    (uEdx & (1 << 24)) /*FXSR*/
     
    27262836                &&  (uEdx & (1 << 26)) /*SSE2*/)
    27272837                pfnForkBthCopyPages = forkBthCopyPagesSSE2;
    2728 #endif
    2729 #if 0 /* too slow for some peculiar reason... */
     2838# endif
     2839# if 0 /* too slow for some peculiar reason... */
    27302840            else
    27312841            {
     
    27342844                    pfnForkBthCopyPages = forkBthCopyPagesMMXNonTemporal;
    27352845            }
     2846# endif
     2847        }
     2848    }
    27362849#endif
    2737         }
    2738     }
    27392850    pfnForkBthCopyPages(pvDst, pvSrc, cb);
    27402851}
    27412852
    27422853
     2854#ifdef __GNUC__
    27432855__asm__(".align 4\n\t");
     2856#endif
    27442857/**
    27452858 * Copy page memory, plain stupid rep movsl.
     
    27522865{
    27532866    LIBCLOG_ENTER("pvDst=%p pvSrc=%p cb=0x%08x\n", pvDst, pvSrc, cb);
     2867#ifdef __WATCOMC__
     2868extern void forkBthCopyPagesPlainInner(void *pvDst, const void *pvSrc, size_t cb);
     2869# pragma aux forkBthCopyPagesPlainInner = \
     2870    "cld" \
     2871    "shr ecx, 2" \
     2872    "rep movsd" \
     2873    parm [edi] [esi] [ecx] modify [edi esi ecx]
     2874#elif defined(_MSC_VER)
     2875    __movsd(pvDst, pvSrc, cb >> 2);
     2876#else
    27542877    register unsigned long int r0,r1,r2;
    27552878    __asm__ __volatile__
     
    27592882       : "0" (cb / 4), "1" (pvDst), "2" (pvSrc)
    27602883       : "memory");
     2884#endif
    27612885    LIBCLOG_RETURN_VOID();
    27622886}
    27632887
    27642888
     2889#ifdef __GNUC__
    27652890__asm__(".align 4\n\t");
    27662891/**
     
    28072932    LIBCLOG_RETURN_VOID();
    28082933}
     2934#endif
    28092935
    28102936
    28112937#if 0 /* too slow */
     2938#ifdef __GNUC__
    28122939__asm__(".align 4\n\t");
     2940#endif
    28132941/**
    28142942 * Copy page memory, MMX with non-temporal stores.
     
    31923320                                             PVOID                        pvWhatEver)
    31933321{
    3194     __asm__ ("cld");                    /* usual paranoia. */
     3322    __KLIBC_CLEAR_DIR_FLAG(); /* paranoia. */
    31953323
    31963324    if (pXcptRepRec->fHandlerFlags & (EH_UNWINDING | EH_EXIT_UNWIND))
     
    33193447    PPIB    pPib;
    33203448    PTIB    pTib;
    3321     __asm__ ("cld");                    /* usual paranoia. */
     3449    __KLIBC_CLEAR_DIR_FLAG(); /* paranoia. */
    33223450
    33233451    if (pXcptRepRec->fHandlerFlags & (EH_UNWINDING | EH_EXIT_UNWIND))
     
    33873515                                                     PVOID                        pvWhatEver)
    33883516{
    3389     __asm__ ("cld");                    /* usual paranoia. */
     3517    __KLIBC_CLEAR_DIR_FLAG(); /* paranoia. */
    33903518
    33913519    if (pXcptRepRec->fHandlerFlags & (EH_UNWINDING | EH_EXIT_UNWIND))
  • trunk/libc/src/kNIX/os2/logstrict.c

    r3860 r3861  
    14311431        XRepRec.ExceptionAddress    = (void*)&__libc_LogAssert;
    14321432        if (DosRaiseException(&XRepRec))
    1433             __asm__ __volatile__("int $3");
     1433            __KLIBC_BREAKPOINT();
    14341434    }
    14351435}
     
    22762276     */
    22772277    if (    pParent->hFile != pChild->hFile
    2278         &&  pParent->hFile >= 0
    2279         &&  pChild->hFile  >= 0)
     2278        &&  (LONG)pParent->hFile >= 0
     2279        &&  (LONG)pChild->hFile  >= 0)
    22802280    {
    22812281        HFILE hNew = pParent->hFile;
  • trunk/libc/src/kNIX/os2/safesems.c

    r2929 r3861  
    133133static int __libc_back_safesemStackChecker(void)
    134134{
     135#if 0
    135136    char volatile *pch;
    136137    unsigned u;
     
    143144                         "movl  %1, -2048(%0)\n\t"
    144145                         : "=r" (pch), "=r" (u));
     146#else
     147    register char volatile *pch;
     148    register unsigned char u;
     149    char volatile szTmp[16];
     150    pch = &szTmp[15];
     151    u = pch[4];
     152    pch[4] = u;
     153    u = pch[-1024];
     154    pch[-1024] = u;
     155    u = pch[-2048];
     156    pch[-2048] = u;
     157#endif
    145158    return 0;
    146159}
  • trunk/libc/src/kNIX/os2/sharedpm.c

    r3860 r3861  
    6868//#define SPM_ASSERT_PTR_NULL(ptr)    LIBC_ASSERTM(SPM_VALID_PTR_NULL(ptr), "Invalid pointer %p. expr='%s'\n", (void *)(ptr), #ptr);
    6969#define SPM_ASSERT_PTR_NULL(ptr)    (SPM_VALID_PTR_NULL(ptr) ? (void)0 \
    70     : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __PRETTY_FUNCTION__, __FILE__, __LINE__, #ptr, \
     70    : __libc_LogAssert(__LIBC_LOG_INSTANCE, __LIBC_LOG_GROUP, __FUNCTION__, __FILE__, __LINE__, #ptr, \
    7171                       "Invalid pointer %p. expr='%s'\n", (void *)(ptr), #ptr))
    7272
     
    891891     * Validate input.
    892892     */
    893     if (uid < 0)
     893    if ((long)uid < 0)
    894894        LIBCLOG_RETURN_P(-EINVAL);
    895895
     
    40744074    do { if (fVerbose) LIBCLOG_REL(__VA_ARGS__); } while (0)
    40754075#define CHECK_FAILED(...) \
    4076     do { CHECK_LOG(__VA_ARGS__); if (fBreakpoint) __asm__ __volatile__("int3\n"); cErrors++; } while (0)
     4076    do { CHECK_LOG(__VA_ARGS__); if (fBreakpoint) __KLIBC_BREAKPOINT(); cErrors++; } while (0)
    40774077#define CHECK_PTR(ptr, msg) \
    40784078    do { if (!SPM_VALID_PTR(ptr))      { CHECK_FAILED("Invalid pointer %p (%s). %s\n", (void *)ptr, #ptr, msg); } } while (0)
  • trunk/libc/src/kNIX/os2/signals.c

    r3860 r3861  
    647647unsigned    __libc_back_signalSemIsOwner(void)
    648648{
    649     FS_VAR()
     649    FS_VAR();
    650650    PTIB    pTib;
    651651    PPIB    pPib;
     
    18921892                /* release, switch and call. */
    18931893                __libc_back_signalSemRelease();
     1894#ifdef __WATCOMC__
     1895                extern void signalDeliverOtherStack(uintptr_t *pStack, __siginfohandler_t *pfnSigAction);
     1896# pragma aux signalDeliverOtherStack = \
     1897                    "mov    [eax + 12], esp" \
     1898                    "mov    esp, eax" \
     1899                    "call   dword ptr edx" \
     1900                    "mov    esp, [esp + 12]" \
     1901                    parm [eax] [edx]  modify [eax ecx eax]
     1902#elif defined(_MSC_VER)
     1903                __asm {
     1904                    mov     eax, [pStack]
     1905                    lea     ecx, [eax + 12]
     1906                    mov     edx, [SigAction.__sigaction_u.__sa_sigaction]
     1907                    mov     [ecx], esp
     1908                    mov     esp, eax
     1909                    call    edx
     1910                    mov     esp, [esp + 12]
     1911                };
     1912#else
    18941913                __asm__ __volatile__ (
    18951914                    "mov  %%esp, %0\n\t"
     
    19011920                      "d" (SigAction.__sigaction_u.__sa_sigaction)
    19021921                    : "eax" );
     1922#endif
    19031923
    19041924                /* Restore tib and release the stack. */
     
    20002020        __libc_Back_panic(__LIBC_PANIC_SIGNAL | __LIBC_PANIC_NO_SPM_TERM, pCtx, "Killed by unknown signal %d\n", iSignalNo);
    20012021    LIBCLOG_MSG("panic failed\n"); /* shuts up gcc */
    2002     asm("int3");
     2022    __KLIBC_BREAKPOINT();
    20032023}
    20042024
  • trunk/libc/src/kNIX/os2/sysv_sem.c

    r2929 r3861  
    162162 * semaphore info struct
    163163 */
    164 static struct seminfo seminfo = {
     164struct seminfo seminfo = {
    165165                SEMMAP,         /* # of entries in semaphore map */
    166166                SEMMNI,         /* # of semaphore identifiers */
  • trunk/libc/src/kNIX/os2/tcpipver.c

    r3804 r3861  
    13451345#undef  __LIBC_LOG_GROUP
    13461346#define __LIBC_LOG_GROUP __LIBC_LOG_GRP_INITTERM
    1347 _CRT_INIT1(tcpipInit)
    13481347
    13491348/**
     
    13591358    LIBCLOG_RETURN_VOID();
    13601359}
     1360_CRT_INIT1(tcpipInit);
    13611361
    13621362
  • trunk/libc/src/kNIX/os2/timebomb.c

    r3804 r3861  
    2929
    3030#ifdef TIMEBOMB
    31 _CRT_INIT1(__libc_Timebomb)
     31_CRT_INIT1(__libc_Timebomb);
    3232#endif
    3333
  • trunk/libc/src/libc/app/stdio.c

    r3804 r3861  
    163163}
    164164
    165 _CRT_INIT1(_init_streams)
    166 _CRT_EXIT1(_exit_streams)
     165_CRT_INIT1(_init_streams);
     166_CRT_EXIT1(_exit_streams);
    167167
    168168
  • trunk/libc/src/libc/io/_tmp.c

    r3804 r3861  
    2222
    2323
    24 _CRT_INIT1(_init1_tmp)
     24_CRT_INIT1(_init1_tmp);
    2525
    2626/** Initialize the semaphore -- this function will be called by
Note: See TracChangeset for help on using the changeset viewer.