private unsafe void Initialize(int processorId) { uint DefaultStackSize = 0xA000; processorTable[processorId] = this; context = (ProcessorContext *)Isa.GetCurrentCpu(); DebugStub.WriteLine("Processor context: {0} {1:x8}", __arglist(processorId, Kernel.AddressOf(context))); context->UpdateAfterGC(this); if (0 != processorId) { Thread.BindKernelThread(kernelThread, kernelStackBegin, kernelStackLimit); } AllocateStack(DefaultStackSize, out context->cpuRecord.interruptStackBegin, out context->cpuRecord.interruptStackLimit); Tracing.Log(Tracing.Debug, "Initialized Processor {0}", (UIntPtr)processorId); Tracing.Log(Tracing.Debug, "asmInterruptStack={0:x}..{1:x}", context->cpuRecord.interruptStackBegin, context->cpuRecord.interruptStackLimit); #if false DebugStub.WriteLine("proc{0}: InterruptStack={1:x}..{2:x}", __arglist( processorId, context->cpuRecord.interruptStackBegin, context->cpuRecord.interruptStackLimit )); #endif Interlocked.Increment(ref runningCpus); MpExecution.AddProcessorContext(context); // Need to allocate this callback object outside of NoThreadAllocation region if (processorId == 0) { resumeThreadCallback = new ResumeThreadCallback(); } Isa.EnableCycleCounter(); }