Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1231)

Unified Diff: runtime/vm/os_thread_win.cc

Issue 2680123004: VM: Teach GetAndValidateIsolateStackBounds(...) to fallback to OS thread stack bounds. (Closed)
Patch Set: Done Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/os_thread_win.cc
diff --git a/runtime/vm/os_thread_win.cc b/runtime/vm/os_thread_win.cc
index 759919514a1b492be29bf00e3f72351901d9adda..7d80d4d1ceeafa1d4d046e17d648a4876df988af 100644
--- a/runtime/vm/os_thread_win.cc
+++ b/runtime/vm/os_thread_win.cc
@@ -173,6 +173,21 @@ bool OSThread::Compare(ThreadId a, ThreadId b) {
}
+bool OSThread::GetCurrentStackBounds(uword* lower, uword* upper) {
+// On Windows stack limits for the current thread are available in
+// the thread information block (TIB). Its fields can be accessed through
+// FS segment register on x86 and GS segment register on x86_64.
+#ifdef _WIN64
+ *upper = static_cast<uword>(__readgsqword(offsetof(NT_TIB64, StackBase)));
+ *lower = static_cast<uword>(__readgsqword(offsetof(NT_TIB64, StackLimit)));
+#else
+ *upper = static_cast<uword>(__readfsdword(offsetof(NT_TIB, StackBase)));
+ *lower = static_cast<uword>(__readfsdword(offsetof(NT_TIB, StackLimit)));
+#endif
+ return true;
+}
+
+
void OSThread::SetThreadLocal(ThreadLocalKey key, uword value) {
ASSERT(key != kUnsetThreadLocalKey);
BOOL result = TlsSetValue(key, reinterpret_cast<void*>(value));
« no previous file with comments | « runtime/vm/os_thread_macos.cc ('k') | runtime/vm/profiler.cc » ('j') | runtime/vm/profiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698