Changeset 3821


Ignore:
Timestamp:
Feb 26, 2014, 2:14:17 AM (11 years ago)
Author:
bird
Message:

More OpenWatcom changes.

Location:
trunk/libc
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/libc/include/386/builtin.h

    r3820 r3821  
    1313
    1414
    15 static __inline__ signed char __cxchg (__volatile__ signed char *p,
    16                                        signed char v)
    17 {
     15#ifdef _MSC_VER
     16# pragma intrinsic(_InterlockedExchange)
     17# pragma intrinsic(_enable)
     18# pragma intrinsic(_disable)
     19#endif
     20
     21
    1822#ifdef __WATCOMC__
    19   /** @todo next up */
     23signed char __cxchg(__volatile__ signed char *p, signed char v);
     24# pragma aux __cxchg = "xchg [edx], al" parm [edx] [al]  value [al]
     25
     26short       __sxchg(__volatile__ short *p, short v);
     27# pragma aux __sxchg = "xchg [edx], ax" parm [edx] [ax]  value [ax]
     28
     29int         __lxchg(__volatile__ int *p, int v);
     30# pragma aux __lxchg = "xchg [edx], eax" parm [edx] [eax]  value [eax]
     31
     32void        __enable(void);
     33# pragma aux __enable = "sti"
     34
     35void        __disable(void);
     36# pragma aux __disable = "cli"
     37
    2038#else
     39
     40# ifdef _MSC_VER
     41signed char __cxchg (__volatile__ signed char *p, signed char v);
     42signed char __sxchg (__volatile__ signed char *p, signed char v);
     43# else /* !_MSC_VER */
     44static __inline__ signed char __cxchg (__volatile__ signed char *p, signed char v)
     45{
    2146  __asm__ __volatile__ ("xchgb %0, %1" : "=m"(*p), "=r"(v) : "1"(v));
    22 #endif
    2347  return v;
    2448}
     
    2953  return v;
    3054}
     55# endif /* !_MSC_VER */
    3156
    3257static __inline__ int __lxchg (__volatile__ int *p, int v)
    3358{
     59# ifdef _MSC_VER
     60  return _InterlockedExchange((long *)p, v);
     61# else
    3462  __asm__ __volatile__ ("xchgl %0, %1" : "=m"(*p), "=r"(v) : "1"(v));
    3563  return v;
     64# endif
    3665}
    3766
    3867static __inline__ void __enable (void)
    3968{
     69# ifdef _MSC_VER
     70  _enable();
     71# else
    4072  __asm__ __volatile__ ("sti");
     73# endif
    4174}
    4275
    4376static __inline__ void __disable (void)
    4477{
     78# ifdef _MSC_VER
     79  _enable();
     80# else
    4581  __asm__ __volatile__ ("cli");
    46 }
     82# endif
     83}
     84#endif
    4785
    4886
     
    5391 * @param   u       The new value.
    5492 */
     93#ifdef __WATCOMC__
     94unsigned __atomic_xchg(__volatile__ unsigned *pu, unsigned u);
     95# pragma aux __atomic_xchg = "xchg [edx], eax" parm [edx] [eax]  value [eax]
     96#else
    5597static __inline__ unsigned __atomic_xchg(__volatile__ unsigned *pu, unsigned u)
    5698{
     99# ifdef _MSC_VER
     100    return _InterlockedExchange((long *)pu, u);
     101# else
    57102    __asm__ __volatile__ ("xchgl %0, %1" : "=m" (*pu), "=r" (u) : "1" (u));
    58103    return u;
    59 }
     104# endif
     105}
     106#endif
    60107
    61108/**
     
    66113 * @param   u16     The new value.
    67114 */
     115#ifdef __WATCOMC__
     116uint16_t __atomic_xchg_word(volatile uint16_t *pu16, uint16_t u16);
     117# pragma aux __atomic_xchg_word = "xchg [edx], ax" parm [edx] [ax]  value [ax]
     118#elif defined(_MSC_VER)
     119uint16_t __atomic_xchg_word(volatile uint16_t *pu16, uint16_t u16);
     120#else
    68121static inline uint16_t __atomic_xchg_word(volatile uint16_t *pu16, uint16_t u16)
    69122{
     
    71124    return u16;
    72125}
     126#endif
     127
     128#ifndef __WATCOMC__ /** @todo port me later. */
    73129
    74130/**
     
    800856}
    801857
     858#endif /* ! __WATCOM__ */
     859
    802860__END_DECLS
    803861#endif /* not _I386_BUILTIN_H */
  • trunk/libc/include/sys/cdefs.h

    r3820 r3821  
    732732#endif
    733733
     734/*
     735 * Smooth things out for other compilers.
     736 */
     737#if defined(__WATCOMC__) || defined(_MSC_VER)
     738# define __volatile__   volatile
     739# define __const__      const
     740# define __dead2
     741# define __pure2
     742# define __unused
     743# ifdef __cplusplus
     744#  define __inline__    inline
     745# elif defined(_MSC_VER)
     746#  define __inline__    _inline
     747# else
     748#  define __inline__    _inline
     749# endif
     750#endif
     751
     752
    734753/* bird: include the GNU sys/cdefs.h (which fortunately have another
    735754         blocker, _SYS_CDEFS_H). */
  • trunk/libc/src/fbsdlibc/gdtoa/glue/_hdtoa.c

    r1871 r3821  
    2828__FBSDID("$FreeBSD: src/lib/libc/gdtoa/_hdtoa.c,v 1.2 2004/01/21 04:51:50 grehan Exp $");
    2929
    30 #ifdef __EMX__
     30#ifdef __IN_KLIBC__
    3131#include "namespace.h"
    3232#endif
     
    3737#include <stdlib.h>
    3838#include "fpmath.h"
    39 #ifdef __EMX__
     39#ifdef __IN_KLIBC__
    4040#include "../gdtoaimp.h"
    4141#else
  • trunk/libc/src/fbsdlibc/gdtoa/glue/_ldtoa.c

    r1871 r3821  
    2828__FBSDID("$FreeBSD: src/lib/libc/gdtoa/_ldtoa.c,v 1.2 2004/01/18 07:53:49 das Exp $");
    2929
    30 #ifdef __EMX__
     30#ifdef __IN_KLIBC__
    3131#include "namespace.h"
    3232#endif
     
    3737#include <stdlib.h>
    3838#include "fpmath.h"
    39 #ifdef __EMX__
     39#ifdef __IN_KLIBC__
    4040#include "../gdtoaimp.h"
    4141#else
  • trunk/libc/src/fbsdlibc/gdtoa/glue/glue.c

    r1871 r3821  
    66 */
    77
    8 #ifdef __EMX__
     8#ifdef __IN_KLIBC__
    99
    1010#include <386/builtin.h>
  • trunk/libc/src/fbsdlibc/gdtoa/glue/machdep_ldisQ.c

    r1871 r3821  
    3434__FBSDID("$FreeBSD: src/lib/libc/gdtoa/machdep_ldisQ.c,v 1.2 2003/04/09 05:58:43 das Exp $");
    3535
    36 #ifdef __EMX__
     36#ifdef __IN_KLIBC__
    3737#include "../gdtoaimp.h"
    3838#else
  • trunk/libc/src/fbsdlibc/gdtoa/glue/machdep_ldisd.c

    r1871 r3821  
    3434__FBSDID("$FreeBSD: src/lib/libc/gdtoa/machdep_ldisd.c,v 1.1 2003/03/12 20:29:58 das Exp $");
    3535
    36 #ifdef __EMX__
     36#ifdef __IN_KLIBC__
    3737#include "../gdtoaimp.h"
    3838#else
  • trunk/libc/src/fbsdlibc/gdtoa/glue/machdep_ldisx.c

    r1871 r3821  
    3434__FBSDID("$FreeBSD: src/lib/libc/gdtoa/machdep_ldisx.c,v 1.2 2003/04/09 05:58:43 das Exp $");
    3535
    36 #ifdef __EMX__
     36#ifdef __IN_KLIBC__
    3737#include "../gdtoaimp.h"
    3838#else
  • trunk/libc/src/fbsdlibc/gdtoa/strtod.c

    r1871 r3821  
    5959
    6060 double
    61 #ifdef __EMX__
     61#ifdef __IN_KLIBC__
    6262_STD(strtod)
    6363#else
Note: See TracChangeset for help on using the changeset viewer.