PATCH: ppc header fixes
Marcus Meissner
meissner at suse.de
Tue Jul 1 11:56:32 CDT 2003
Hi,
This provides inline versions of the interlocked functions for PowerPC.
Basically copy & paste from lib/port/interlocked.c.
They are needed because 2 of them lack in final wine link on ppc otherwise
(probably incomplete dll seperation).
Ciao, Marcus
Changelog:
PowerPC inline versions of the interlocked functions.
Index: include/winbase.h
===================================================================
RCS file: /home/wine/wine/include/winbase.h,v
retrieving revision 1.183
diff -u -r1.183 winbase.h
--- include/winbase.h 7 May 2003 03:21:26 -0000 1.183
+++ include/winbase.h 1 Jul 2003 16:51:10 -0000
@@ -1935,6 +1935,76 @@
return pdb[0x18 / sizeof(HANDLE)]; /* get dword at offset 0x18 in pdb */
}
+#elif defined(__GNUC__) && defined(__powerpc__)
+extern inline LONG WINAPI InterlockedCompareExchange( PLONG dest, LONG xchg, LONG compare );
+extern inline LONG WINAPI InterlockedCompareExchange( PLONG dest, LONG xchg, LONG compare )
+{
+ LONG ret = 0;
+ LONG scratch;
+ __asm__ (
+ "0: lwarx %0,0,%2\n"
+ " xor. %1,%4,%0\n"
+ " bne 1f\n"
+ " stwcx. %3,0,%2\n"
+ " bne- 0b\n"
+ " isync\n"
+ "1: "
+ : "=&r"(ret), "=&r"(scratch)
+ : "r"(dest), "r"(xchg), "r"(compare)
+ : "cr0","memory","r0");
+ return ret;
+}
+
+extern inline LONG WINAPI InterlockedExchange( PLONG dest, LONG val );
+extern inline LONG WINAPI InterlockedExchange( PLONG dest, LONG val )
+{
+ LONG ret = 0;
+ __asm__(
+ "0: lwarx %0,0,%1\n"
+ " stwcx. %2,0,%1\n"
+ " bne- 0b\n"
+ " isync\n"
+ : "=&r"(ret)
+ : "r"(dest), "r"(val)
+ : "cr0","memory","r0");
+ return ret;
+}
+
+extern inline LONG WINAPI InterlockedExchangeAdd( PLONG dest, LONG incr );
+extern inline LONG WINAPI InterlockedExchangeAdd( PLONG dest, LONG incr )
+{
+ LONG ret = 0;
+ LONG zero = 0;
+ __asm__(
+ "0: lwarx %0, %3, %1\n"
+ " add %0, %2, %0\n"
+ " stwcx. %0, %3, %1\n"
+ " bne- 0b\n"
+ " isync\n"
+ : "=&r" (ret)
+ : "r"(dest), "r"(incr), "r"(zero)
+ : "cr0", "memory", "r0"
+ );
+ return ret-incr;
+}
+
+extern inline LONG WINAPI InterlockedIncrement( PLONG dest );
+extern inline LONG WINAPI InterlockedIncrement( PLONG dest )
+{
+ return InterlockedExchangeAdd( dest, 1 ) + 1;
+}
+
+extern inline LONG WINAPI InterlockedDecrement( PLONG dest );
+extern inline LONG WINAPI InterlockedDecrement( PLONG dest )
+{
+ return InterlockedExchangeAdd( dest, -1 ) - 1;
+}
+
+DWORD WINAPI GetLastError(void);
+DWORD WINAPI GetCurrentProcessId(void);
+DWORD WINAPI GetCurrentThreadId(void);
+void WINAPI SetLastError( DWORD err );
+HANDLE WINAPI GetProcessHeap(void);
#else /* __i386__ && __GNUC__ */
DWORD WINAPI GetCurrentProcessId(void);
DWORD WINAPI GetCurrentThreadId(void);
More information about the wine-patches
mailing list