Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

allproc.c File Reference

#include "ki.h"

Go to the source code of this file.

Defines

#define ROUND_UP(x)   ((sizeof(x) + 63) & (~63))
#define BLOCK1_SIZE   (2 * (KERNEL_BSTORE_SIZE + KERNEL_STACK_SIZE) + PAGE_SIZE)
#define BLOCK2_SIZE   (ROUND_UP(KPRCB) + ROUND_UP(ETHREAD) + 64)

Functions

VOID KiCalibratePerformanceCounter (VOID)
VOID KiCalibratePerformanceCounterTarget (IN PULONG SignalDone, IN PVOID Count, IN PVOID Parameter2, IN PVOID Parameter3)
VOID KiOSRendezvous (VOID)
VOID KeStartAllProcessors (VOID)

Variables

ULONG KiBarrierWait = 0
ULONG_PTR KiUserSharedDataPage
ULONG_PTR KiKernelPcrPage


Define Documentation

#define BLOCK1_SIZE   (2 * (KERNEL_BSTORE_SIZE + KERNEL_STACK_SIZE) + PAGE_SIZE)
 

Definition at line 43 of file ia64/allproc.c.

#define BLOCK2_SIZE   (ROUND_UP(KPRCB) + ROUND_UP(ETHREAD) + 64)
 

Definition at line 44 of file ia64/allproc.c.

#define ROUND_UP  )     ((sizeof(x) + 63) & (~63))
 

Definition at line 42 of file ia64/allproc.c.


Function Documentation

VOID KeStartAllProcessors VOID   ) 
 

Definition at line 82 of file ia64/allproc.c.

References BLOCK1_SIZE, BLOCK2_SIZE, ExAllocatePool, ExFreePool(), HalStartNextProcessor(), KeLoaderBlock, KeRegisteredProcessors, _LOADER_PARAMETER_BLOCK::KernelStack, KiAdjustInterruptTime(), KiBarrierWait, KiKernelPcrPage, KiOSRendezvous(), KiUserSharedDataPage, MAXIMUM_PROCESSORS, MmGetPhysicalAddress(), NonPagedPool, NULL, PAGE_SHIFT, _LOADER_PARAMETER_BLOCK::Prcb, ROUND_UP, _LOADER_PARAMETER_BLOCK::Thread, and _LOADER_PARAMETER_BLOCK::u.

00088 : 00089 00090 This function is called during phase 1 initialize on the master boot 00091 processor to start all of the other registered processors. 00092 00093 Arguments: 00094 00095 None. 00096 00097 Return Value: 00098 00099 None. 00100 00101 --*/ 00102 00103 { 00104 00105 ULONG_PTR MemoryBlock1; 00106 ULONG_PTR MemoryBlock2; 00107 ULONG_PTR MemoryBlock3; 00108 ULONG_PTR PcrAddress; 00109 ULONG Number; 00110 PHYSICAL_ADDRESS PcrPage; 00111 PKPRCB Prcb; 00112 BOOLEAN Started; 00113 KPROCESSOR_STATE ProcessorState; 00114 00115 #if !defined(NT_UP) 00116 00117 // 00118 // If the registered number of processors is greater than the maximum 00119 // number of processors supported, then only allow the maximum number 00120 // of supported processors. 00121 // 00122 00123 if (KeRegisteredProcessors > MAXIMUM_PROCESSORS) { 00124 KeRegisteredProcessors = MAXIMUM_PROCESSORS; 00125 } 00126 00127 // 00128 // Set barrier that will prevent any other processor from entering the 00129 // idle loop until all processors have been started. 00130 // 00131 00132 KiBarrierWait = 1; 00133 00134 // 00135 // Initialize the processor state that will be used to start each of 00136 // processors. Each processor starts in the system initialization code 00137 // with address of the loader parameter block as an argument. 00138 // 00139 00140 Number = 1; 00141 RtlZeroMemory(&ProcessorState, sizeof(KPROCESSOR_STATE)); 00142 ProcessorState.ContextFrame.StIIP = ((PPLABEL_DESCRIPTOR)KiOSRendezvous)->EntryPoint; 00143 while (Number < KeRegisteredProcessors) { 00144 00145 // **** TBD check this for MP case 00146 00147 // 00148 // Allocate a DPC stack, an idle thread kernel stack, a panic 00149 // stack, a PCR page, a processor block, and an executive thread 00150 // object. If the allocation fails or the allocation cannot be 00151 // made from unmapped nonpaged pool, then stop starting processors. 00152 // 00153 00154 MemoryBlock1 = (ULONG_PTR)ExAllocatePool(NonPagedPool, BLOCK1_SIZE); 00155 if ((PVOID)MemoryBlock1 == NULL) { 00156 break; 00157 } 00158 00159 MemoryBlock2 = (ULONG_PTR)ExAllocatePool(NonPagedPool, BLOCK2_SIZE); 00160 if ((PVOID)MemoryBlock2 == NULL) { 00161 ExFreePool((PVOID)MemoryBlock1); 00162 break; 00163 } 00164 00165 // 00166 // Zero both blocks of allocated memory. 00167 // 00168 00169 RtlZeroMemory((PVOID)MemoryBlock1, BLOCK1_SIZE); 00170 RtlZeroMemory((PVOID)MemoryBlock2, BLOCK2_SIZE); 00171 00172 // 00173 // Set address of idle thread kernel stack in loader parameter block. 00174 // 00175 00176 KeLoaderBlock->KernelStack = MemoryBlock1 + KERNEL_STACK_SIZE; 00177 00178 // 00179 // Set address of panic stack in loader parameter block. 00180 // 00181 00182 KeLoaderBlock->u.Ia64.PanicStack = MemoryBlock1 + KERNEL_BSTORE_SIZE + 00183 (2 * KERNEL_STACK_SIZE); 00184 00185 // 00186 // Set the address of the processor block and executive thread in the 00187 // loader parameter block. 00188 // 00189 00190 KeLoaderBlock->Prcb = MemoryBlock2; 00191 KeLoaderBlock->Thread = KeLoaderBlock->Prcb + ROUND_UP(KPRCB); 00192 ((PKPRCB)KeLoaderBlock->Prcb)->Number = (UCHAR)Number; 00193 00194 // 00195 // Set the page frame of the PCR page in the loader parameter block. 00196 // 00197 00198 PcrAddress = MemoryBlock1 + KERNEL_BSTORE_SIZE + (2*KERNEL_STACK_SIZE); 00199 PcrPage = MmGetPhysicalAddress((PVOID)PcrAddress); 00200 KeLoaderBlock->u.Ia64.PcrPage = PcrPage.QuadPart >> PAGE_SHIFT; 00201 KeLoaderBlock->u.Ia64.PcrPage2 = KiUserSharedDataPage; 00202 KiKernelPcrPage = KeLoaderBlock->u.Ia64.PcrPage; 00203 00204 // 00205 // Attempt to start the next processor. If attempt is successful, 00206 // then wait for the processor to get initialized. Otherwise, 00207 // deallocate the processor resources and terminate the loop. 00208 // 00209 00210 Started = HalStartNextProcessor(KeLoaderBlock, &ProcessorState); 00211 00212 if (Started) { 00213 00214 // 00215 // Wait for processor to initialize in kernel, 00216 // then loop for another 00217 // 00218 00219 while (*((volatile ULONG_PTR *) &KeLoaderBlock->Prcb) != 0) { 00220 KeYieldProcessor(); 00221 } 00222 00223 } else { 00224 00225 ExFreePool((PVOID)MemoryBlock1); 00226 ExFreePool((PVOID)MemoryBlock2); 00227 break; 00228 00229 } 00230 00231 Number += 1; 00232 } 00233 00234 // 00235 // Allow all processor that were started to enter the idle loop and 00236 // begin execution. 00237 // 00238 00239 KiBarrierWait = 0; 00240 00241 #endif 00242 00243 // 00244 // Reset and synchronize the performance counters of all processors. 00245 // 00246 00247 KiAdjustInterruptTime (0); 00248 return; 00249 } }

VOID KiCalibratePerformanceCounter VOID   ) 
 

VOID KiCalibratePerformanceCounterTarget IN PULONG  SignalDone,
IN PVOID  Count,
IN PVOID  Parameter2,
IN PVOID  Parameter3
 

VOID KiOSRendezvous VOID   ) 
 

Referenced by KeStartAllProcessors().


Variable Documentation

ULONG KiBarrierWait = 0
 

Definition at line 52 of file ia64/allproc.c.

ULONG_PTR KiKernelPcrPage
 

Definition at line 57 of file ia64/allproc.c.

Referenced by KeStartAllProcessors().

ULONG_PTR KiUserSharedDataPage
 

Definition at line 56 of file ia64/allproc.c.

Referenced by KeStartAllProcessors(), and KiInitializeKernel().


Generated on Sat May 15 19:42:51 2004 for test by doxygen 1.3.7