Re: [5] include/winnt.h
Filip Navara <xnavara-VIXq6x/[email protected]> Thu, 01 Jan 2004 11:42:48 +0100
| Newsgroups | gmane.comp.gnu.mingw.patches |
|---|---|
| Message-ID | <[email protected]> |
Hi Danny! See comments below. Danny Smith wrote: >+typedef LONG (NTAPI *PVECTORED_EXCEPTION_HANDLER)(struct >_EXCEPTION_POINTERS*); >+ > >Above conflicts with current typedef of PVECTORED_EXCEPTION_HANDLER and >with documentation at >http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/b >ase/vectoredhandler.asp > > > To be more precise, it really doesn't conflict, because it has the same effect. In any case the definition is already there in the CVS version of w32api (commited by Dimitri Papadopoulos on 2003-10-07, 2003-10-09). >Regarding the NtCurrentTeb inlines. > >1) Why Alpha, MIPS and PPC versions? > > I wanted it be complete, but in any case it wasn't done right so I removed them. >2) Where are these documented?. > > Hmm, that's problem. I got couple of hits on google for it, about half of the were from Wine (which is unacceptable) and the most of the remaining pages are unavailable ATM. Originaly I found it when I was compiling program with MSVC and then with MinGW. If you want I can provide a simple test case that compiles with MSVC + Platform SDK, but not with MinGW + w32api because of missing NtCurrectTeb. >3) This breaks WATCOM usage which defines _M_IX86 but doesn't use AT&T >asm > > If you look at the patch more closely, it doesn't break Watcom, because it's already in the __GNUC__ block along with two other inline assambler functions. Unfortunetly I can't provide inline version for Watcom because I don't know the syntax for inserting inline assambler. >Danny > Attached is updated patch against the current CVS. Regards, Filip Changelog: 2004-01-01 Filip Navara <xnavara-VIXq6x/[email protected]> * include/winnt.h: Added declaration of NtCurrentTeb.
winnt.h.diff
(text/plain, 416 B)
--- w32api\include\winnt.h Mon Dec 1 09:11:42 2003
+++ w32api\include\winnt.h Thu Jan 1 10:36:18 2004
@@ -3303,6 +3303,19 @@
return ret;
}
+static __inline__ struct _TEB * NtCurrentTeb(void)
+{
+ struct _TEB *ret;
+
+ __asm__ __volatile__ (
+ "movl %%fs:0x18, %0\n"
+ : "=r" (ret)
+ : /* no inputs */
+ );
+
+ return ret;
+}
+
#else
extern PVOID GetCurrentFiber(void);