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

kiinit.c File Reference

#include "ki.h"

Go to the source code of this file.

Functions

BOOLEAN KeInitSystem (VOID)
VOID KiInitSystem (VOID)
LARGE_INTEGER KiComputeReciprocal (IN LONG Divisor, OUT PCCHAR Shift)


Function Documentation

BOOLEAN KeInitSystem VOID   ) 
 

Definition at line 41 of file kiinit.c.

References FALSE, Initialized, KiChannelInitialization(), KiInitMachineDependent(), and TRUE.

00047 : 00048 00049 This function initializes executive structures implemented by the 00050 kernel. 00051 00052 N.B. This function is only called during phase 1 initialization. 00053 00054 Arguments: 00055 00056 None. 00057 00058 Return Value: 00059 00060 A value of TRUE is returned if initialization is successful. Otherwise, 00061 a value of FALSE is returned. 00062 00063 --*/ 00064 00065 { 00066 00067 BOOLEAN Initialized = TRUE; 00068 00069 // 00070 // Initialize the executive objects. 00071 // 00072 00073 #if 0 00074 00075 if ((Initialized = KiChannelInitialization()) == FALSE) { 00076 KdPrint(("Kernel: Channel initialization failed\n")); 00077 } 00078 00079 #endif 00080 00081 #if defined(i386) 00082 00083 // 00084 // Perform platform dependent initialization. 00085 // 00086 00087 Initialized = KiInitMachineDependent(); 00088 00089 #endif 00090 00091 00092 return Initialized; 00093 }

LARGE_INTEGER KiComputeReciprocal IN LONG  Divisor,
OUT PCCHAR  Shift
 

Definition at line 237 of file kiinit.c.

Referenced by KiInitializeKernel().

00244 : 00245 00246 This function computes the large integer reciprocal of the specified 00247 value. 00248 00249 Arguments: 00250 00251 Divisor - Supplies the value for which the large integer reciprocal is 00252 computed. 00253 00254 Shift - Supplies a pointer to a variable that receives the computed 00255 shift count. 00256 00257 Return Value: 00258 00259 The large integer reciprocal is returned as the fucntion value. 00260 00261 --*/ 00262 00263 { 00264 00265 LARGE_INTEGER Fraction; 00266 LONG NumberBits; 00267 LONG Remainder; 00268 00269 // 00270 // Compute the large integer reciprocal of the specified value. 00271 // 00272 00273 NumberBits = 0; 00274 Remainder = 1; 00275 Fraction.LowPart = 0; 00276 Fraction.HighPart = 0; 00277 while (Fraction.HighPart >= 0) { 00278 NumberBits += 1; 00279 Fraction.HighPart = (Fraction.HighPart << 1) | (Fraction.LowPart >> 31); 00280 Fraction.LowPart <<= 1; 00281 Remainder <<= 1; 00282 if (Remainder >= Divisor) { 00283 Remainder -= Divisor; 00284 Fraction.LowPart |= 1; 00285 } 00286 } 00287 00288 if (Remainder != 0) { 00289 if ((Fraction.LowPart == 0xffffffff) && (Fraction.HighPart == 0xffffffff)) { 00290 Fraction.LowPart = 0; 00291 Fraction.HighPart = 0x80000000; 00292 NumberBits -= 1; 00293 00294 } else { 00295 if (Fraction.LowPart == 0xffffffff) { 00296 Fraction.LowPart = 0; 00297 Fraction.HighPart += 1; 00298 00299 } else { 00300 Fraction.LowPart += 1; 00301 } 00302 } 00303 } 00304 00305 // 00306 // Compute the shift count value and return the reciprocal fraction. 00307 // 00308 00309 *Shift = (CCHAR)(NumberBits - 64); 00310 return Fraction; 00311 } }

VOID KiInitSystem VOID   ) 
 

Definition at line 96 of file kiinit.c.

References _KSERVICE_TABLE_DESCRIPTOR::Base, _KSERVICE_TABLE_DESCRIPTOR::Count, ExInitializeCallData(), FALSE, Index, KeBugCheckCallbackListHead, KeBugCheckCallbackLock, KeInitializeDpc(), KeInitializeEvent, KeInitializeSpinLock(), KeServiceDescriptorTable, KeServiceDescriptorTableShadow, KiArgumentTable, KiDispatcherReadyListHead, KiFlushSingleCallData, KiProcessInSwapListHead, KiProcessOutSwapListHead, KiProfileListHead, KiProfileLock, KiProfileSourceListHead, KiServiceLimit, KiServiceTable, KiSetEventCallData, KiStackInSwapListHead, KiSwapEvent, KiTimerExpiration(), KiTimerExpireDpc, KiTimerTableListHead, KiWaitInListHead, KiWaitOutListHead, KiWaitSingleCallData, _KSERVICE_TABLE_DESCRIPTOR::Limit, NIL, NULL, _KSERVICE_TABLE_DESCRIPTOR::Number, NUMBER_SERVICE_TABLES, PKDEFERRED_ROUTINE, and TIMER_TABLE_SIZE.

Referenced by KiInitializeKernel().

00102 : 00103 00104 This function initializes architecture independent kernel structures. 00105 00106 Arguments: 00107 00108 None. 00109 00110 Return Value: 00111 00112 None. 00113 00114 --*/ 00115 00116 { 00117 00118 ULONG Index; 00119 00120 // 00121 // Initialize dispatcher ready queue listheads. 00122 // 00123 00124 for (Index = 0; Index < MAXIMUM_PRIORITY; Index += 1) { 00125 InitializeListHead(&KiDispatcherReadyListHead[Index]); 00126 } 00127 00128 // 00129 // Initialize bug check callback listhead and spinlock. 00130 // 00131 00132 InitializeListHead(&KeBugCheckCallbackListHead); 00133 KeInitializeSpinLock(&KeBugCheckCallbackLock); 00134 00135 // 00136 // Initialize the timer expiration DPC object. 00137 // 00138 00139 KeInitializeDpc(&KiTimerExpireDpc, 00140 (PKDEFERRED_ROUTINE)KiTimerExpiration, NIL); 00141 00142 // 00143 // Initialize the profile listhead and profile locks 00144 // 00145 00146 KeInitializeSpinLock(&KiProfileLock); 00147 InitializeListHead(&KiProfileListHead); 00148 00149 // 00150 // Initialize the active profile source listhead. 00151 // 00152 00153 InitializeListHead(&KiProfileSourceListHead); 00154 00155 // 00156 // Initialize the timer table, the timer completion listhead, and the 00157 // timer completion DPC. 00158 // 00159 00160 for (Index = 0; Index < TIMER_TABLE_SIZE; Index += 1) { 00161 InitializeListHead(&KiTimerTableListHead[Index]); 00162 } 00163 00164 // 00165 // Initialize the swap event, the process inswap listhead, the 00166 // process outswap listhead, the kernel stack inswap listhead, 00167 // the wait in listhead, and the wait out listhead. 00168 // 00169 00170 KeInitializeEvent(&KiSwapEvent, 00171 SynchronizationEvent, 00172 FALSE); 00173 00174 InitializeListHead(&KiProcessInSwapListHead); 00175 InitializeListHead(&KiProcessOutSwapListHead); 00176 InitializeListHead(&KiStackInSwapListHead); 00177 InitializeListHead(&KiWaitInListHead); 00178 InitializeListHead(&KiWaitOutListHead); 00179 00180 // 00181 // Initialize the system service descriptor table. 00182 // 00183 00184 KeServiceDescriptorTable[0].Base = &KiServiceTable[0]; 00185 KeServiceDescriptorTable[0].Count = NULL; 00186 KeServiceDescriptorTable[0].Limit = KiServiceLimit; 00187 #if defined(_IA64_) 00188 00189 // 00190 // The global pointer associated with the table base is 00191 // placed just before the service table. 00192 // 00193 00194 KeServiceDescriptorTable[0].TableBaseGpOffset = 00195 (LONG)(*(KiServiceTable-1) - (ULONG_PTR)KiServiceTable); 00196 #endif 00197 KeServiceDescriptorTable[0].Number = &KiArgumentTable[0]; 00198 for (Index = 1; Index < NUMBER_SERVICE_TABLES; Index += 1) { 00199 KeServiceDescriptorTable[Index].Limit = 0; 00200 } 00201 00202 // 00203 // Copy the system service descriptor table to the shadow table 00204 // which is used to record the Win32 system services. 00205 // 00206 00207 RtlCopyMemory(KeServiceDescriptorTableShadow, 00208 KeServiceDescriptorTable, 00209 sizeof(KeServiceDescriptorTable)); 00210 00211 // 00212 // Initialize call performance data structures. 00213 // 00214 00215 #if defined(_COLLECT_FLUSH_SINGLE_CALLDATA_) 00216 00217 ExInitializeCallData(&KiFlushSingleCallData); 00218 00219 #endif 00220 00221 #if defined(_COLLECT_SET_EVENT_CALLDATA_) 00222 00223 ExInitializeCallData(&KiSetEventCallData); 00224 00225 #endif 00226 00227 #if defined(_COLLECT_WAIT_SINGLE_CALLDATA_) 00228 00229 ExInitializeCallData(&KiWaitSingleCallData); 00230 00231 #endif 00232 00233 return; 00234 }


Generated on Sat May 15 19:44:29 2004 for test by doxygen 1.3.7