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 | // File: dacglobals.cpp |
6 | // |
7 | |
8 | // |
9 | // The DAC global pointer table |
10 | // |
11 | //***************************************************************************** |
12 | |
13 | #include "stdafx.h" |
14 | #include <daccess.h> |
15 | |
16 | // This header include will need to be rmeoved as part of GitHub#12170. |
17 | // The only reason it's here now is that this file references the GC-private |
18 | // variable g_HandleTableMap. |
19 | #include "../../gc/objecthandle.h" |
20 | #include "../../vm/virtualcallstub.h" |
21 | #include "../../vm/win32threadpool.h" |
22 | #include "../../vm/hillclimbing.h" |
23 | #include "../../vm/codeman.h" |
24 | #include "../../vm/eedbginterfaceimpl.h" |
25 | #include "../../vm/common.h" |
26 | #include "../../vm/gcenv.h" |
27 | #include "../../vm/ecall.h" |
28 | #include "../../vm/rcwwalker.h" |
29 | |
30 | #ifdef DEBUGGING_SUPPORTED |
31 | |
32 | extern PTR_ECHash gFCallMethods; |
33 | extern TADDR gLowestFCall; |
34 | extern TADDR gHighestFCall; |
35 | extern PCODE g_FCDynamicallyAssignedImplementations; |
36 | extern DWORD gThreadTLSIndex; |
37 | extern DWORD gAppDomainTLSIndex; |
38 | |
39 | #ifdef FEATURE_APPX |
40 | extern BOOL g_fAppX; |
41 | #endif // FEATURE_APPX |
42 | |
43 | DacGlobals g_dacTable; |
44 | |
45 | // DAC global pointer table initialization |
46 | void DacGlobals::Initialize() |
47 | { |
48 | TADDR baseAddress = PTR_TO_TADDR(PAL_GetSymbolModuleBase((void *)DacGlobals::Initialize)); |
49 | g_dacTable.InitializeEntries(baseAddress); |
50 | } |
51 | |
52 | // Initializes the non-SVR table entries |
53 | void DacGlobals::InitializeEntries(TADDR baseAddress) |
54 | { |
55 | #define DEFINE_DACVAR(id_type, size, id, var) id = PTR_TO_TADDR(&var) - baseAddress; |
56 | #define DEFINE_DACVAR_NO_DUMP(id_type, size, id, var) id = PTR_TO_TADDR(&var) - baseAddress; |
57 | #include "dacvars.h" |
58 | |
59 | #define VPTR_CLASS(name) \ |
60 | { \ |
61 | void *pBuf = _alloca(sizeof(name)); \ |
62 | name *dummy = new (pBuf) name(0); \ |
63 | name##__vtAddr = PTR_TO_TADDR(*((PVOID*)dummy)) - baseAddress; \ |
64 | } |
65 | #define VPTR_MULTI_CLASS(name, keyBase) \ |
66 | { \ |
67 | void *pBuf = _alloca(sizeof(name)); \ |
68 | name *dummy = new (pBuf) name(0); \ |
69 | name##__##keyBase##__mvtAddr = PTR_TO_TADDR(*((PVOID*)dummy)) - baseAddress; \ |
70 | } |
71 | #include <vptr_list.h> |
72 | #undef VPTR_CLASS |
73 | #undef VPTR_MULTI_CLASS |
74 | } |
75 | |
76 | #endif // DEBUGGER_SUPPORTED |
77 | |