Changeset 3821
- Timestamp:
- Feb 26, 2014, 2:14:17 AM (11 years ago)
- Location:
- trunk/libc
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libc/include/386/builtin.h
r3820 r3821 13 13 14 14 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 18 22 #ifdef __WATCOMC__ 19 /** @todo next up */ 23 signed char __cxchg(__volatile__ signed char *p, signed char v); 24 # pragma aux __cxchg = "xchg [edx], al" parm [edx] [al] value [al] 25 26 short __sxchg(__volatile__ short *p, short v); 27 # pragma aux __sxchg = "xchg [edx], ax" parm [edx] [ax] value [ax] 28 29 int __lxchg(__volatile__ int *p, int v); 30 # pragma aux __lxchg = "xchg [edx], eax" parm [edx] [eax] value [eax] 31 32 void __enable(void); 33 # pragma aux __enable = "sti" 34 35 void __disable(void); 36 # pragma aux __disable = "cli" 37 20 38 #else 39 40 # ifdef _MSC_VER 41 signed char __cxchg (__volatile__ signed char *p, signed char v); 42 signed char __sxchg (__volatile__ signed char *p, signed char v); 43 # else /* !_MSC_VER */ 44 static __inline__ signed char __cxchg (__volatile__ signed char *p, signed char v) 45 { 21 46 __asm__ __volatile__ ("xchgb %0, %1" : "=m"(*p), "=r"(v) : "1"(v)); 22 #endif23 47 return v; 24 48 } … … 29 53 return v; 30 54 } 55 # endif /* !_MSC_VER */ 31 56 32 57 static __inline__ int __lxchg (__volatile__ int *p, int v) 33 58 { 59 # ifdef _MSC_VER 60 return _InterlockedExchange((long *)p, v); 61 # else 34 62 __asm__ __volatile__ ("xchgl %0, %1" : "=m"(*p), "=r"(v) : "1"(v)); 35 63 return v; 64 # endif 36 65 } 37 66 38 67 static __inline__ void __enable (void) 39 68 { 69 # ifdef _MSC_VER 70 _enable(); 71 # else 40 72 __asm__ __volatile__ ("sti"); 73 # endif 41 74 } 42 75 43 76 static __inline__ void __disable (void) 44 77 { 78 # ifdef _MSC_VER 79 _enable(); 80 # else 45 81 __asm__ __volatile__ ("cli"); 46 } 82 # endif 83 } 84 #endif 47 85 48 86 … … 53 91 * @param u The new value. 54 92 */ 93 #ifdef __WATCOMC__ 94 unsigned __atomic_xchg(__volatile__ unsigned *pu, unsigned u); 95 # pragma aux __atomic_xchg = "xchg [edx], eax" parm [edx] [eax] value [eax] 96 #else 55 97 static __inline__ unsigned __atomic_xchg(__volatile__ unsigned *pu, unsigned u) 56 98 { 99 # ifdef _MSC_VER 100 return _InterlockedExchange((long *)pu, u); 101 # else 57 102 __asm__ __volatile__ ("xchgl %0, %1" : "=m" (*pu), "=r" (u) : "1" (u)); 58 103 return u; 59 } 104 # endif 105 } 106 #endif 60 107 61 108 /** … … 66 113 * @param u16 The new value. 67 114 */ 115 #ifdef __WATCOMC__ 116 uint16_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) 119 uint16_t __atomic_xchg_word(volatile uint16_t *pu16, uint16_t u16); 120 #else 68 121 static inline uint16_t __atomic_xchg_word(volatile uint16_t *pu16, uint16_t u16) 69 122 { … … 71 124 return u16; 72 125 } 126 #endif 127 128 #ifndef __WATCOMC__ /** @todo port me later. */ 73 129 74 130 /** … … 800 856 } 801 857 858 #endif /* ! __WATCOM__ */ 859 802 860 __END_DECLS 803 861 #endif /* not _I386_BUILTIN_H */ -
trunk/libc/include/sys/cdefs.h
r3820 r3821 732 732 #endif 733 733 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 734 753 /* bird: include the GNU sys/cdefs.h (which fortunately have another 735 754 blocker, _SYS_CDEFS_H). */ -
trunk/libc/src/fbsdlibc/gdtoa/glue/_hdtoa.c
r1871 r3821 28 28 __FBSDID("$FreeBSD: src/lib/libc/gdtoa/_hdtoa.c,v 1.2 2004/01/21 04:51:50 grehan Exp $"); 29 29 30 #ifdef __ EMX__30 #ifdef __IN_KLIBC__ 31 31 #include "namespace.h" 32 32 #endif … … 37 37 #include <stdlib.h> 38 38 #include "fpmath.h" 39 #ifdef __ EMX__39 #ifdef __IN_KLIBC__ 40 40 #include "../gdtoaimp.h" 41 41 #else -
trunk/libc/src/fbsdlibc/gdtoa/glue/_ldtoa.c
r1871 r3821 28 28 __FBSDID("$FreeBSD: src/lib/libc/gdtoa/_ldtoa.c,v 1.2 2004/01/18 07:53:49 das Exp $"); 29 29 30 #ifdef __ EMX__30 #ifdef __IN_KLIBC__ 31 31 #include "namespace.h" 32 32 #endif … … 37 37 #include <stdlib.h> 38 38 #include "fpmath.h" 39 #ifdef __ EMX__39 #ifdef __IN_KLIBC__ 40 40 #include "../gdtoaimp.h" 41 41 #else -
trunk/libc/src/fbsdlibc/gdtoa/glue/glue.c
r1871 r3821 6 6 */ 7 7 8 #ifdef __ EMX__8 #ifdef __IN_KLIBC__ 9 9 10 10 #include <386/builtin.h> -
trunk/libc/src/fbsdlibc/gdtoa/glue/machdep_ldisQ.c
r1871 r3821 34 34 __FBSDID("$FreeBSD: src/lib/libc/gdtoa/machdep_ldisQ.c,v 1.2 2003/04/09 05:58:43 das Exp $"); 35 35 36 #ifdef __ EMX__36 #ifdef __IN_KLIBC__ 37 37 #include "../gdtoaimp.h" 38 38 #else -
trunk/libc/src/fbsdlibc/gdtoa/glue/machdep_ldisd.c
r1871 r3821 34 34 __FBSDID("$FreeBSD: src/lib/libc/gdtoa/machdep_ldisd.c,v 1.1 2003/03/12 20:29:58 das Exp $"); 35 35 36 #ifdef __ EMX__36 #ifdef __IN_KLIBC__ 37 37 #include "../gdtoaimp.h" 38 38 #else -
trunk/libc/src/fbsdlibc/gdtoa/glue/machdep_ldisx.c
r1871 r3821 34 34 __FBSDID("$FreeBSD: src/lib/libc/gdtoa/machdep_ldisx.c,v 1.2 2003/04/09 05:58:43 das Exp $"); 35 35 36 #ifdef __ EMX__36 #ifdef __IN_KLIBC__ 37 37 #include "../gdtoaimp.h" 38 38 #else -
trunk/libc/src/fbsdlibc/gdtoa/strtod.c
r1871 r3821 59 59 60 60 double 61 #ifdef __ EMX__61 #ifdef __IN_KLIBC__ 62 62 _STD(strtod) 63 63 #else
Note:
See TracChangeset
for help on using the changeset viewer.