1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4
5
6
7#ifndef __PREDEFTLSSLOT_H__
8#define __PREDEFTLSSLOT_H__
9
10
11// And here are the predefined slots for accessing TLS from various DLLs of the CLR.
12// Note that we want to support combinations of Debug and Retail DLLs for testing
13// purposes, so we burn the slots into the retail EE even if a debug CLR dll needs
14// them.
15enum PredefinedTlsSlots
16{
17 TlsIdx_StrongName,
18 TlsIdx_JitPerf,
19 TlsIdx_JitX86Perf,
20 TlsIdx_JitLogEnv,
21 TlsIdx_IceCap,
22 TlsIdx_StressLog,
23 TlsIdx_StackProbe,
24 TlsIdx_Check,
25 TlsIdx_ForbidGCLoaderUseCount,
26 TlsIdx_ClrDebugState, // Pointer to ClrDebugState* structure
27 TlsIdx_StressThread,
28
29 // Add more indices here.
30 TlsIdx_ThreadType, // bit flags to indicate special thread's type
31 TlsIdx_CantStopCount, // Can't-stop counter for any thread
32 TlsIdx_OwnedCrstsChain, // slot to store the Crsts owned by this thread
33 TlsIdx_AppDomainAgilePendingTable,
34 TlsIdx_CantAllocCount, //Can't allocate memory on heap in this thread
35 TlsIdx_AssertDlgStatus, // Whether the thread is displaying an assert dialog
36
37 // A transient thread value that indicates this thread is currently walking its stack
38 // or the stack of another thread. This value is useful to help short-circuit
39 // some problematic checks in the loader, guarantee that types & assemblies
40 // encountered during the walk must already be loaded, and provide information to control
41 // assembly loading behavior during stack walks.
42 //
43 // This value is set around the main portions of the stack walk (as those portions may
44 // enter the type & assembly loaders). This is also explicitly cleared while the
45 // walking thread calls the stackwalker callback or needs to execute managed code, as
46 // such calls may execute arbitrary code unrelated to the actual stack walking, and
47 // may never return, in the case of exception stackwalk callbacks.
48 TlsIdx_StackWalkerWalkingThread, // Thread* that the stack walker is currently walking.
49
50 // Save the last exception info. Sometimes we need this info in our EX_CATCH, such as for SO.
51 // It will be better if VC can supply this in catch(...) block.
52 // !!! These data may become stale. Use it only inside exception handling code.
53 // !!! Please access these fields through GetCurrentExceptionPointers which validates the data to some level.
54 TlsIdx_EXCEPTION_CODE,
55 TlsIdx_PEXCEPTION_RECORD,
56 TlsIdx_PCONTEXT,
57
58 TlsIdx_SOIntolerantTransitionHandler, // The thread is entering SO intolerant code. This one is used by
59 // Thread::IsSOIntolerant to decide the SO mode of the thread.
60 MAX_PREDEFINED_TLS_SLOT
61};
62
63enum TlsThreadTypeFlag // flag used for thread type in Tls data
64{
65 ThreadType_GC = 0x00000001,
66 ThreadType_Timer = 0x00000002,
67 ThreadType_Gate = 0x00000004,
68 ThreadType_DbgHelper = 0x00000008,
69 ThreadType_Shutdown = 0x00000010,
70 ThreadType_DynamicSuspendEE = 0x00000020,
71 ThreadType_Finalizer = 0x00000040,
72 ThreadType_ADUnloadHelper = 0x00000200,
73 ThreadType_ShutdownHelper = 0x00000400,
74 ThreadType_Threadpool_IOCompletion = 0x00000800,
75 ThreadType_Threadpool_Worker = 0x00001000,
76 ThreadType_Wait = 0x00002000,
77 ThreadType_ProfAPI_Attach = 0x00004000,
78 ThreadType_ProfAPI_Detach = 0x00008000,
79 ThreadType_ETWRundownThread = 0x00010000,
80 ThreadType_GenericInstantiationCompare= 0x00020000, // Used to indicate that the thread is determining if a generic instantiation in an ngen image matches a lookup.
81};
82
83#endif
84
85