diff --git a/winsup/w32api/ChangeLog b/winsup/w32api/ChangeLog index a6ab54ed8..0f863cbe6 100644 --- a/winsup/w32api/ChangeLog +++ b/winsup/w32api/ChangeLog @@ -1,3 +1,9 @@ +2004-11-08 Danny Smith + + * include/winnt.h (GetCurrentFiber): Support -masm=intel. + (GetFiberData): Likewise. + (NtCurrentTeb): Likewise. + 2004-11-04 Danny Smith * include/wingdi.h (NIF_INFO): Add define. diff --git a/winsup/w32api/include/winnt.h b/winsup/w32api/include/winnt.h index 024831354..01fe572ac 100644 --- a/winsup/w32api/include/winnt.h +++ b/winsup/w32api/include/winnt.h @@ -3324,9 +3324,48 @@ typedef OSVERSIONINFOEXA OSVERSIONINFOEX,*POSVERSIONINFOEX,*LPOSVERSIONINFOEX; ULONGLONG WINAPI VerSetConditionMask(ULONGLONG,DWORD,BYTE); #endif -#if defined(__GNUC__) 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) { void* ret; @@ -3337,12 +3376,11 @@ extern __inline__ PVOID GetCurrentFiber(void) return ret; } -PVOID GetFiberData(void); extern __inline__ PVOID GetFiberData(void) { void* ret; __asm__ __volatile__ ( - "movl %%fs:0x10,%0\n" + "movl %%fs:0x10,%0\n\t" "movl (%0),%0" : "=r" (ret) /* allow use of reg eax,ebx,ecx,edx,esi,edi */ ); @@ -3358,19 +3396,17 @@ static __inline__ struct _TEB * NtCurrentTeb(void) : "=r" (ret) : /* no inputs */ ); - return ret; } +#endif /* __GNUC__ >= 3 */ #else -extern PVOID GetCurrentFiber(void); #pragma aux GetCurrentFiber = \ "mov eax, dword ptr fs:0x10" \ value [eax] \ modify [eax]; -extern PVOID GetFiberData(void); #pragma aux GetFiberData = \ "mov eax, dword ptr fs:0x10" \ "mov eax, [eax]" \