[5] include/winnt.h

"Filip Navara" <xnavara-VIXq6x/[email protected]> Fri, 12 Dec 2003 21:18:22 +0100
Newsgroups gmane.comp.gnu.mingw.patches
Message-ID <00f701c3c0ed$176939a0$fc4cb13e@hornet>
patch5.log (application/octet-stream, 121 B)
2003-12-12  Filip Navara  <xnavara-VIXq6x/[email protected]>

	* include/winnt.h: Added declaration of NtCurrentTeb.
patch5.diff (application/octet-stream, 1014 B)
--- include/winnt.h	Fri Sep 12 13:24:46 2003
+++ include/winnt.h	Fri Dec 12 16:12:19 2003
@@ -3166,6 +3166,8 @@
 ULONGLONG WINAPI VerSetConditionMask(ULONGLONG,DWORD,BYTE);
 #endif
 
+typedef LONG (NTAPI *PVECTORED_EXCEPTION_HANDLER)(struct _EXCEPTION_POINTERS*);
+
 #if defined(__GNUC__)
 
 PVOID GetCurrentFiber(void);
@@ -3193,6 +3195,40 @@
 	);
     return ret;
 }
+
+
+#if defined(_M_IX86)
+
+static inline struct _TEB * NtCurrentTeb(void)
+{
+    struct _TEB *ret;
+
+    __asm__ volatile (
+        "movl %%fs:0x18, %0\n"
+        : "=r" (ret)
+        : /* no inputs */
+    );
+
+    return ret;
+}
+
+#elif defined(_M_ALPHA)
+
+void * __rdteb(void);
+#pragma intrinsic(__rdteb)
+#define NtCurrentTeb() ((struct _TEB *)__rdteb())
+
+#elif defined(_M_MIPS)
+
+#define NtCurrentTeb() ((struct _TEB *)0x7FFFF4A8)
+
+#elif defined(_M_PPC)
+
+unsigned __gregister_get(unsigned const regnum);
+#pragma intrinsic(__gregister_get)
+#define NtCurrentTeb() ((struct _TEB *)__gregister_get(13))
+
+#endif
 
 #else