// DAC global pointer table initialization void DacGlobals::Initialize() { TADDR baseAddress = PTR_TO_TADDR(PAL_GetSymbolModuleBase((void *)DacGlobals::Initialize)); g_dacTable.InitializeEntries(baseAddress); #ifdef FEATURE_SVR_GC g_dacTable.InitializeSVREntries(baseAddress); #endif }
void StressLog::Initialize(unsigned facilities, unsigned level, unsigned maxBytesPerThread, unsigned maxBytesTotal, HMODULE hMod) { STATIC_CONTRACT_LEAF; if (theLog.MaxSizePerThread != 0) { // guard ourself against multiple initialization. First init wins. return; } _ASSERTE (theLog.TLSslot == (unsigned int)TLS_OUT_OF_INDEXES); theLog.lock = ClrCreateCriticalSection(CrstStressLog,(CrstFlags)(CRST_UNSAFE_ANYMODE|CRST_DEBUGGER_THREAD)); // StressLog::Terminate is going to free memory. if (maxBytesPerThread < STRESSLOG_CHUNK_SIZE) { maxBytesPerThread = STRESSLOG_CHUNK_SIZE; } theLog.MaxSizePerThread = maxBytesPerThread; if (maxBytesTotal < STRESSLOG_CHUNK_SIZE * 256) { maxBytesTotal = STRESSLOG_CHUNK_SIZE * 256; } theLog.MaxSizeTotal = maxBytesTotal; theLog.totalChunk = 0; theLog.facilitiesToLog = facilities | LF_ALWAYS; theLog.levelToLog = level; theLog.deadCount = 0; theLog.TLSslot = TlsIdx_StressLog; theLog.tickFrequency = getTickFrequency(); GetSystemTimeAsFileTime (&theLog.startTime); theLog.startTimeStamp = getTimeStamp(); #ifndef FEATURE_PAL theLog.moduleOffset = (SIZE_T)hMod; // HMODULES are base addresses. #ifdef _DEBUG HMODULE hModNtdll = GetModuleHandleA("ntdll.dll"); theLog.RtlCaptureStackBackTrace = reinterpret_cast<PFNRtlCaptureStackBackTrace>( GetProcAddress(hModNtdll, "RtlCaptureStackBackTrace")); #endif // _DEBUG #else // !FEATURE_PAL theLog.moduleOffset = (SIZE_T)PAL_GetSymbolModuleBase((void *)StressLog::Initialize); #endif // !FEATURE_PAL #if !defined (STRESS_LOG_READONLY) StressLogChunk::s_LogChunkHeap = ClrHeapCreate (0, STRESSLOG_CHUNK_SIZE * 128, 0); if (StressLogChunk::s_LogChunkHeap == NULL) { StressLogChunk::s_LogChunkHeap = ClrGetProcessHeap (); } _ASSERTE (StressLogChunk::s_LogChunkHeap); #endif //!STRESS_LOG_READONLY }
// DAC global pointer table initialization void DacGlobals::Initialize() { TADDR baseAddress = PTR_TO_TADDR(PAL_GetSymbolModuleBase((void *)DacGlobals::Initialize)); g_dacTable.InitializeEntries(baseAddress); #ifdef FEATURE_SVR_GC g_dacTable.InitializeSVREntries(baseAddress); #endif PAL_PublishDacTableAddress((PVOID)baseAddress, &g_dacTable, sizeof(g_dacTable)); }