h3, fxglide.h, gthread.c: copy over gcc compatibility changes from h5.

This commit is contained in:
sezero
2018-08-10 20:38:57 +03:00
parent 8a406cba3d
commit 797d81af4a
2 changed files with 17 additions and 17 deletions

View File

@@ -1891,13 +1891,21 @@ _grSstVRetraceOn(void);
#define WNT_TEB_TLS_OFFSET 0xE10
#define WNT_TLS_INDEX_TO_OFFSET(i) ((i)*sizeof(DWORD)+WNT_TEB_TLS_OFFSET)
#define __GR_GET_TLSC_VALUE() \
__asm { \
__asm mov eax, DWORD PTR fs:[WNT_TEB_PTR] \
__asm add eax, DWORD PTR _GlideRoot.tlsOffset \
__asm mov eax, DWORD PTR [eax] \
#ifdef __GNUC__
extern __inline FxU32 getThreadValueFast (void)
{
FxU32 t;
__asm __volatile (" \
mov %%fs:(%0), %%eax; \
add %1, %%eax; \
mov (%%eax), %%eax; \
":"=a"(t):"i"(WNT_TEB_PTR), "g"(_GlideRoot.tlsOffset));
return t;
}
#else /* __GNUC__ */
#pragma warning (4:4035) /* No return value */
__inline FxU32
getThreadValueFast() {
@@ -1907,7 +1915,7 @@ getThreadValueFast() {
__asm mov eax, DWORD PTR [eax]
}
}
#pragma warning (3:4035)
#endif /* __GNUC__ */
#endif
#if (GLIDE_PLATFORM & GLIDE_OS_MACOS)

View File

@@ -63,19 +63,11 @@ void setThreadValue( unsigned long value ) {
TlsSetValue( _GlideRoot.tlsIndex, (void*)value );
}
#pragma warning (4:4035) /* No return value */
unsigned long getThreadValueSLOW( void ) {
unsigned long getThreadValueSLOW( void )
{
GR_CHECK_F( "getThreadValue", !threadInit, "Thread storage not initialized\n" );
#if 0
return (FxU32)TlsGetValue( _GlideRoot.tlsIndex );
#elif 1
__GR_GET_TLSC_VALUE();
#else
__asm {
__asm mov esi, DWORD PTR fs:[WNT_TEB_PTR]
__asm add esi, DWORD PTR _GlideRoot.tlsOffset \
__asm mov eax, DWORD PTR [esi] \
return getThreadValueFast();
}
#endif