diff options
author | Danny Smith <dannysmith@users.sourceforge.net> | 2004-11-08 10:08:13 +0000 |
---|---|---|
committer | Danny Smith <dannysmith@users.sourceforge.net> | 2004-11-08 10:08:13 +0000 |
commit | 65fb2e431128dd807c49040a52760b32de24dab0 (patch) | |
tree | 0b63fdce781fbbf9b3c9ad5be89b0f2605ed4513 /winsup/w32api/include/winnt.h | |
parent | 7e9d30a43f9366b50189569177dedc02c2b19207 (diff) | |
download | cygnal-65fb2e431128dd807c49040a52760b32de24dab0.tar.gz cygnal-65fb2e431128dd807c49040a52760b32de24dab0.tar.bz2 cygnal-65fb2e431128dd807c49040a52760b32de24dab0.zip |
* include/winnt.h (GetCurrentFiber): Support -masm=intel.
(GetFiberData): Likewise.
(NtCurrentTeb): Likewise.
Diffstat (limited to 'winsup/w32api/include/winnt.h')
-rw-r--r-- | winsup/w32api/include/winnt.h | 48 |
1 files changed, 42 insertions, 6 deletions
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]" \ |