Apply consistent coding style
This commit is contained in:
@@ -73,7 +73,7 @@ AR::ProcSup::IdentifyProcessor(VOID)
|
|||||||
/* Get CPU vendor by issueing CPUID instruction */
|
/* Get CPU vendor by issueing CPUID instruction */
|
||||||
RtlZeroMemory(&CpuRegisters, sizeof(CPUID_REGISTERS));
|
RtlZeroMemory(&CpuRegisters, sizeof(CPUID_REGISTERS));
|
||||||
CpuRegisters.Leaf = CPUID_GET_VENDOR_STRING;
|
CpuRegisters.Leaf = CPUID_GET_VENDOR_STRING;
|
||||||
CpuFunc::CpuId(&CpuRegisters);
|
AR::CpuFunc::CpuId(&CpuRegisters);
|
||||||
|
|
||||||
/* Store CPU vendor in processor control block */
|
/* Store CPU vendor in processor control block */
|
||||||
Prcb->CpuId.Vendor = (CPU_VENDOR)CpuRegisters.Ebx;
|
Prcb->CpuId.Vendor = (CPU_VENDOR)CpuRegisters.Ebx;
|
||||||
@@ -85,7 +85,7 @@ AR::ProcSup::IdentifyProcessor(VOID)
|
|||||||
/* Get CPU standard features */
|
/* Get CPU standard features */
|
||||||
RtlZeroMemory(&CpuRegisters, sizeof(CPUID_REGISTERS));
|
RtlZeroMemory(&CpuRegisters, sizeof(CPUID_REGISTERS));
|
||||||
CpuRegisters.Leaf = CPUID_GET_STANDARD1_FEATURES;
|
CpuRegisters.Leaf = CPUID_GET_STANDARD1_FEATURES;
|
||||||
CpuFunc::CpuId(&CpuRegisters);
|
AR::CpuFunc::CpuId(&CpuRegisters);
|
||||||
|
|
||||||
/* Store CPU signature in processor control block */
|
/* Store CPU signature in processor control block */
|
||||||
CpuSignature = *(PCPUID_SIGNATURE)&CpuRegisters.Eax;
|
CpuSignature = *(PCPUID_SIGNATURE)&CpuRegisters.Eax;
|
||||||
@@ -180,9 +180,9 @@ AR::ProcSup::InitializeProcessor(IN PVOID ProcessorStructures)
|
|||||||
IdtDescriptor.Limit = (IDT_ENTRIES * sizeof(KIDTENTRY)) - 1;
|
IdtDescriptor.Limit = (IDT_ENTRIES * sizeof(KIDTENTRY)) - 1;
|
||||||
|
|
||||||
/* Load GDT, IDT and TSS */
|
/* Load GDT, IDT and TSS */
|
||||||
CpuFunc::LoadGlobalDescriptorTable(&GdtDescriptor.Limit);
|
AR::CpuFunc::LoadGlobalDescriptorTable(&GdtDescriptor.Limit);
|
||||||
CpuFunc::LoadInterruptDescriptorTable(&IdtDescriptor.Limit);
|
AR::CpuFunc::LoadInterruptDescriptorTable(&IdtDescriptor.Limit);
|
||||||
CpuFunc::LoadTaskRegister((UINT)KGDT_SYS_TSS);
|
AR::CpuFunc::LoadTaskRegister((UINT)KGDT_SYS_TSS);
|
||||||
|
|
||||||
/* Enter passive IRQ level */
|
/* Enter passive IRQ level */
|
||||||
HL::RunLevel::SetRunLevel(PASSIVE_LEVEL);
|
HL::RunLevel::SetRunLevel(PASSIVE_LEVEL);
|
||||||
@@ -191,8 +191,8 @@ AR::ProcSup::InitializeProcessor(IN PVOID ProcessorStructures)
|
|||||||
InitializeSegments();
|
InitializeSegments();
|
||||||
|
|
||||||
/* Set GS base */
|
/* Set GS base */
|
||||||
CpuFunc::WriteModelSpecificRegister(X86_MSR_GSBASE, (ULONGLONG)ProcessorBlock);
|
AR::CpuFunc::WriteModelSpecificRegister(X86_MSR_GSBASE, (ULONGLONG)ProcessorBlock);
|
||||||
CpuFunc::WriteModelSpecificRegister(X86_MSR_KERNEL_GSBASE, (ULONGLONG)ProcessorBlock);
|
AR::CpuFunc::WriteModelSpecificRegister(X86_MSR_KERNEL_GSBASE, (ULONGLONG)ProcessorBlock);
|
||||||
|
|
||||||
/* Initialize processor registers */
|
/* Initialize processor registers */
|
||||||
InitializeProcessorRegisters();
|
InitializeProcessorRegisters();
|
||||||
@@ -357,45 +357,45 @@ AR::ProcSup::InitializeProcessorRegisters(VOID)
|
|||||||
ULONGLONG PatAttributes;
|
ULONGLONG PatAttributes;
|
||||||
|
|
||||||
/* Enable FXSAVE restore */
|
/* Enable FXSAVE restore */
|
||||||
CpuFunc::WriteControlRegister(4, CpuFunc::ReadControlRegister(4) | CR4_FXSR);
|
AR::CpuFunc::WriteControlRegister(4, AR::CpuFunc::ReadControlRegister(4) | CR4_FXSR);
|
||||||
|
|
||||||
/* Enable XMMI exceptions */
|
/* Enable XMMI exceptions */
|
||||||
CpuFunc::WriteControlRegister(4, CpuFunc::ReadControlRegister(4) | CR4_XMMEXCPT);
|
AR::CpuFunc::WriteControlRegister(4, AR::CpuFunc::ReadControlRegister(4) | CR4_XMMEXCPT);
|
||||||
|
|
||||||
/* Set debugger extension */
|
/* Set debugger extension */
|
||||||
CpuFunc::WriteControlRegister(4, CpuFunc::ReadControlRegister(4) | CR4_DE);
|
AR::CpuFunc::WriteControlRegister(4, AR::CpuFunc::ReadControlRegister(4) | CR4_DE);
|
||||||
|
|
||||||
/* Enable large pages */
|
/* Enable large pages */
|
||||||
CpuFunc::WriteControlRegister(4, CpuFunc::ReadControlRegister(4) | CR4_PSE);
|
AR::CpuFunc::WriteControlRegister(4, AR::CpuFunc::ReadControlRegister(4) | CR4_PSE);
|
||||||
|
|
||||||
/* Enable write-protection */
|
/* Enable write-protection */
|
||||||
CpuFunc::WriteControlRegister(0, CpuFunc::ReadControlRegister(0) | CR0_WP);
|
AR::CpuFunc::WriteControlRegister(0, AR::CpuFunc::ReadControlRegister(0) | CR0_WP);
|
||||||
|
|
||||||
/* Set alignment mask */
|
/* Set alignment mask */
|
||||||
CpuFunc::WriteControlRegister(0, CpuFunc::ReadControlRegister(0) | CR0_AM);
|
AR::CpuFunc::WriteControlRegister(0, AR::CpuFunc::ReadControlRegister(0) | CR0_AM);
|
||||||
|
|
||||||
/* Disable FPU monitoring */
|
/* Disable FPU monitoring */
|
||||||
CpuFunc::WriteControlRegister(0, CpuFunc::ReadControlRegister(0) & ~CR0_MP);
|
AR::CpuFunc::WriteControlRegister(0, AR::CpuFunc::ReadControlRegister(0) & ~CR0_MP);
|
||||||
|
|
||||||
/* Disable x87 FPU exceptions */
|
/* Disable x87 FPU exceptions */
|
||||||
CpuFunc::WriteControlRegister(0, CpuFunc::ReadControlRegister(0) & ~CR0_NE);
|
AR::CpuFunc::WriteControlRegister(0, AR::CpuFunc::ReadControlRegister(0) & ~CR0_NE);
|
||||||
|
|
||||||
/* Flush the TLB */
|
/* Flush the TLB */
|
||||||
CpuFunc::FlushTlb();
|
AR::CpuFunc::FlushTlb();
|
||||||
|
|
||||||
/* Initialize system call MSRs */
|
/* Initialize system call MSRs */
|
||||||
Traps::InitializeSystemCallMsrs();
|
AR::Traps::InitializeSystemCallMsrs();
|
||||||
|
|
||||||
/* Enable No-Execute (NXE) in EFER MSR */
|
/* Enable No-Execute (NXE) in EFER MSR */
|
||||||
CpuFunc::WriteModelSpecificRegister(X86_MSR_EFER, CpuFunc::ReadModelSpecificRegister(X86_MSR_EFER) | X86_MSR_EFER_NXE);
|
AR::CpuFunc::WriteModelSpecificRegister(X86_MSR_EFER, CpuFunc::ReadModelSpecificRegister(X86_MSR_EFER) | X86_MSR_EFER_NXE);
|
||||||
|
|
||||||
/* Initialize Page Attribute Table */
|
/* Initialize Page Attribute Table */
|
||||||
PatAttributes = (PAT_TYPE_WB << 0) | (PAT_TYPE_USWC << 8) | (PAT_TYPE_WEAK_UC << 16) | (PAT_TYPE_STRONG_UC << 24) |
|
PatAttributes = (PAT_TYPE_WB << 0) | (PAT_TYPE_USWC << 8) | (PAT_TYPE_WEAK_UC << 16) | (PAT_TYPE_STRONG_UC << 24) |
|
||||||
(PAT_TYPE_WB << 32) | (PAT_TYPE_USWC << 40) | (PAT_TYPE_WEAK_UC << 48) | (PAT_TYPE_STRONG_UC << 56);
|
(PAT_TYPE_WB << 32) | (PAT_TYPE_USWC << 40) | (PAT_TYPE_WEAK_UC << 48) | (PAT_TYPE_STRONG_UC << 56);
|
||||||
CpuFunc::WriteModelSpecificRegister(X86_MSR_PAT, PatAttributes);
|
AR::CpuFunc::WriteModelSpecificRegister(X86_MSR_PAT, PatAttributes);
|
||||||
|
|
||||||
/* Initialize MXCSR register */
|
/* Initialize MXCSR register */
|
||||||
CpuFunc::LoadMxcsrRegister(INITIAL_MXCSR);
|
AR::CpuFunc::LoadMxcsrRegister(INITIAL_MXCSR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -473,12 +473,12 @@ VOID
|
|||||||
AR::ProcSup::InitializeSegments(VOID)
|
AR::ProcSup::InitializeSegments(VOID)
|
||||||
{
|
{
|
||||||
/* Initialize segments */
|
/* Initialize segments */
|
||||||
CpuFunc::LoadSegment(SEGMENT_CS, KGDT_R0_CODE);
|
AR::CpuFunc::LoadSegment(SEGMENT_CS, KGDT_R0_CODE);
|
||||||
CpuFunc::LoadSegment(SEGMENT_DS, KGDT_R3_DATA | RPL_MASK);
|
AR::CpuFunc::LoadSegment(SEGMENT_DS, KGDT_R3_DATA | RPL_MASK);
|
||||||
CpuFunc::LoadSegment(SEGMENT_ES, KGDT_R3_DATA | RPL_MASK);
|
AR::CpuFunc::LoadSegment(SEGMENT_ES, KGDT_R3_DATA | RPL_MASK);
|
||||||
CpuFunc::LoadSegment(SEGMENT_FS, KGDT_R3_CMTEB | RPL_MASK);
|
AR::CpuFunc::LoadSegment(SEGMENT_FS, KGDT_R3_CMTEB | RPL_MASK);
|
||||||
CpuFunc::LoadSegment(SEGMENT_GS, KGDT_R3_DATA | RPL_MASK);
|
AR::CpuFunc::LoadSegment(SEGMENT_GS, KGDT_R3_DATA | RPL_MASK);
|
||||||
CpuFunc::LoadSegment(SEGMENT_SS, KGDT_R0_DATA);
|
AR::CpuFunc::LoadSegment(SEGMENT_SS, KGDT_R0_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ AR::ProcSup::IdentifyProcessor(VOID)
|
|||||||
/* Get CPU vendor by issueing CPUID instruction */
|
/* Get CPU vendor by issueing CPUID instruction */
|
||||||
RtlZeroMemory(&CpuRegisters, sizeof(CPUID_REGISTERS));
|
RtlZeroMemory(&CpuRegisters, sizeof(CPUID_REGISTERS));
|
||||||
CpuRegisters.Leaf = CPUID_GET_VENDOR_STRING;
|
CpuRegisters.Leaf = CPUID_GET_VENDOR_STRING;
|
||||||
CpuFunc::CpuId(&CpuRegisters);
|
AR::CpuFunc::CpuId(&CpuRegisters);
|
||||||
|
|
||||||
/* Store CPU vendor in processor control block */
|
/* Store CPU vendor in processor control block */
|
||||||
Prcb->CpuId.Vendor = (CPU_VENDOR)CpuRegisters.Ebx;
|
Prcb->CpuId.Vendor = (CPU_VENDOR)CpuRegisters.Ebx;
|
||||||
@@ -80,7 +80,7 @@ AR::ProcSup::IdentifyProcessor(VOID)
|
|||||||
/* Get CPU standard features */
|
/* Get CPU standard features */
|
||||||
RtlZeroMemory(&CpuRegisters, sizeof(CPUID_REGISTERS));
|
RtlZeroMemory(&CpuRegisters, sizeof(CPUID_REGISTERS));
|
||||||
CpuRegisters.Leaf = CPUID_GET_STANDARD1_FEATURES;
|
CpuRegisters.Leaf = CPUID_GET_STANDARD1_FEATURES;
|
||||||
CpuFunc::CpuId(&CpuRegisters);
|
AR::CpuFunc::CpuId(&CpuRegisters);
|
||||||
|
|
||||||
/* Store CPU signature in processor control block */
|
/* Store CPU signature in processor control block */
|
||||||
CpuSignature = *(PCPUID_SIGNATURE)&CpuRegisters.Eax;
|
CpuSignature = *(PCPUID_SIGNATURE)&CpuRegisters.Eax;
|
||||||
@@ -175,9 +175,9 @@ AR::ProcSup::InitializeProcessor(IN PVOID ProcessorStructures)
|
|||||||
IdtDescriptor.Limit = (IDT_ENTRIES * sizeof(KIDTENTRY)) - 1;
|
IdtDescriptor.Limit = (IDT_ENTRIES * sizeof(KIDTENTRY)) - 1;
|
||||||
|
|
||||||
/* Load GDT, IDT and TSS */
|
/* Load GDT, IDT and TSS */
|
||||||
CpuFunc::LoadGlobalDescriptorTable(&GdtDescriptor.Limit);
|
AR::CpuFunc::LoadGlobalDescriptorTable(&GdtDescriptor.Limit);
|
||||||
CpuFunc::LoadInterruptDescriptorTable(&IdtDescriptor.Limit);
|
AR::CpuFunc::LoadInterruptDescriptorTable(&IdtDescriptor.Limit);
|
||||||
CpuFunc::LoadTaskRegister((UINT)KGDT_SYS_TSS);
|
AR::CpuFunc::LoadTaskRegister((UINT)KGDT_SYS_TSS);
|
||||||
|
|
||||||
/* Enter passive IRQ level */
|
/* Enter passive IRQ level */
|
||||||
HL::RunLevel::SetRunLevel(PASSIVE_LEVEL);
|
HL::RunLevel::SetRunLevel(PASSIVE_LEVEL);
|
||||||
@@ -344,10 +344,10 @@ VOID
|
|||||||
AR::ProcSup::InitializeProcessorRegisters(VOID)
|
AR::ProcSup::InitializeProcessorRegisters(VOID)
|
||||||
{
|
{
|
||||||
/* Clear EFLAGS register */
|
/* Clear EFLAGS register */
|
||||||
CpuFunc::WriteEflagsRegister(0);
|
AR::CpuFunc::WriteEflagsRegister(0);
|
||||||
|
|
||||||
/* Enable write-protection */
|
/* Enable write-protection */
|
||||||
CpuFunc::WriteControlRegister(0, CpuFunc::ReadControlRegister(0) | CR0_WP);
|
AR::CpuFunc::WriteControlRegister(0, AR::CpuFunc::ReadControlRegister(0) | CR0_WP);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -425,12 +425,12 @@ VOID
|
|||||||
AR::ProcSup::InitializeSegments(VOID)
|
AR::ProcSup::InitializeSegments(VOID)
|
||||||
{
|
{
|
||||||
/* Initialize segments */
|
/* Initialize segments */
|
||||||
CpuFunc::LoadSegment(SEGMENT_CS, KGDT_R0_CODE);
|
AR::CpuFunc::LoadSegment(SEGMENT_CS, KGDT_R0_CODE);
|
||||||
CpuFunc::LoadSegment(SEGMENT_DS, KGDT_R3_DATA | RPL_MASK);
|
AR::CpuFunc::LoadSegment(SEGMENT_DS, KGDT_R3_DATA | RPL_MASK);
|
||||||
CpuFunc::LoadSegment(SEGMENT_ES, KGDT_R3_DATA | RPL_MASK);
|
AR::CpuFunc::LoadSegment(SEGMENT_ES, KGDT_R3_DATA | RPL_MASK);
|
||||||
CpuFunc::LoadSegment(SEGMENT_FS, KGDT_R0_PB);
|
AR::CpuFunc::LoadSegment(SEGMENT_FS, KGDT_R0_PB);
|
||||||
CpuFunc::LoadSegment(SEGMENT_GS, 0);
|
AR::CpuFunc::LoadSegment(SEGMENT_GS, 0);
|
||||||
CpuFunc::LoadSegment(SEGMENT_SS, KGDT_R0_DATA);
|
AR::CpuFunc::LoadSegment(SEGMENT_SS, KGDT_R0_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -484,7 +484,7 @@ AR::ProcSup::InitializeTss(IN PKPROCESSOR_BLOCK ProcessorBlock,
|
|||||||
ProcessorBlock->TssBase->Flags = 0;
|
ProcessorBlock->TssBase->Flags = 0;
|
||||||
|
|
||||||
/* Set CR3, LDT and SS */
|
/* Set CR3, LDT and SS */
|
||||||
ProcessorBlock->TssBase->CR3 = CpuFunc::ReadControlRegister(3);
|
ProcessorBlock->TssBase->CR3 = AR::CpuFunc::ReadControlRegister(3);
|
||||||
ProcessorBlock->TssBase->LDT = 0;
|
ProcessorBlock->TssBase->LDT = 0;
|
||||||
ProcessorBlock->TssBase->Ss0 = KGDT_R0_DATA;
|
ProcessorBlock->TssBase->Ss0 = KGDT_R0_DATA;
|
||||||
|
|
||||||
@@ -523,7 +523,7 @@ AR::ProcSup::SetDoubleFaultTssEntry(IN PKPROCESSOR_BLOCK ProcessorBlock,
|
|||||||
Tss->IoMapBase = sizeof(KTSS);
|
Tss->IoMapBase = sizeof(KTSS);
|
||||||
Tss->Flags = 0;
|
Tss->Flags = 0;
|
||||||
Tss->LDT = 0;
|
Tss->LDT = 0;
|
||||||
Tss->CR3 = CpuFunc::ReadControlRegister(3);
|
Tss->CR3 = AR::CpuFunc::ReadControlRegister(3);
|
||||||
Tss->Esp = (ULONG_PTR)KernelFaultStack;
|
Tss->Esp = (ULONG_PTR)KernelFaultStack;
|
||||||
Tss->Esp0 = (ULONG_PTR)KernelFaultStack;
|
Tss->Esp0 = (ULONG_PTR)KernelFaultStack;
|
||||||
Tss->Eip = (ULONG)(ULONG_PTR)ArTrapEntry[0x08];
|
Tss->Eip = (ULONG)(ULONG_PTR)ArTrapEntry[0x08];
|
||||||
@@ -737,7 +737,7 @@ AR::ProcSup::SetNonMaskableInterruptTssEntry(IN PKPROCESSOR_BLOCK ProcessorBlock
|
|||||||
Tss->IoMapBase = sizeof(KTSS);
|
Tss->IoMapBase = sizeof(KTSS);
|
||||||
Tss->Flags = 0;
|
Tss->Flags = 0;
|
||||||
Tss->LDT = 0;
|
Tss->LDT = 0;
|
||||||
Tss->CR3 = CpuFunc::ReadControlRegister(3);
|
Tss->CR3 = AR::CpuFunc::ReadControlRegister(3);
|
||||||
Tss->Esp = (ULONG_PTR)KernelNmiStack;
|
Tss->Esp = (ULONG_PTR)KernelNmiStack;
|
||||||
Tss->Esp0 = (ULONG_PTR)KernelNmiStack;
|
Tss->Esp0 = (ULONG_PTR)KernelNmiStack;
|
||||||
Tss->Eip = (ULONG)(ULONG_PTR)ArTrapEntry[0x02];
|
Tss->Eip = (ULONG)(ULONG_PTR)ArTrapEntry[0x02];
|
||||||
|
|||||||
@@ -23,14 +23,14 @@ HL::Init::InitializeSystem(VOID)
|
|||||||
XTSTATUS Status;
|
XTSTATUS Status;
|
||||||
|
|
||||||
/* Initialize ACPI */
|
/* Initialize ACPI */
|
||||||
Status = Acpi::InitializeAcpi();
|
Status = HL::Acpi::InitializeAcpi();
|
||||||
if(Status != STATUS_SUCCESS)
|
if(Status != STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get system information from ACPI */
|
/* Get system information from ACPI */
|
||||||
Status = Acpi::InitializeAcpiSystemInformation();
|
Status = HL::Acpi::InitializeAcpiSystemInformation();
|
||||||
if(Status != STATUS_SUCCESS)
|
if(Status != STATUS_SUCCESS)
|
||||||
{
|
{
|
||||||
return Status;
|
return Status;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ HL::Cpu::InitializeProcessor(VOID)
|
|||||||
ActiveProcessors |= Affinity;
|
ActiveProcessors |= Affinity;
|
||||||
|
|
||||||
/* Initialize APIC for this processor */
|
/* Initialize APIC for this processor */
|
||||||
Pic::InitializePic();
|
HL::Pic::InitializePic();
|
||||||
|
|
||||||
/* Set the APIC running level */
|
/* Set the APIC running level */
|
||||||
HL::RunLevel::SetRunLevel(KE::Processor::GetCurrentProcessorBlock()->RunLevel);
|
HL::RunLevel::SetRunLevel(KE::Processor::GetCurrentProcessorBlock()->RunLevel);
|
||||||
|
|||||||
@@ -353,7 +353,7 @@ HL::Pic::ReadApicRegister(IN APIC_REGISTER Register)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Read from xAPIC */
|
/* Read from xAPIC */
|
||||||
return IoRegister::ReadRegister32((PULONG)(APIC_BASE + (Register << 4)));
|
return HL::IoRegister::ReadRegister32((PULONG)(APIC_BASE + (Register << 4)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -430,6 +430,6 @@ HL::Pic::WriteApicRegister(IN APIC_REGISTER Register,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Write to xAPIC */
|
/* Write to xAPIC */
|
||||||
IoRegister::WriteRegister32((PULONG)(APIC_BASE + (Register << 4)), Value);
|
HL::IoRegister::WriteRegister32((PULONG)(APIC_BASE + (Register << 4)), Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ KE::KernelInit::InitializeKernel(VOID)
|
|||||||
{
|
{
|
||||||
/* Hardware layer initialization failed, kernel panic */
|
/* Hardware layer initialization failed, kernel panic */
|
||||||
DebugPrint(L"Failed to initialize hardware layer subsystem!\n");
|
DebugPrint(L"Failed to initialize hardware layer subsystem!\n");
|
||||||
Crash::Panic(0);
|
KE::Crash::Panic(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,8 +74,8 @@ KE::KernelInit::StartKernel(VOID)
|
|||||||
PKTHREAD CurrentThread;
|
PKTHREAD CurrentThread;
|
||||||
|
|
||||||
/* Get processor control block and current thread */
|
/* Get processor control block and current thread */
|
||||||
Prcb = Processor::GetCurrentProcessorControlBlock();
|
Prcb = KE::Processor::GetCurrentProcessorControlBlock();
|
||||||
CurrentThread = Processor::GetCurrentThread();
|
CurrentThread = KE::Processor::GetCurrentThread();
|
||||||
|
|
||||||
/* Get current process */
|
/* Get current process */
|
||||||
CurrentProcess = CurrentThread->ApcState.Process;
|
CurrentProcess = CurrentThread->ApcState.Process;
|
||||||
@@ -84,14 +84,14 @@ KE::KernelInit::StartKernel(VOID)
|
|||||||
PO::Idle::InitializeProcessorIdleState(Prcb);
|
PO::Idle::InitializeProcessorIdleState(Prcb);
|
||||||
|
|
||||||
/* Save processor state */
|
/* Save processor state */
|
||||||
Processor::SaveProcessorState(&Prcb->ProcessorState);
|
KE::Processor::SaveProcessorState(&Prcb->ProcessorState);
|
||||||
|
|
||||||
/* Initialize spin locks */
|
/* Initialize spin locks */
|
||||||
SpinLock::InitializeAllLocks();
|
KE::SpinLock::InitializeAllLocks();
|
||||||
SpinLock::InitializeLockQueues();
|
KE::SpinLock::InitializeLockQueues();
|
||||||
|
|
||||||
/* Lower to APC runlevel */
|
/* Lower to APC runlevel */
|
||||||
RunLevel::LowerRunLevel(APC_LEVEL);
|
KE::RunLevel::LowerRunLevel(APC_LEVEL);
|
||||||
|
|
||||||
/* Initialize XTOS kernel */
|
/* Initialize XTOS kernel */
|
||||||
InitializeKernel();
|
InitializeKernel();
|
||||||
@@ -99,12 +99,12 @@ KE::KernelInit::StartKernel(VOID)
|
|||||||
/* Initialize Idle process */
|
/* Initialize Idle process */
|
||||||
PageDirectory[0] = 0;
|
PageDirectory[0] = 0;
|
||||||
PageDirectory[1] = 0;
|
PageDirectory[1] = 0;
|
||||||
KProcess::InitializeProcess(CurrentProcess, 0, MAXULONG_PTR, PageDirectory, FALSE);
|
KE::KProcess::InitializeProcess(CurrentProcess, 0, MAXULONG_PTR, PageDirectory, FALSE);
|
||||||
CurrentProcess->Quantum = MAXCHAR;
|
CurrentProcess->Quantum = MAXCHAR;
|
||||||
|
|
||||||
/* Initialize Idle thread */
|
/* Initialize Idle thread */
|
||||||
KThread::InitializeThread(CurrentProcess, CurrentThread, NULLPTR, NULLPTR, NULLPTR,
|
KE::KThread::InitializeThread(CurrentProcess, CurrentThread, NULLPTR, NULLPTR, NULLPTR,
|
||||||
NULLPTR, NULLPTR, AR::ProcSup::GetBootStack(), TRUE);
|
NULLPTR, NULLPTR, AR::ProcSup::GetBootStack(), TRUE);
|
||||||
CurrentThread->NextProcessor = Prcb->CpuNumber;
|
CurrentThread->NextProcessor = Prcb->CpuNumber;
|
||||||
CurrentThread->Priority = THREAD_HIGH_PRIORITY;
|
CurrentThread->Priority = THREAD_HIGH_PRIORITY;
|
||||||
CurrentThread->State = Running;
|
CurrentThread->State = Running;
|
||||||
@@ -117,7 +117,7 @@ KE::KernelInit::StartKernel(VOID)
|
|||||||
|
|
||||||
/* Enter infinite loop */
|
/* Enter infinite loop */
|
||||||
DebugPrint(L"KernelInit::StartKernel() finished. Entering infinite loop.\n");
|
DebugPrint(L"KernelInit::StartKernel() finished. Entering infinite loop.\n");
|
||||||
Crash::HaltSystem();
|
KE::Crash::HaltSystem();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -138,7 +138,7 @@ KE::KernelInit::SwitchBootStack(VOID)
|
|||||||
Stack = ((ULONG_PTR)AR::ProcSup::GetBootStack() + KERNEL_STACK_SIZE) & ~(STACK_ALIGNMENT - 1);
|
Stack = ((ULONG_PTR)AR::ProcSup::GetBootStack() + KERNEL_STACK_SIZE) & ~(STACK_ALIGNMENT - 1);
|
||||||
|
|
||||||
/* Get address of KernelInit::StartKernel() */
|
/* Get address of KernelInit::StartKernel() */
|
||||||
StartKernel = (PVOID)KernelInit::StartKernel;
|
StartKernel = (PVOID)KE::KernelInit::StartKernel;
|
||||||
|
|
||||||
/* Discard old stack frame, switch stack and jump to KernelInit::StartKernel() */
|
/* Discard old stack frame, switch stack and jump to KernelInit::StartKernel() */
|
||||||
__asm__ volatile("mov %0, %%rdx\n"
|
__asm__ volatile("mov %0, %%rdx\n"
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ KE::KernelInit::InitializeKernel(VOID)
|
|||||||
{
|
{
|
||||||
/* Hardware layer initialization failed, kernel panic */
|
/* Hardware layer initialization failed, kernel panic */
|
||||||
DebugPrint(L"Failed to initialize hardware layer subsystem!\n");
|
DebugPrint(L"Failed to initialize hardware layer subsystem!\n");
|
||||||
Crash::Panic(0);
|
KE::Crash::Panic(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,8 +74,8 @@ KE::KernelInit::StartKernel(VOID)
|
|||||||
PKTHREAD CurrentThread;
|
PKTHREAD CurrentThread;
|
||||||
|
|
||||||
/* Get processor control block and current thread */
|
/* Get processor control block and current thread */
|
||||||
Prcb = Processor::GetCurrentProcessorControlBlock();
|
Prcb = KE::Processor::GetCurrentProcessorControlBlock();
|
||||||
CurrentThread = Processor::GetCurrentThread();
|
CurrentThread = KE::Processor::GetCurrentThread();
|
||||||
|
|
||||||
/* Get current process */
|
/* Get current process */
|
||||||
CurrentProcess = CurrentThread->ApcState.Process;
|
CurrentProcess = CurrentThread->ApcState.Process;
|
||||||
@@ -84,14 +84,14 @@ KE::KernelInit::StartKernel(VOID)
|
|||||||
PO::Idle::InitializeProcessorIdleState(Prcb);
|
PO::Idle::InitializeProcessorIdleState(Prcb);
|
||||||
|
|
||||||
/* Save processor state */
|
/* Save processor state */
|
||||||
Processor::SaveProcessorState(&Prcb->ProcessorState);
|
KE::Processor::SaveProcessorState(&Prcb->ProcessorState);
|
||||||
|
|
||||||
/* Initialize spin locks */
|
/* Initialize spin locks */
|
||||||
SpinLock::InitializeAllLocks();
|
KE::SpinLock::InitializeAllLocks();
|
||||||
SpinLock::InitializeLockQueues();
|
KE::SpinLock::InitializeLockQueues();
|
||||||
|
|
||||||
/* Lower to APC runlevel */
|
/* Lower to APC runlevel */
|
||||||
RunLevel::LowerRunLevel(APC_LEVEL);
|
KE::RunLevel::LowerRunLevel(APC_LEVEL);
|
||||||
|
|
||||||
/* Initialize XTOS kernel */
|
/* Initialize XTOS kernel */
|
||||||
InitializeKernel();
|
InitializeKernel();
|
||||||
@@ -99,12 +99,12 @@ KE::KernelInit::StartKernel(VOID)
|
|||||||
/* Initialize Idle process */
|
/* Initialize Idle process */
|
||||||
PageDirectory[0] = 0;
|
PageDirectory[0] = 0;
|
||||||
PageDirectory[1] = 0;
|
PageDirectory[1] = 0;
|
||||||
KProcess::InitializeProcess(CurrentProcess, 0, MAXULONG_PTR, PageDirectory, FALSE);
|
KE::KProcess::InitializeProcess(CurrentProcess, 0, MAXULONG_PTR, PageDirectory, FALSE);
|
||||||
CurrentProcess->Quantum = MAXCHAR;
|
CurrentProcess->Quantum = MAXCHAR;
|
||||||
|
|
||||||
/* Initialize Idle thread */
|
/* Initialize Idle thread */
|
||||||
KThread::InitializeThread(CurrentProcess, CurrentThread, NULLPTR, NULLPTR, NULLPTR,
|
KE::KThread::InitializeThread(CurrentProcess, CurrentThread, NULLPTR, NULLPTR, NULLPTR,
|
||||||
NULLPTR, NULLPTR, AR::ProcSup::GetBootStack(), TRUE);
|
NULLPTR, NULLPTR, AR::ProcSup::GetBootStack(), TRUE);
|
||||||
CurrentThread->NextProcessor = Prcb->CpuNumber;
|
CurrentThread->NextProcessor = Prcb->CpuNumber;
|
||||||
CurrentThread->Priority = THREAD_HIGH_PRIORITY;
|
CurrentThread->Priority = THREAD_HIGH_PRIORITY;
|
||||||
CurrentThread->State = Running;
|
CurrentThread->State = Running;
|
||||||
@@ -117,7 +117,7 @@ KE::KernelInit::StartKernel(VOID)
|
|||||||
|
|
||||||
/* Enter infinite loop */
|
/* Enter infinite loop */
|
||||||
DebugPrint(L"KernelInit::StartKernel() finished. Entering infinite loop.\n");
|
DebugPrint(L"KernelInit::StartKernel() finished. Entering infinite loop.\n");
|
||||||
Crash::HaltSystem();
|
KE::Crash::HaltSystem();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -138,7 +138,7 @@ KE::KernelInit::SwitchBootStack(VOID)
|
|||||||
Stack = ((ULONG_PTR)AR::ProcSup::GetBootStack() + KERNEL_STACK_SIZE) & ~(STACK_ALIGNMENT - 1);
|
Stack = ((ULONG_PTR)AR::ProcSup::GetBootStack() + KERNEL_STACK_SIZE) & ~(STACK_ALIGNMENT - 1);
|
||||||
|
|
||||||
/* Get address of KernelInit::StartKernel() */
|
/* Get address of KernelInit::StartKernel() */
|
||||||
StartKernel = (PVOID)KernelInit::StartKernel;
|
StartKernel = (PVOID)KE::KernelInit::StartKernel;
|
||||||
|
|
||||||
/* Discard old stack frame, switch stack, make space for NPX and jump to KernelInit::StartKernel() */
|
/* Discard old stack frame, switch stack, make space for NPX and jump to KernelInit::StartKernel() */
|
||||||
__asm__ volatile("mov %0, %%edx\n"
|
__asm__ volatile("mov %0, %%edx\n"
|
||||||
|
|||||||
@@ -32,17 +32,17 @@ KeStartXtSystem(IN PKERNEL_INITIALIZATION_BLOCK Parameters)
|
|||||||
Parameters->ProtocolVersion != BOOT_PROTOCOL_VERSION)
|
Parameters->ProtocolVersion != BOOT_PROTOCOL_VERSION)
|
||||||
{
|
{
|
||||||
/* Kernel and boot loader version mismatch */
|
/* Kernel and boot loader version mismatch */
|
||||||
Crash::HaltSystem();
|
KE::Crash::HaltSystem();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Save the kernel initialization block */
|
/* Save the kernel initialization block */
|
||||||
BootInformation::InitializeInitializationBlock(Parameters);
|
KE::BootInformation::InitializeInitializationBlock(Parameters);
|
||||||
|
|
||||||
/* Check if debugging enabled and if boot loader provided routine for debug printing */
|
/* Check if debugging enabled and if boot loader provided routine for debug printing */
|
||||||
if(DEBUG && BootInformation::GetDebugPrint())
|
if(DEBUG && KE::BootInformation::GetDebugPrint())
|
||||||
{
|
{
|
||||||
/* Use loader's provided DbgPrint() routine for early printing to serial console */
|
/* Use loader's provided DbgPrint() routine for early printing to serial console */
|
||||||
KD::DebugIo::SetPrintRoutine(BootInformation::GetDebugPrint());
|
KD::DebugIo::SetPrintRoutine(KE::BootInformation::GetDebugPrint());
|
||||||
DebugPrint(L"Initializing ExectOS v%d.%d for %s\n", XTOS_VERSION_MAJOR, XTOS_VERSION_MINOR, _ARCH_NAME);
|
DebugPrint(L"Initializing ExectOS v%d.%d for %s\n", XTOS_VERSION_MAJOR, XTOS_VERSION_MINOR, _ARCH_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ KeStartXtSystem(IN PKERNEL_INITIALIZATION_BLOCK Parameters)
|
|||||||
AR::Traps::SetUnhandledInterruptRoutine(HL::Irq::HandleUnexpectedInterrupt);
|
AR::Traps::SetUnhandledInterruptRoutine(HL::Irq::HandleUnexpectedInterrupt);
|
||||||
|
|
||||||
/* Initialize system resources */
|
/* Initialize system resources */
|
||||||
SystemResources::InitializeResources();
|
KE::SystemResources::InitializeResources();
|
||||||
|
|
||||||
/* Check if debugging enabled */
|
/* Check if debugging enabled */
|
||||||
if(DEBUG)
|
if(DEBUG)
|
||||||
@@ -67,11 +67,11 @@ KeStartXtSystem(IN PKERNEL_INITIALIZATION_BLOCK Parameters)
|
|||||||
XTOS_COMPILER_NAME, XTOS_COMPILER_VERSION);
|
XTOS_COMPILER_NAME, XTOS_COMPILER_VERSION);
|
||||||
|
|
||||||
/* Architecture specific kernel initialization */
|
/* Architecture specific kernel initialization */
|
||||||
KernelInit::InitializeMachine();
|
KE::KernelInit::InitializeMachine();
|
||||||
|
|
||||||
/* Raise to HIGH runlevel */
|
/* Raise to HIGH runlevel */
|
||||||
RunLevel::RaiseRunLevel(HIGH_LEVEL);
|
KE::RunLevel::RaiseRunLevel(HIGH_LEVEL);
|
||||||
|
|
||||||
/* Switch the boot stack and transfer control to the KepStartKernel() routine */
|
/* Switch the boot stack and transfer control to the KepStartKernel() routine */
|
||||||
KernelInit::SwitchBootStack();
|
KE::KernelInit::SwitchBootStack();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,10 +92,10 @@ KE::KThread::InitializeThread(IN PKPROCESS Process,
|
|||||||
Thread->Header.SignalState = 0;
|
Thread->Header.SignalState = 0;
|
||||||
|
|
||||||
/* Initialize thread wait list */
|
/* Initialize thread wait list */
|
||||||
RtlInitializeListHead(&Thread->Header.WaitListHead);
|
RTL::LinkedList::InitializeListHead(&Thread->Header.WaitListHead);
|
||||||
|
|
||||||
/* Initialize thread mutant list head */
|
/* Initialize thread mutant list head */
|
||||||
RtlInitializeListHead(&Thread->MutantListHead);
|
RTL::LinkedList::InitializeListHead(&Thread->MutantListHead);
|
||||||
|
|
||||||
/* Initialize the builtin wait blocks */
|
/* Initialize the builtin wait blocks */
|
||||||
for(Index = 0; Index <= KTHREAD_WAIT_BLOCK; Index++)
|
for(Index = 0; Index <= KTHREAD_WAIT_BLOCK; Index++)
|
||||||
@@ -113,7 +113,7 @@ KE::KThread::InitializeThread(IN PKPROCESS Process,
|
|||||||
Thread->AdjustReason = AdjustNone;
|
Thread->AdjustReason = AdjustNone;
|
||||||
|
|
||||||
/* Initialize thread lock */
|
/* Initialize thread lock */
|
||||||
SpinLock::InitializeSpinLock(&Thread->ThreadLock);
|
KE::SpinLock::InitializeSpinLock(&Thread->ThreadLock);
|
||||||
|
|
||||||
/* Initialize thread APC */
|
/* Initialize thread APC */
|
||||||
Thread->ApcStatePointer[0] = &Thread->ApcState;
|
Thread->ApcStatePointer[0] = &Thread->ApcState;
|
||||||
@@ -123,21 +123,21 @@ KE::KThread::InitializeThread(IN PKPROCESS Process,
|
|||||||
Thread->Process = Process;
|
Thread->Process = Process;
|
||||||
|
|
||||||
/* Initialize APC list heads */
|
/* Initialize APC list heads */
|
||||||
RtlInitializeListHead(&Thread->ApcState.ApcListHead[KernelMode]);
|
RTL::LinkedList::InitializeListHead(&Thread->ApcState.ApcListHead[KernelMode]);
|
||||||
RtlInitializeListHead(&Thread->ApcState.ApcListHead[UserMode]);
|
RTL::LinkedList::InitializeListHead(&Thread->ApcState.ApcListHead[UserMode]);
|
||||||
|
|
||||||
/* Initialize APC queue lock */
|
/* Initialize APC queue lock */
|
||||||
SpinLock::InitializeSpinLock(&Thread->ApcQueueLock);
|
KE::SpinLock::InitializeSpinLock(&Thread->ApcQueueLock);
|
||||||
|
|
||||||
/* Initialize kernel-mode suspend APC */
|
/* Initialize kernel-mode suspend APC */
|
||||||
Apc::InitializeApc(&Thread->SuspendApc, Thread, OriginalApcEnvironment, SuspendNop,
|
KE::Apc::InitializeApc(&Thread->SuspendApc, Thread, OriginalApcEnvironment, SuspendNop,
|
||||||
SuspendRundown, SuspendThread, KernelMode, NULLPTR);
|
SuspendRundown, SuspendThread, KernelMode, NULLPTR);
|
||||||
|
|
||||||
/* Initialize suspend semaphore */
|
/* Initialize suspend semaphore */
|
||||||
Semaphore::InitializeSemaphore(&Thread->SuspendSemaphore, 0, 2);
|
KE::Semaphore::InitializeSemaphore(&Thread->SuspendSemaphore, 0, 2);
|
||||||
|
|
||||||
/* Initialize the builtin timer */
|
/* Initialize the builtin timer */
|
||||||
Timer::InitializeTimer(&Thread->Timer, NotificationTimer);
|
KE::Timer::InitializeTimer(&Thread->Timer, NotificationTimer);
|
||||||
TimerWaitBlock = &Thread->WaitBlock[KTIMER_WAIT_BLOCK];
|
TimerWaitBlock = &Thread->WaitBlock[KTIMER_WAIT_BLOCK];
|
||||||
TimerWaitBlock->Object = &Thread->Timer;
|
TimerWaitBlock->Object = &Thread->Timer;
|
||||||
TimerWaitBlock->WaitKey = STATUS_TIMEOUT;
|
TimerWaitBlock->WaitKey = STATUS_TIMEOUT;
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ KE::SystemResources::GetSystemResource(IN SYSTEM_RESOURCE_TYPE ResourceType,
|
|||||||
|
|
||||||
/* Disable interrupts and acquire a spinlock */
|
/* Disable interrupts and acquire a spinlock */
|
||||||
AR::CpuFunc::ClearInterruptFlag();
|
AR::CpuFunc::ClearInterruptFlag();
|
||||||
SpinLock::AcquireSpinLock(&ResourcesLock);
|
KE::SpinLock::AcquireSpinLock(&ResourcesLock);
|
||||||
|
|
||||||
/* Iterate through system resources list */
|
/* Iterate through system resources list */
|
||||||
ListEntry = ResourcesListHead.Flink;
|
ListEntry = ResourcesListHead.Flink;
|
||||||
@@ -110,7 +110,7 @@ KE::SystemResources::GetSystemResource(IN SYSTEM_RESOURCE_TYPE ResourceType,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Release spinlock and re-enable interrupts if necessary */
|
/* Release spinlock and re-enable interrupts if necessary */
|
||||||
SpinLock::ReleaseSpinLock(&ResourcesLock);
|
KE::SpinLock::ReleaseSpinLock(&ResourcesLock);
|
||||||
if(Interrupts)
|
if(Interrupts)
|
||||||
{
|
{
|
||||||
/* Re-enable interrupts */
|
/* Re-enable interrupts */
|
||||||
@@ -160,15 +160,15 @@ KE::SystemResources::InitializeResources(VOID)
|
|||||||
ULONG ResourceSize;
|
ULONG ResourceSize;
|
||||||
|
|
||||||
/* Initialize system resources spin lock and resource list */
|
/* Initialize system resources spin lock and resource list */
|
||||||
SpinLock::InitializeSpinLock(&ResourcesLock);
|
KE::SpinLock::InitializeSpinLock(&ResourcesLock);
|
||||||
RTL::LinkedList::InitializeListHead(&ResourcesListHead);
|
RTL::LinkedList::InitializeListHead(&ResourcesListHead);
|
||||||
|
|
||||||
/* Make sure there are some system resources available */
|
/* Make sure there are some system resources available */
|
||||||
if(!RTL::LinkedList::ListEmpty(BootInformation::GetSystemResources()))
|
if(!RTL::LinkedList::ListEmpty(KE::BootInformation::GetSystemResources()))
|
||||||
{
|
{
|
||||||
/* Iterate through system resources list */
|
/* Iterate through system resources list */
|
||||||
ListEntry = BootInformation::GetSystemResources()->Flink;
|
ListEntry = KE::BootInformation::GetSystemResources()->Flink;
|
||||||
while(ListEntry != BootInformation::GetSystemResources())
|
while(ListEntry != KE::BootInformation::GetSystemResources())
|
||||||
{
|
{
|
||||||
/* Get resource header and next list entry */
|
/* Get resource header and next list entry */
|
||||||
ResourceHeader = CONTAIN_RECORD(ListEntry, SYSTEM_RESOURCE_HEADER, ListEntry);
|
ResourceHeader = CONTAIN_RECORD(ListEntry, SYSTEM_RESOURCE_HEADER, ListEntry);
|
||||||
@@ -221,12 +221,12 @@ KE::SystemResources::ReleaseResource(IN PSYSTEM_RESOURCE_HEADER ResourceHeader)
|
|||||||
{
|
{
|
||||||
/* Disable interrupts and acquire a spinlock */
|
/* Disable interrupts and acquire a spinlock */
|
||||||
AR::CpuFunc::ClearInterruptFlag();
|
AR::CpuFunc::ClearInterruptFlag();
|
||||||
SpinLock::AcquireSpinLock(&ResourcesLock);
|
KE::SpinLock::AcquireSpinLock(&ResourcesLock);
|
||||||
|
|
||||||
/* Release resource lock */
|
/* Release resource lock */
|
||||||
ResourceHeader->ResourceLocked = FALSE;
|
ResourceHeader->ResourceLocked = FALSE;
|
||||||
|
|
||||||
/* Release spinlock and enable interrupts */
|
/* Release spinlock and enable interrupts */
|
||||||
SpinLock::ReleaseSpinLock(&ResourcesLock);
|
KE::SpinLock::ReleaseSpinLock(&ResourcesLock);
|
||||||
AR::CpuFunc::SetInterruptFlag();
|
AR::CpuFunc::SetInterruptFlag();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ KE::Timer::CancelTimer(IN PKTIMER Timer)
|
|||||||
|
|
||||||
/* Raise run level and acquire dispatcher lock */
|
/* Raise run level and acquire dispatcher lock */
|
||||||
RunLevel = KE::RunLevel::RaiseRunLevel(SYNC_LEVEL);
|
RunLevel = KE::RunLevel::RaiseRunLevel(SYNC_LEVEL);
|
||||||
SpinLock::AcquireQueuedSpinLock(DispatcherLock);
|
KE::SpinLock::AcquireQueuedSpinLock(DispatcherLock);
|
||||||
|
|
||||||
/* Check timer status */
|
/* Check timer status */
|
||||||
if(Timer->Header.Inserted)
|
if(Timer->Header.Inserted)
|
||||||
@@ -42,8 +42,8 @@ KE::Timer::CancelTimer(IN PKTIMER Timer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Release dispatcher lock and process the deferred ready list */
|
/* Release dispatcher lock and process the deferred ready list */
|
||||||
SpinLock::ReleaseQueuedSpinLock(DispatcherLock);
|
KE::SpinLock::ReleaseQueuedSpinLock(DispatcherLock);
|
||||||
KThread::ExitDispatcher(RunLevel);
|
KE::KThread::ExitDispatcher(RunLevel);
|
||||||
|
|
||||||
/* Return result */
|
/* Return result */
|
||||||
return Result;
|
return Result;
|
||||||
@@ -139,7 +139,7 @@ KE::Timer::QueryTimer(IN PKTIMER Timer)
|
|||||||
|
|
||||||
/* Raise run level and acquire dispatcher lock */
|
/* Raise run level and acquire dispatcher lock */
|
||||||
RunLevel = KE::RunLevel::RaiseRunLevel(SYNC_LEVEL);
|
RunLevel = KE::RunLevel::RaiseRunLevel(SYNC_LEVEL);
|
||||||
SpinLock::AcquireQueuedSpinLock(DispatcherLock);
|
KE::SpinLock::AcquireQueuedSpinLock(DispatcherLock);
|
||||||
|
|
||||||
/* Check timer status */
|
/* Check timer status */
|
||||||
if(Timer->Header.Inserted)
|
if(Timer->Header.Inserted)
|
||||||
@@ -149,8 +149,8 @@ KE::Timer::QueryTimer(IN PKTIMER Timer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Release dispatcher lock and process the deferred ready list */
|
/* Release dispatcher lock and process the deferred ready list */
|
||||||
SpinLock::ReleaseQueuedSpinLock(DispatcherLock);
|
KE::SpinLock::ReleaseQueuedSpinLock(DispatcherLock);
|
||||||
KThread::ExitDispatcher(RunLevel);
|
KE::KThread::ExitDispatcher(RunLevel);
|
||||||
|
|
||||||
/* Return timer's due time */
|
/* Return timer's due time */
|
||||||
return DueTime;
|
return DueTime;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ VOID
|
|||||||
PO::Idle::InitializeProcessorIdleState(IN OUT PKPROCESSOR_CONTROL_BLOCK Prcb)
|
PO::Idle::InitializeProcessorIdleState(IN OUT PKPROCESSOR_CONTROL_BLOCK Prcb)
|
||||||
{
|
{
|
||||||
/* Zero memory */
|
/* Zero memory */
|
||||||
RtlZeroMemory(&Prcb->PowerState, sizeof(Prcb->PowerState));
|
RTL::Memory::ZeroMemory(&Prcb->PowerState, sizeof(Prcb->PowerState));
|
||||||
|
|
||||||
/* Initialize default power state */
|
/* Initialize default power state */
|
||||||
Prcb->PowerState.Idle0TimeLimit = 0xFFFFFFFF;
|
Prcb->PowerState.Idle0TimeLimit = 0xFFFFFFFF;
|
||||||
@@ -33,9 +33,9 @@ PO::Idle::InitializeProcessorIdleState(IN OUT PKPROCESSOR_CONTROL_BLOCK Prcb)
|
|||||||
Prcb->PowerState.IdleFunction = Idle0Function;
|
Prcb->PowerState.IdleFunction = Idle0Function;
|
||||||
|
|
||||||
/* Initialize DPC and Timer */
|
/* Initialize DPC and Timer */
|
||||||
KeInitializeDpc(&Prcb->PowerState.PerfDpc, PerfIdleDpc, Prcb);
|
KE::Dpc::InitializeDpc(&Prcb->PowerState.PerfDpc, PerfIdleDpc, Prcb);
|
||||||
KeSetTargetProcessorDpc(&Prcb->PowerState.PerfDpc, Prcb->CpuNumber);
|
KE::Dpc::SetTargetProcessor(&Prcb->PowerState.PerfDpc, Prcb->CpuNumber);
|
||||||
KeInitializeTimer(&Prcb->PowerState.PerfTimer, SynchronizationTimer);
|
KE::Timer::InitializeTimer(&Prcb->PowerState.PerfTimer, SynchronizationTimer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ RTL::Memory::MoveMemory(OUT PVOID Destination,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Forward buffer copy */
|
/* Forward buffer copy */
|
||||||
RtlCopyMemory(Destination, Source, Length);
|
CopyMemory(Destination, Source, Length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user