Changeset 75289 in webkit
- Timestamp:
- Jan 7, 2011 3:59:18 PM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r75269 r75289 1 2011-01-07 Gavin Barraclough <barraclough@apple.com> 2 3 Reviewed by Geoff Garen. 4 5 Bug 26276 - Need a mechanism to determine stack extent on WINDOWS, SOLARIS, OPENBSD, SYMBIAN, HAIKU, WINCE platforms 6 7 Fix for win32. The base of the stack is stored in the "deallocation stack" field of the 8 Thread Information Block - see: http://en.wikipedia.org/wiki/Win32_Thread_Information_Block 9 for more information! 10 11 * wtf/StackBounds.cpp: 12 (WTF::StackBounds::initialize): 13 1 14 2011-01-07 Adam Roben <aroben@apple.com> 2 15 -
trunk/Source/JavaScriptCore/wtf/StackBounds.cpp
r75190 r75289 61 61 // 62 62 // These platforms should now be working correctly: 63 // DARWIN, QNX, UNIX63 // DARWIN, WINDOWS-CPU(X86), QNX, UNIX, WINCE 64 64 // These platforms are not: 65 // WINDOWS , SOLARIS, OPENBSD, SYMBIAN, HAIKU, WINCE65 // WINDOWS-CPU(X86_64), SOLARIS, OPENBSD, SYMBIAN, HAIKU 66 66 // 67 67 // FIXME: remove this! - this code unsafely guesses at stack sizes! 68 #if OS(WINDOWS) || OS(SOLARIS) || OS(OPENBSD) || OS(SYMBIAN) || OS(HAIKU)68 #if (OS(WINDOWS) && CPU(X86_64)) || OS(SOLARIS) || OS(OPENBSD) || OS(SYMBIAN) || OS(HAIKU) 69 69 // Based on the current limit used by the JSC parser, guess the stack size. 70 70 static const ptrdiff_t estimatedStackSize = 128 * sizeof(void*) * 1024; … … 248 248 } 249 249 250 #elif OS(WINDOWS) 251 252 void StackBounds::initialize() 253 { 254 #if CPU(X86) && COMPILER(MSVC)255 // offset 0x18 from the FS segment register gives a pointer to256 // the thread information block for the current thread 250 #elif OS(WINDOWS) && (CPU(X86) || CPU(X86_64)) 251 252 void StackBounds::initialize() 253 { 254 #if CPU(X86) 255 // Offset 0x18 from the FS segment register gives a pointer to 256 // the thread information block for the current thread. 257 257 NT_TIB* pTib; 258 #if COMPILER(MSVC) 258 259 __asm { 259 260 MOV EAX, FS:[18h] 260 261 MOV pTib, EAX 261 262 } 262 m_origin = static_cast<void*>(pTib->StackBase); 263 #elif CPU(X86) && COMPILER(GCC) 264 // offset 0x18 from the FS segment register gives a pointer to 265 // the thread information block for the current thread 266 NT_TIB* pTib; 263 #else 267 264 asm ( "movl %%fs:0x18, %0\n" 268 265 : "=r" (pTib) 269 266 ); 267 #endif 268 // See http://en.wikipedia.org/wiki/Win32_Thread_Information_Block for more information! 269 void* pDeallocationStack = reinterpret_cast<char*>(pTib) + 0xE0C; 270 270 m_origin = static_cast<void*>(pTib->StackBase); 271 m_bound = *static_cast<void**>(pDeallocationStack); 271 272 #elif CPU(X86_64) 272 273 PNT_TIB64 pTib = reinterpret_cast<PNT_TIB64>(NtCurrentTeb()); 273 274 m_origin = reinterpret_cast<void*>(pTib->StackBase); 275 m_bound = estimateStackBound(m_origin); 276 #endif 277 } 278 274 279 #else 275 #error Need a way to get the stack bounds on this platform (Windows) 276 #endif 277 // Looks like we should be able to get pTib->StackLimit 278 m_bound = estimateStackBound(m_origin); 279 } 280 281 #else 282 #error Need a way to get the stack bounds on this platform 280 #error Need a way to get the stack bounds on this platform. 283 281 #endif 284 282
Note: See TracChangeset
for help on using the changeset viewer.