[ros-diffs] [tkreuzer] 49627: [NDK] Simplify NtCurrentTeb, always use intrinsics remove GetCurrentFiber

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Fri Nov 19 13:52:13 UTC 2010


Author: tkreuzer
Date: Fri Nov 19 13:52:12 2010
New Revision: 49627

URL: http://svn.reactos.org/svn/reactos?rev=49627&view=rev
Log:
[NDK]
Simplify NtCurrentTeb, always use intrinsics
remove GetCurrentFiber

Modified:
    branches/cmake-bringup/include/ndk/inline_ntcurrentteb.h

Modified: branches/cmake-bringup/include/ndk/inline_ntcurrentteb.h
URL: http://svn.reactos.org/svn/reactos/branches/cmake-bringup/include/ndk/inline_ntcurrentteb.h?rev=49627&r1=49626&r2=49627&view=diff
==============================================================================
--- branches/cmake-bringup/include/ndk/inline_ntcurrentteb.h [iso-8859-1] (original)
+++ branches/cmake-bringup/include/ndk/inline_ntcurrentteb.h [iso-8859-1] Fri Nov 19 13:52:12 2010
@@ -1,20 +1,10 @@
 #ifndef _INLINE_NT_CURRENTTEB_H_
 #define _INLINE_NT_CURRENTTEB_H_
-
-#ifdef __GNUC__
 
 #if defined(_M_IX86)
 FORCEINLINE struct _TEB * NtCurrentTeb(void)
 {
-    struct _TEB *ret;
-
-    __asm__ __volatile__ (
-        "movl %%fs:0x18, %0\n"
-        : "=r" (ret)
-        : /* no inputs */
-    );
-
-    return ret;
+    return (struct _TEB *)__readfsdword(0x18);
 }
 #elif defined(_M_ARM)
 
@@ -24,63 +14,17 @@
 #include <armddk.h>
 
 #elif defined(_M_AMD64)
-FORCEINLINE struct _TEB * NtCurrentTeb(VOID)
+FORCEINLINE struct _TEB * NtCurrentTeb(void)
 {
     return (struct _TEB *)__readgsqword(FIELD_OFFSET(NT_TIB, Self));
 }
 #elif defined(_M_PPC)
-extern __inline__ struct _TEB * NtCurrentTeb(void)
+FORCEINLINE struct _TEB * NtCurrentTeb(void)
 {
-    return __readfsdword_winnt(0x18);
+    return (struct _TEB *)__readfsdword_winnt(0x18);
 }
 #else
-extern __inline__ struct _TEB * NtCurrentTeb(void)
-{
-    return __readfsdword_winnt(0x18);
-}
+#error Unsupported architecture
 #endif
 
-#elif defined(__WATCOMC__)
-
-extern PVOID GetCurrentFiber(void);
-#pragma aux GetCurrentFiber = \
-        "mov	eax, dword ptr fs:0x10" \
-        value [eax] \
-        modify [eax];
-
-extern struct _TEB * NtCurrentTeb(void);
-#pragma aux NtCurrentTeb = \
-        "mov	eax, dword ptr fs:0x18" \
-        value [eax] \
-        modify [eax];
-
-#elif defined(_MSC_VER)
-
-#if (_MSC_FULL_VER >= 13012035)
-
-__inline PVOID GetCurrentFiber(void) { return (PVOID)(ULONG_PTR)__readfsdword(0x10); }
-__inline struct _TEB * NtCurrentTeb(void) { return (struct _TEB *)(ULONG_PTR)__readfsdword(0x18); }
-
-#else
-
-static __inline PVOID GetCurrentFiber(void)
-{
-    PVOID p;
-	__asm mov eax, fs:[10h]
-	__asm mov [p], eax
-    return p;
-}
-
-static __inline struct _TEB * NtCurrentTeb(void)
-{
-    struct _TEB *p;
-	__asm mov eax, fs:[18h]
-	__asm mov [p], eax
-    return p;
-}
-
-#endif /* _MSC_FULL_VER */
-
-#endif /* __GNUC__/__WATCOMC__/_MSC_VER */
-
 #endif//_INLINE_NT_CURRENTTEB_H_




More information about the Ros-diffs mailing list