* winbase.h: Turn on inline versions of Interlocked* by default.
* winbase.h: Fixup inline asm functions. Add ilockcmpexch.
This commit is contained in:
parent
8bce0d723c
commit
ba88622498
|
@ -1,3 +1,11 @@
|
||||||
|
2002-12-14 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
|
* winbase.h: Turn on inline versions of Interlocked* by default.
|
||||||
|
|
||||||
|
2002-12-14 Gary R. Van Sickle <g.r.vansickle@worldnet.att.net>
|
||||||
|
|
||||||
|
* winbase.h: Fixup inline asm functions. Add ilockcmpexch.
|
||||||
|
|
||||||
2002-12-13 Christopher Faylor <cgf@redhat.com>
|
2002-12-13 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
Throughout, change fhandler_*::read and fhandler_*::raw_read to void
|
Throughout, change fhandler_*::read and fhandler_*::raw_read to void
|
||||||
|
|
|
@ -25,14 +25,14 @@ strchr (const char *s, int c)
|
||||||
register char * res;
|
register char * res;
|
||||||
__asm__ __volatile__ ("\
|
__asm__ __volatile__ ("\
|
||||||
movb %%al,%%ah\n\
|
movb %%al,%%ah\n\
|
||||||
1: movb (%1),%%al\n\
|
1: movb (%1),%%al\n\
|
||||||
cmpb %%ah,%%al\n\
|
cmpb %%ah,%%al\n\
|
||||||
je 2f\n\
|
je 2f\n\
|
||||||
incl %1\n\
|
incl %1\n\
|
||||||
testb %%al,%%al\n\
|
testb %%al,%%al\n\
|
||||||
jne 1b\n\
|
jne 1b\n\
|
||||||
xorl %1,%1\n\
|
xorl %1,%1\n\
|
||||||
2: movl %1,%0\n\
|
2: movl %1,%0\n\
|
||||||
":"=a" (res), "=r" (s)
|
":"=a" (res), "=r" (s)
|
||||||
:"0" (c), "1" (s));
|
:"0" (c), "1" (s));
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -1,43 +1,50 @@
|
||||||
#include_next "winbase.h"
|
#include_next "winbase.h"
|
||||||
|
|
||||||
#ifdef EXPCGF
|
|
||||||
#define DECLARE_TLS_STORAGE char **tls[4096] __attribute__ ((unused))
|
|
||||||
#else
|
|
||||||
#define DECLARE_TLS_STORAGE do {} while (0)
|
|
||||||
#define _WINBASE2_H
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _WINBASE2_H
|
#ifndef _WINBASE2_H
|
||||||
#define _WINBASE2_H
|
#define _WINBASE2_H
|
||||||
|
|
||||||
extern __inline__ long ilockincr (long *m)
|
extern __inline__ long
|
||||||
|
ilockincr (long *m)
|
||||||
{
|
{
|
||||||
register int __res;
|
register int __res;
|
||||||
__asm__ __volatile__ ("\n\
|
__asm__ __volatile__ ("\n\
|
||||||
movl $1,%0\n\
|
movl $1,%0\n\
|
||||||
lock xadd %0,(%1)\n\
|
lock xadd %0,(%1)\n\
|
||||||
inc %0\n\
|
inc %0\n\
|
||||||
": "=a" (__res), "=r" (m): "1" (m));
|
": "=a" (__res), "=q" (m): "1" (m));
|
||||||
return __res;
|
return __res;
|
||||||
}
|
}
|
||||||
extern __inline__ long ilockdecr (long *m)
|
|
||||||
|
extern __inline__ long
|
||||||
|
ilockdecr (long *m)
|
||||||
{
|
{
|
||||||
register int __res;
|
register int __res;
|
||||||
__asm__ __volatile__ ("\n\
|
__asm__ __volatile__ ("\n\
|
||||||
movl $0xffffffff,%0\n\
|
movl $0xffffffff,%0\n\
|
||||||
lock xadd %0,(%1)\n\
|
lock xadd %0,(%1)\n\
|
||||||
dec %0\n\
|
dec %0\n\
|
||||||
": "=a" (__res), "=r" (m): "1" (m));
|
": "=a" (__res), "=q" (m): "1" (m));
|
||||||
return __res;
|
return __res;
|
||||||
}
|
}
|
||||||
extern __inline__ long ilockexch (long *t, long v)
|
|
||||||
|
extern __inline__ long
|
||||||
|
ilockexch (long *t, long v)
|
||||||
{
|
{
|
||||||
register int __res;
|
register int __res;
|
||||||
__asm__ __volatile__ ("\n\
|
__asm__ __volatile__ ("\n\
|
||||||
movl (%2),%0\n\
|
|
||||||
1: lock cmpxchgl %3,(%1)\n\
|
1: lock cmpxchgl %3,(%1)\n\
|
||||||
jne 1b\n\
|
jne 1b\n\
|
||||||
": "=a" (__res), "=c" (t): "1" (t), "d" (v));
|
": "=a" (__res), "=q" (t): "1" (t), "q" (v), "0" (*t));
|
||||||
|
return __res;
|
||||||
|
}
|
||||||
|
|
||||||
|
extern __inline__ long
|
||||||
|
ilockcmpexch (long *t, long v, long c)
|
||||||
|
{
|
||||||
|
register int __res;
|
||||||
|
__asm__ __volatile__ ("\n\
|
||||||
|
lock cmpxchgl %3,(%1)\n\
|
||||||
|
": "=a" (__res), "=q" (t) : "1" (t), "q" (v), "0" (c));
|
||||||
return __res;
|
return __res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +54,13 @@ extern __inline__ long ilockexch (long *t, long v)
|
||||||
#define InterlockedDecrement ilockdecr
|
#define InterlockedDecrement ilockdecr
|
||||||
#undef InterlockedExchange
|
#undef InterlockedExchange
|
||||||
#define InterlockedExchange ilockexch
|
#define InterlockedExchange ilockexch
|
||||||
|
#undef InterlockedCompareExchange
|
||||||
|
#define InterlockedCompareExchange ilockcmpexch
|
||||||
|
|
||||||
|
#ifndef EXPCGf
|
||||||
|
#define DECLARE_TLS_STORAGE do {} while (0)
|
||||||
|
#else
|
||||||
|
#define DECLARE_TLS_STORAGE char **tls[4096] __attribute__ ((unused))
|
||||||
extern long tls_ix;
|
extern long tls_ix;
|
||||||
extern char * volatile *__stackbase __asm__ ("%fs:4");
|
extern char * volatile *__stackbase __asm__ ("%fs:4");
|
||||||
|
|
||||||
|
@ -87,4 +100,5 @@ my_tlsfree (DWORD ix)
|
||||||
#define TlsSetValue my_tlssetvalue
|
#define TlsSetValue my_tlssetvalue
|
||||||
#undef TlsFree
|
#undef TlsFree
|
||||||
#define TlsFree my_tlsfree
|
#define TlsFree my_tlsfree
|
||||||
|
#endif /*EXPCGF*/
|
||||||
#endif /*_WINBASE2_H*/
|
#endif /*_WINBASE2_H*/
|
||||||
|
|
Loading…
Reference in New Issue