[runtime] Applied patch from Frank Fuchs <fk.fuchs@googlemail.com>. Add win64 support...
authorZoltan Varga <vargaz@gmail.com>
Mon, 3 Feb 2014 21:15:30 +0000 (22:15 +0100)
committerZoltan Varga <vargaz@gmail.com>
Mon, 3 Feb 2014 21:15:30 +0000 (22:15 +0100)
mono/utils/mono-threads-windows.c

index 23696c031e5ca4b7a05073246d0ef28f52d5ab6e..cd873c06af9a53428ad296d36d66bd241cb79b03 100644 (file)
@@ -191,11 +191,18 @@ __readfsdword (unsigned long offset)
 void
 mono_threads_core_get_stack_bounds (guint8 **staddr, size_t *stsize)
 {
-       /* Windows */
+#ifdef TARGET_AMD64
+       /* win7 apis */
+       PNT_TIB ptib = (PNT_TIB)NtCurrentTeb();
+       NT_TIB* tib = (NT_TIB*)NtCurrentTeb();
+       guint8 *stackTop = (guint8*)tib->StackBase;
+       guint8 *stackBottom = (guint8*)tib->StackLimit;
+#else
        /* http://en.wikipedia.org/wiki/Win32_Thread_Information_Block */
        void* tib = (void*)__readfsdword(0x18);
        guint8 *stackTop = (guint8*)*(int*)((char*)tib + 4);
        guint8 *stackBottom = (guint8*)*(int*)((char*)tib + 8);
+#endif
 
        *staddr = stackBottom;
        *stsize = stackTop - stackBottom;