* include/winnt.h (GetCurrentFiber): Support -masm=intel.

(GetFiberData): Likewise.
	(NtCurrentTeb): Likewise.
This commit is contained in:
Danny Smith 2004-11-08 10:08:13 +00:00
parent 7e9d30a43f
commit 65fb2e4311
2 changed files with 48 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2004-11-08 Danny Smith <dannysmith@users.sourceforge.net>
* include/winnt.h (GetCurrentFiber): Support -masm=intel.
(GetFiberData): Likewise.
(NtCurrentTeb): Likewise.
2004-11-04 Danny Smith <dannysmith@users.sourceforge.net> 2004-11-04 Danny Smith <dannysmith@users.sourceforge.net>
* include/wingdi.h (NIF_INFO): Add define. * include/wingdi.h (NIF_INFO): Add define.

View File

@ -3324,9 +3324,48 @@ typedef OSVERSIONINFOEXA OSVERSIONINFOEX,*POSVERSIONINFOEX,*LPOSVERSIONINFOEX;
ULONGLONG WINAPI VerSetConditionMask(ULONGLONG,DWORD,BYTE); ULONGLONG WINAPI VerSetConditionMask(ULONGLONG,DWORD,BYTE);
#endif #endif
#if defined(__GNUC__)
PVOID GetCurrentFiber(void); PVOID GetCurrentFiber(void);
PVOID GetFiberData(void);
#if defined(__GNUC__)
#if (__GNUC__ >= 3)
/* Support -masm=intel. */
extern __inline__ PVOID GetCurrentFiber(void)
{
void* ret;
__asm__ __volatile__ (
"mov{l} {%%fs:0x10,%0|%0,%%fs:0x10}"
: "=r" (ret) /* allow use of reg eax,ebx,ecx,edx,esi,edi */
);
return ret;
}
extern __inline__ PVOID GetFiberData(void)
{
void* ret;
__asm__ __volatile__ (
"mov{l} {%%fs:0x10,%0|%0,%%fs:0x10}\n\t"
"mov{l} {(%0),%0|%0,[%0]}"
: "=r" (ret) /* allow use of reg eax,ebx,ecx,edx,esi,edi */
);
return ret;
}
static __inline__ struct _TEB * NtCurrentTeb(void)
{
struct _TEB *ret;
__asm__ __volatile__ (
"mov{l} {%%fs:0x18,%0|%0,%%fs:0x18}\n"
: "=r" (ret)
: /* no inputs */
);
return ret;
}
#else /* __GNUC__ >= 3 */
extern __inline__ PVOID GetCurrentFiber(void) extern __inline__ PVOID GetCurrentFiber(void)
{ {
void* ret; void* ret;
@ -3337,12 +3376,11 @@ extern __inline__ PVOID GetCurrentFiber(void)
return ret; return ret;
} }
PVOID GetFiberData(void);
extern __inline__ PVOID GetFiberData(void) extern __inline__ PVOID GetFiberData(void)
{ {
void* ret; void* ret;
__asm__ __volatile__ ( __asm__ __volatile__ (
"movl %%fs:0x10,%0\n" "movl %%fs:0x10,%0\n\t"
"movl (%0),%0" "movl (%0),%0"
: "=r" (ret) /* allow use of reg eax,ebx,ecx,edx,esi,edi */ : "=r" (ret) /* allow use of reg eax,ebx,ecx,edx,esi,edi */
); );
@ -3358,19 +3396,17 @@ static __inline__ struct _TEB * NtCurrentTeb(void)
: "=r" (ret) : "=r" (ret)
: /* no inputs */ : /* no inputs */
); );
return ret; return ret;
} }
#endif /* __GNUC__ >= 3 */
#else #else
extern PVOID GetCurrentFiber(void);
#pragma aux GetCurrentFiber = \ #pragma aux GetCurrentFiber = \
"mov eax, dword ptr fs:0x10" \ "mov eax, dword ptr fs:0x10" \
value [eax] \ value [eax] \
modify [eax]; modify [eax];
extern PVOID GetFiberData(void);
#pragma aux GetFiberData = \ #pragma aux GetFiberData = \
"mov eax, dword ptr fs:0x10" \ "mov eax, dword ptr fs:0x10" \
"mov eax, [eax]" \ "mov eax, [eax]" \