Refactor KE subsystem
This commit is contained in:
@@ -26,8 +26,9 @@ namespace KE
|
|||||||
STATIC XTAPI XTSTATUS GetKernelParameter(IN PCWSTR ParameterName,
|
STATIC XTAPI XTSTATUS GetKernelParameter(IN PCWSTR ParameterName,
|
||||||
OUT PCWSTR *Parameter);
|
OUT PCWSTR *Parameter);
|
||||||
STATIC XTAPI PLIST_ENTRY GetSystemResources(VOID);
|
STATIC XTAPI PLIST_ENTRY GetSystemResources(VOID);
|
||||||
STATIC XTAPI VOID SetInitializationBlock(IN PKERNEL_INITIALIZATION_BLOCK Block);
|
STATIC XTAPI VOID InitializeInitializationBlock(IN PKERNEL_INITIALIZATION_BLOCK Block);
|
||||||
|
|
||||||
|
/* TEMPORARY FOR COMPATIBILITY WITH C CODE */
|
||||||
STATIC XTAPI PKERNEL_INITIALIZATION_BLOCK GetInitializationBlock(VOID)
|
STATIC XTAPI PKERNEL_INITIALIZATION_BLOCK GetInitializationBlock(VOID)
|
||||||
{
|
{
|
||||||
return InitializationBlock;
|
return InitializationBlock;
|
||||||
|
@@ -9,10 +9,6 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Kernel Library */
|
|
||||||
namespace KE
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets new interrupt handler for the existing IDT entry.
|
* Sets new interrupt handler for the existing IDT entry.
|
||||||
*
|
*
|
||||||
@@ -28,13 +24,13 @@ namespace KE
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
Irq::SetInterruptHandler(IN ULONG Vector,
|
KE::Irq::SetInterruptHandler(IN ULONG Vector,
|
||||||
IN PVOID Handler)
|
IN PVOID Handler)
|
||||||
{
|
{
|
||||||
PKPROCESSOR_BLOCK ProcessorBlock;
|
PKPROCESSOR_BLOCK ProcessorBlock;
|
||||||
|
|
||||||
/* Get current processor block */
|
/* Get current processor block */
|
||||||
ProcessorBlock = KeGetCurrentProcessorBlock();
|
ProcessorBlock = KE::Processor::GetCurrentProcessorBlock();
|
||||||
|
|
||||||
/* Update interrupt handler */
|
/* Update interrupt handler */
|
||||||
ProcessorBlock->IdtBase[(UCHAR) Vector].OffsetLow = ((ULONG_PTR)Handler & 0xFFFF);
|
ProcessorBlock->IdtBase[(UCHAR) Vector].OffsetLow = ((ULONG_PTR)Handler & 0xFFFF);
|
||||||
@@ -42,7 +38,6 @@ Irq::SetInterruptHandler(IN ULONG Vector,
|
|||||||
ProcessorBlock->IdtBase[(UCHAR) Vector].OffsetHigh = (ULONG_PTR)Handler >> 32;
|
ProcessorBlock->IdtBase[(UCHAR) Vector].OffsetHigh = (ULONG_PTR)Handler >> 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
|
||||||
|
|
||||||
/* TEMPORARY FOR COMPATIBILITY WITH C CODE */
|
/* TEMPORARY FOR COMPATIBILITY WITH C CODE */
|
||||||
|
@@ -9,10 +9,6 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Kernel Library */
|
|
||||||
namespace KE
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This routine initializes XT kernel.
|
* This routine initializes XT kernel.
|
||||||
*
|
*
|
||||||
@@ -22,7 +18,7 @@ namespace KE
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KernelInit::InitializeKernel(VOID)
|
KE::KernelInit::InitializeKernel(VOID)
|
||||||
{
|
{
|
||||||
XTSTATUS Status;
|
XTSTATUS Status;
|
||||||
|
|
||||||
@@ -45,7 +41,7 @@ KernelInit::InitializeKernel(VOID)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KernelInit::InitializeMachine(VOID)
|
KE::KernelInit::InitializeMachine(VOID)
|
||||||
{
|
{
|
||||||
/* Re-enable IDE interrupts */
|
/* Re-enable IDE interrupts */
|
||||||
HlIoPortOutByte(0x376, 0);
|
HlIoPortOutByte(0x376, 0);
|
||||||
@@ -70,7 +66,7 @@ KernelInit::InitializeMachine(VOID)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KernelInit::StartKernel(VOID)
|
KE::KernelInit::StartKernel(VOID)
|
||||||
{
|
{
|
||||||
PKPROCESSOR_CONTROL_BLOCK Prcb;
|
PKPROCESSOR_CONTROL_BLOCK Prcb;
|
||||||
ULONG_PTR PageDirectory[2];
|
ULONG_PTR PageDirectory[2];
|
||||||
@@ -125,7 +121,7 @@ KernelInit::StartKernel(VOID)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KernelInit::SwitchBootStack(VOID)
|
KE::KernelInit::SwitchBootStack(VOID)
|
||||||
{
|
{
|
||||||
ULONG_PTR Stack;
|
ULONG_PTR Stack;
|
||||||
PVOID StartKernel;
|
PVOID StartKernel;
|
||||||
@@ -148,5 +144,3 @@ KernelInit::SwitchBootStack(VOID)
|
|||||||
"r" (StartKernel)
|
"r" (StartKernel)
|
||||||
: "rdx", "rbp", "rsp", "memory");
|
: "rdx", "rbp", "rsp", "memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
@@ -9,10 +9,6 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Kernel Library */
|
|
||||||
namespace KE
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes CPU architecture dependent context of a thread.
|
* Initializes CPU architecture dependent context of a thread.
|
||||||
*
|
*
|
||||||
@@ -37,11 +33,11 @@ namespace KE
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KThread::InitializeThreadContext(IN PKTHREAD Thread,
|
KE::KThread::InitializeThreadContext(IN PKTHREAD Thread,
|
||||||
IN PKSYSTEM_ROUTINE SystemRoutine,
|
IN PKSYSTEM_ROUTINE SystemRoutine,
|
||||||
IN PKSTART_ROUTINE StartRoutine,
|
IN PKSTART_ROUTINE StartRoutine,
|
||||||
IN PVOID StartContext,
|
IN PVOID StartContext,
|
||||||
IN PCONTEXT ContextRecord)
|
IN PCONTEXT ContextRecord)
|
||||||
{
|
{
|
||||||
PKTHREAD_INIT_FRAME ThreadFrame;
|
PKTHREAD_INIT_FRAME ThreadFrame;
|
||||||
|
|
||||||
@@ -49,7 +45,7 @@ KThread::InitializeThreadContext(IN PKTHREAD Thread,
|
|||||||
ThreadFrame = ((PKTHREAD_INIT_FRAME)Thread->InitialStack) - 1;
|
ThreadFrame = ((PKTHREAD_INIT_FRAME)Thread->InitialStack) - 1;
|
||||||
|
|
||||||
/* Fill floating point save area with zeroes */
|
/* Fill floating point save area with zeroes */
|
||||||
RtlZeroMemory(&ThreadFrame->NpxFrame, sizeof(FLOATING_SAVE_AREA));
|
RTL::Memory::ZeroMemory(&ThreadFrame->NpxFrame, sizeof(FLOATING_SAVE_AREA));
|
||||||
|
|
||||||
/* Check if context provided for this thread */
|
/* Check if context provided for this thread */
|
||||||
if(ContextRecord)
|
if(ContextRecord)
|
||||||
@@ -58,8 +54,8 @@ KThread::InitializeThreadContext(IN PKTHREAD Thread,
|
|||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
|
|
||||||
/* Fill exception and trap frames with zeroes */
|
/* Fill exception and trap frames with zeroes */
|
||||||
RtlZeroMemory(&ThreadFrame->ExceptionFrame, sizeof(KEXCEPTION_FRAME));
|
RTL::Memory::ZeroMemory(&ThreadFrame->ExceptionFrame, sizeof(KEXCEPTION_FRAME));
|
||||||
RtlZeroMemory(&ThreadFrame->TrapFrame, sizeof(KTRAP_FRAME));
|
RTL::Memory::ZeroMemory(&ThreadFrame->TrapFrame, sizeof(KTRAP_FRAME));
|
||||||
|
|
||||||
/* Disable debug registers and enable context registers */
|
/* Disable debug registers and enable context registers */
|
||||||
ContextRecord->ContextFlags &= ~CONTEXT_DEBUG_REGISTERS | CONTEXT_CONTROL;
|
ContextRecord->ContextFlags &= ~CONTEXT_DEBUG_REGISTERS | CONTEXT_CONTROL;
|
||||||
@@ -120,5 +116,3 @@ KThread::InitializeThreadContext(IN PKTHREAD Thread,
|
|||||||
/* Set thread stack */
|
/* Set thread stack */
|
||||||
Thread->KernelStack = &ThreadFrame->SwitchFrame;
|
Thread->KernelStack = &ThreadFrame->SwitchFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace */
|
|
@@ -9,10 +9,6 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Kernel Library */
|
|
||||||
namespace KE
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the processor block for the currently executing processor.
|
* Gets the processor block for the currently executing processor.
|
||||||
*
|
*
|
||||||
@@ -22,7 +18,7 @@ namespace KE
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
PKPROCESSOR_BLOCK
|
PKPROCESSOR_BLOCK
|
||||||
Processor::GetCurrentProcessorBlock(VOID)
|
KE::Processor::GetCurrentProcessorBlock(VOID)
|
||||||
{
|
{
|
||||||
/* Get processor block from GS register */
|
/* Get processor block from GS register */
|
||||||
return (PKPROCESSOR_BLOCK)AR::CpuFunc::ReadGSQuadWord(FIELD_OFFSET(KPROCESSOR_BLOCK, Self));
|
return (PKPROCESSOR_BLOCK)AR::CpuFunc::ReadGSQuadWord(FIELD_OFFSET(KPROCESSOR_BLOCK, Self));
|
||||||
@@ -37,7 +33,7 @@ Processor::GetCurrentProcessorBlock(VOID)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
PKPROCESSOR_CONTROL_BLOCK
|
PKPROCESSOR_CONTROL_BLOCK
|
||||||
Processor::GetCurrentProcessorControlBlock(VOID)
|
KE::Processor::GetCurrentProcessorControlBlock(VOID)
|
||||||
{
|
{
|
||||||
return (PKPROCESSOR_CONTROL_BLOCK)AR::CpuFunc::ReadGSQuadWord(FIELD_OFFSET(KPROCESSOR_BLOCK, CurrentPrcb));
|
return (PKPROCESSOR_CONTROL_BLOCK)AR::CpuFunc::ReadGSQuadWord(FIELD_OFFSET(KPROCESSOR_BLOCK, CurrentPrcb));
|
||||||
}
|
}
|
||||||
@@ -51,7 +47,7 @@ Processor::GetCurrentProcessorControlBlock(VOID)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
ULONG
|
ULONG
|
||||||
Processor::GetCurrentProcessorNumber(VOID)
|
KE::Processor::GetCurrentProcessorNumber(VOID)
|
||||||
{
|
{
|
||||||
return (ULONG)AR::CpuFunc::ReadGSQuadWord(FIELD_OFFSET(KPROCESSOR_BLOCK, CpuNumber));
|
return (ULONG)AR::CpuFunc::ReadGSQuadWord(FIELD_OFFSET(KPROCESSOR_BLOCK, CpuNumber));
|
||||||
}
|
}
|
||||||
@@ -65,7 +61,7 @@ Processor::GetCurrentProcessorNumber(VOID)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
PKTHREAD
|
PKTHREAD
|
||||||
Processor::GetCurrentThread(VOID)
|
KE::Processor::GetCurrentThread(VOID)
|
||||||
{
|
{
|
||||||
return (PKTHREAD)AR::CpuFunc::ReadGSQuadWord(FIELD_OFFSET(KPROCESSOR_BLOCK, Prcb.CurrentThread));
|
return (PKTHREAD)AR::CpuFunc::ReadGSQuadWord(FIELD_OFFSET(KPROCESSOR_BLOCK, Prcb.CurrentThread));
|
||||||
}
|
}
|
||||||
@@ -82,7 +78,7 @@ Processor::GetCurrentThread(VOID)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
Processor::SaveProcessorState(OUT PKPROCESSOR_STATE CpuState)
|
KE::Processor::SaveProcessorState(OUT PKPROCESSOR_STATE CpuState)
|
||||||
{
|
{
|
||||||
/* Save CR registers */
|
/* Save CR registers */
|
||||||
CpuState->SpecialRegisters.Cr0 = AR::CpuFunc::ReadControlRegister(0);
|
CpuState->SpecialRegisters.Cr0 = AR::CpuFunc::ReadControlRegister(0);
|
||||||
@@ -117,7 +113,6 @@ Processor::SaveProcessorState(OUT PKPROCESSOR_STATE CpuState)
|
|||||||
AR::CpuFunc::StoreTaskRegister(&CpuState->SpecialRegisters.Tr);
|
AR::CpuFunc::StoreTaskRegister(&CpuState->SpecialRegisters.Tr);
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -159,4 +154,4 @@ VOID
|
|||||||
KepSaveProcessorState(OUT PKPROCESSOR_STATE CpuState)
|
KepSaveProcessorState(OUT PKPROCESSOR_STATE CpuState)
|
||||||
{
|
{
|
||||||
KE::Processor::SaveProcessorState(CpuState);
|
KE::Processor::SaveProcessorState(CpuState);
|
||||||
}
|
}
|
||||||
|
@@ -9,10 +9,6 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Kernel Library */
|
|
||||||
namespace KE
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes an APC object.
|
* Initializes an APC object.
|
||||||
*
|
*
|
||||||
@@ -46,14 +42,14 @@ namespace KE
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
Apc::InitializeApc(IN PKAPC Apc,
|
KE::Apc::InitializeApc(IN PKAPC Apc,
|
||||||
IN PKTHREAD Thread,
|
IN PKTHREAD Thread,
|
||||||
IN KAPC_ENVIRONMENT Environment,
|
IN KAPC_ENVIRONMENT Environment,
|
||||||
IN PKKERNEL_ROUTINE KernelRoutine,
|
IN PKKERNEL_ROUTINE KernelRoutine,
|
||||||
IN PKRUNDOWN_ROUTINE RundownRoutine,
|
IN PKRUNDOWN_ROUTINE RundownRoutine,
|
||||||
IN PKNORMAL_ROUTINE NormalRoutine,
|
IN PKNORMAL_ROUTINE NormalRoutine,
|
||||||
IN KPROCESSOR_MODE ApcMode,
|
IN KPROCESSOR_MODE ApcMode,
|
||||||
IN PVOID Context)
|
IN PVOID Context)
|
||||||
{
|
{
|
||||||
/* Set APC type and thread */
|
/* Set APC type and thread */
|
||||||
Apc->Type = ApcObject;
|
Apc->Type = ApcObject;
|
||||||
@@ -93,5 +89,3 @@ Apc::InitializeApc(IN PKAPC Apc,
|
|||||||
/* Mark APC as not inserted yet */
|
/* Mark APC as not inserted yet */
|
||||||
Apc->Inserted = FALSE;
|
Apc->Inserted = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
@@ -9,13 +9,9 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Kernel Library */
|
|
||||||
namespace KE
|
|
||||||
{
|
|
||||||
|
|
||||||
XTAPI
|
XTAPI
|
||||||
PVOID
|
PVOID
|
||||||
BootInformation::GetDebugPrint(VOID)
|
KE::BootInformation::GetDebugPrint(VOID)
|
||||||
{
|
{
|
||||||
return InitializationBlock->LoaderInformation.DbgPrint;
|
return InitializationBlock->LoaderInformation.DbgPrint;
|
||||||
}
|
}
|
||||||
@@ -29,7 +25,7 @@ BootInformation::GetDebugPrint(VOID)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
SYSTEM_FIRMWARE_TYPE
|
SYSTEM_FIRMWARE_TYPE
|
||||||
BootInformation::GetFirmwareType(VOID)
|
KE::BootInformation::GetFirmwareType(VOID)
|
||||||
{
|
{
|
||||||
return InitializationBlock->FirmwareInformation.FirmwareType;
|
return InitializationBlock->FirmwareInformation.FirmwareType;
|
||||||
}
|
}
|
||||||
@@ -49,8 +45,8 @@ BootInformation::GetFirmwareType(VOID)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
XTSTATUS
|
XTSTATUS
|
||||||
BootInformation::GetKernelParameter(IN PCWSTR ParameterName,
|
KE::BootInformation::GetKernelParameter(IN PCWSTR ParameterName,
|
||||||
OUT PCWSTR *Parameter)
|
OUT PCWSTR *Parameter)
|
||||||
{
|
{
|
||||||
PCWSTR Match, SearchStart;
|
PCWSTR Match, SearchStart;
|
||||||
SIZE_T ParameterNameLength;
|
SIZE_T ParameterNameLength;
|
||||||
@@ -63,7 +59,7 @@ BootInformation::GetKernelParameter(IN PCWSTR ParameterName,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Get the length of the parameter name we are looking for */
|
/* Get the length of the parameter name we are looking for */
|
||||||
ParameterNameLength = RtlWideStringLength(ParameterName, 0);
|
ParameterNameLength = RTL::WideString::WideStringLength(ParameterName, 0);
|
||||||
if(ParameterNameLength == 0)
|
if(ParameterNameLength == 0)
|
||||||
{
|
{
|
||||||
/* Do not allow empty parameter names */
|
/* Do not allow empty parameter names */
|
||||||
@@ -77,7 +73,7 @@ BootInformation::GetKernelParameter(IN PCWSTR ParameterName,
|
|||||||
SearchStart = InitializationBlock->KernelParameters;
|
SearchStart = InitializationBlock->KernelParameters;
|
||||||
|
|
||||||
/* Search for the parameter name */
|
/* Search for the parameter name */
|
||||||
while((Match = RtlFindWideStringInsensitive(SearchStart, ParameterName)))
|
while((Match = RTL::WideString::FindWideStringInsensitive(SearchStart, ParameterName)))
|
||||||
{
|
{
|
||||||
/* Check if the match is at the start of the string or preceded by a space */
|
/* Check if the match is at the start of the string or preceded by a space */
|
||||||
if(Match == InitializationBlock->KernelParameters || *(Match - 1) == L' ')
|
if(Match == InitializationBlock->KernelParameters || *(Match - 1) == L' ')
|
||||||
@@ -102,32 +98,37 @@ BootInformation::GetKernelParameter(IN PCWSTR ParameterName,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Retrieves a pointer to the list of system resources.
|
||||||
*
|
*
|
||||||
|
* @return This routine returns a pointer to the list of system resources.
|
||||||
*
|
*
|
||||||
*
|
* @since XT 1.0
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
PLIST_ENTRY
|
PLIST_ENTRY
|
||||||
BootInformation::GetSystemResources(VOID)
|
KE::BootInformation::GetSystemResources(VOID)
|
||||||
{
|
{
|
||||||
return &InitializationBlock->SystemResourcesListHead;
|
return &InitializationBlock->SystemResourcesListHead;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Initializes the bootloader-provided system information.
|
||||||
*
|
*
|
||||||
|
* @param Block
|
||||||
|
* Supplies a pointer to the kernel initialization block.
|
||||||
*
|
*
|
||||||
|
* @return This routine does not return any value.
|
||||||
*
|
*
|
||||||
*
|
* @since XT 1.0
|
||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
BootInformation::SetInitializationBlock(IN PKERNEL_INITIALIZATION_BLOCK Block)
|
KE::BootInformation::InitializeInitializationBlock(IN PKERNEL_INITIALIZATION_BLOCK Block)
|
||||||
{
|
{
|
||||||
InitializationBlock = Block;
|
InitializationBlock = Block;
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
|
||||||
|
|
||||||
/* TEMPORARY FOR COMPATIBILITY WITH C CODE */
|
/* TEMPORARY FOR COMPATIBILITY WITH C CODE */
|
||||||
@@ -140,10 +141,11 @@ KeGetKernelParameter(IN PCWSTR ParameterName,
|
|||||||
return KE::BootInformation::GetKernelParameter(ParameterName, Parameter);
|
return KE::BootInformation::GetKernelParameter(ParameterName, Parameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TEMPORARY FOR COMPATIBILITY WITH C CODE */
|
||||||
XTCLINK
|
XTCLINK
|
||||||
XTAPI
|
XTAPI
|
||||||
PKERNEL_INITIALIZATION_BLOCK
|
PKERNEL_INITIALIZATION_BLOCK
|
||||||
KeGetInitializationBlock(VOID)
|
KeGetInitializationBlock(VOID)
|
||||||
{
|
{
|
||||||
return KE::BootInformation::GetInitializationBlock();
|
return KE::BootInformation::GetInitializationBlock();
|
||||||
}
|
}
|
||||||
|
@@ -9,10 +9,6 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Kernel Library */
|
|
||||||
namespace KE
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Halts the system.
|
* Halts the system.
|
||||||
*
|
*
|
||||||
@@ -22,7 +18,7 @@ namespace KE
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
Crash::HaltSystem(VOID)
|
KE::Crash::HaltSystem(VOID)
|
||||||
{
|
{
|
||||||
/* Enter infinite loop */
|
/* Enter infinite loop */
|
||||||
for(;;)
|
for(;;)
|
||||||
@@ -45,7 +41,7 @@ Crash::HaltSystem(VOID)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
Crash::Panic(IN ULONG Code)
|
KE::Crash::Panic(IN ULONG Code)
|
||||||
{
|
{
|
||||||
PanicEx(Code, 0, 0, 0, 0);
|
PanicEx(Code, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
@@ -74,7 +70,7 @@ Crash::Panic(IN ULONG Code)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
Crash::PanicEx(IN ULONG Code,
|
KE::Crash::PanicEx(IN ULONG Code,
|
||||||
IN ULONG_PTR Parameter1,
|
IN ULONG_PTR Parameter1,
|
||||||
IN ULONG_PTR Parameter2,
|
IN ULONG_PTR Parameter2,
|
||||||
IN ULONG_PTR Parameter3,
|
IN ULONG_PTR Parameter3,
|
||||||
@@ -84,7 +80,6 @@ Crash::PanicEx(IN ULONG Code,
|
|||||||
HaltSystem();
|
HaltSystem();
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
|
||||||
|
|
||||||
/* TEMPORARY FOR COMPATIBILITY WITH C CODE */
|
/* TEMPORARY FOR COMPATIBILITY WITH C CODE */
|
||||||
|
@@ -9,26 +9,20 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Kernel Library */
|
|
||||||
namespace KE
|
|
||||||
{
|
|
||||||
|
|
||||||
/* Kernel initialization block passed by boot loader */
|
/* Kernel initialization block passed by boot loader */
|
||||||
PKERNEL_INITIALIZATION_BLOCK BootInformation::InitializationBlock = {};
|
PKERNEL_INITIALIZATION_BLOCK KE::BootInformation::InitializationBlock = {};
|
||||||
|
|
||||||
/* Kernel boot resources list */
|
/* Kernel boot resources list */
|
||||||
LIST_ENTRY SystemResources::ResourcesListHead;
|
LIST_ENTRY KE::SystemResources::ResourcesListHead;
|
||||||
|
|
||||||
/* Kernel boot resources lock */
|
/* Kernel boot resources lock */
|
||||||
KSPIN_LOCK SystemResources::ResourcesLock;
|
KSPIN_LOCK KE::SystemResources::ResourcesLock;
|
||||||
|
|
||||||
/* Kernel initial process */
|
/* Kernel initial process */
|
||||||
EPROCESS KProcess::InitialProcess;
|
EPROCESS KE::KProcess::InitialProcess;
|
||||||
|
|
||||||
/* Kernel initial thread */
|
/* Kernel initial thread */
|
||||||
ETHREAD KThread::InitialThread = {};
|
ETHREAD KE::KThread::InitialThread = {};
|
||||||
|
|
||||||
/* Kernel UBSAN active frame flag */
|
/* Kernel UBSAN active frame flag */
|
||||||
BOOLEAN KUbsan::ActiveFrame = FALSE;
|
BOOLEAN KE::KUbsan::ActiveFrame = FALSE;
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
@@ -9,10 +9,6 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Kernel Library */
|
|
||||||
namespace KE
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes Deferred Procedure Call (DPC) object.
|
* Initializes Deferred Procedure Call (DPC) object.
|
||||||
*
|
*
|
||||||
@@ -31,9 +27,9 @@ namespace KE
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
Dpc::InitializeDpc(IN PKDPC Dpc,
|
KE::Dpc::InitializeDpc(IN PKDPC Dpc,
|
||||||
IN PKDEFERRED_ROUTINE DpcRoutine,
|
IN PKDEFERRED_ROUTINE DpcRoutine,
|
||||||
IN PVOID DpcContext)
|
IN PVOID DpcContext)
|
||||||
{
|
{
|
||||||
/* Initialize DPC */
|
/* Initialize DPC */
|
||||||
Dpc->Type = DpcObject;
|
Dpc->Type = DpcObject;
|
||||||
@@ -64,9 +60,9 @@ Dpc::InitializeDpc(IN PKDPC Dpc,
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
Dpc::InitializeThreadedDpc(IN PKDPC Dpc,
|
KE::Dpc::InitializeThreadedDpc(IN PKDPC Dpc,
|
||||||
IN PKDEFERRED_ROUTINE DpcRoutine,
|
IN PKDEFERRED_ROUTINE DpcRoutine,
|
||||||
IN PVOID DpcContext)
|
IN PVOID DpcContext)
|
||||||
{
|
{
|
||||||
/* Initialize threaded DPC */
|
/* Initialize threaded DPC */
|
||||||
Dpc->Type = ThreadedDpcObject;
|
Dpc->Type = ThreadedDpcObject;
|
||||||
@@ -94,8 +90,8 @@ Dpc::InitializeThreadedDpc(IN PKDPC Dpc,
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
Dpc::SetTargetProcessor(IN PKDPC Dpc,
|
KE::Dpc::SetTargetProcessor(IN PKDPC Dpc,
|
||||||
IN CCHAR Number)
|
IN CCHAR Number)
|
||||||
{
|
{
|
||||||
Dpc->Number = MAXIMUM_PROCESSORS + Number;
|
Dpc->Number = MAXIMUM_PROCESSORS + Number;
|
||||||
}
|
}
|
||||||
@@ -112,7 +108,7 @@ Dpc::SetTargetProcessor(IN PKDPC Dpc,
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
Dpc::SignalCallDone(IN PVOID SystemArgument)
|
KE::Dpc::SignalCallDone(IN PVOID SystemArgument)
|
||||||
{
|
{
|
||||||
RTL::Atomic::Decrement32((PLONG)SystemArgument);
|
RTL::Atomic::Decrement32((PLONG)SystemArgument);
|
||||||
}
|
}
|
||||||
@@ -129,7 +125,7 @@ Dpc::SignalCallDone(IN PVOID SystemArgument)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
Dpc::SignalCallSynchronize(IN PVOID SystemArgument)
|
KE::Dpc::SignalCallSynchronize(IN PVOID SystemArgument)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
|
|
||||||
@@ -149,9 +145,7 @@ Dpc::SignalCallSynchronize(IN PVOID SystemArgument)
|
|||||||
*/
|
*/
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
VOID
|
VOID
|
||||||
Dpc::RetireList(IN PKPROCESSOR_CONTROL_BLOCK Prcb)
|
KE::Dpc::RetireList(IN PKPROCESSOR_CONTROL_BLOCK Prcb)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
@@ -9,10 +9,6 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Kernel Library */
|
|
||||||
namespace KE
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears the signal state of the event.
|
* Clears the signal state of the event.
|
||||||
*
|
*
|
||||||
@@ -25,7 +21,7 @@ namespace KE
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
Event::ClearEvent(IN PKEVENT Event)
|
KE::Event::ClearEvent(IN PKEVENT Event)
|
||||||
{
|
{
|
||||||
/* Clear event's signal state */
|
/* Clear event's signal state */
|
||||||
Event->Header.SignalState = FALSE;
|
Event->Header.SignalState = FALSE;
|
||||||
@@ -49,9 +45,9 @@ Event::ClearEvent(IN PKEVENT Event)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
Event::InitializeEvent(OUT PKEVENT Event,
|
KE::Event::InitializeEvent(OUT PKEVENT Event,
|
||||||
IN KEVENT_TYPE EventType,
|
IN KEVENT_TYPE EventType,
|
||||||
IN BOOLEAN InitialState)
|
IN BOOLEAN InitialState)
|
||||||
{
|
{
|
||||||
/* Initialize event dispatcher header */
|
/* Initialize event dispatcher header */
|
||||||
Event->Header.Type = EventType;
|
Event->Header.Type = EventType;
|
||||||
@@ -79,13 +75,11 @@ Event::InitializeEvent(OUT PKEVENT Event,
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
LONG
|
LONG
|
||||||
Event::SetEvent(IN PKEVENT Event,
|
KE::Event::SetEvent(IN PKEVENT Event,
|
||||||
IN KPRIORITY Increment,
|
IN KPRIORITY Increment,
|
||||||
IN BOOLEAN Wait)
|
IN BOOLEAN Wait)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
@@ -9,10 +9,6 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Kernel Library */
|
|
||||||
namespace KE
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets new interrupt handler for the existing IDT entry.
|
* Sets new interrupt handler for the existing IDT entry.
|
||||||
*
|
*
|
||||||
@@ -28,20 +24,19 @@ namespace KE
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
Irq::SetInterruptHandler(IN ULONG Vector,
|
KE::Irq::SetInterruptHandler(IN ULONG Vector,
|
||||||
IN PVOID Handler)
|
IN PVOID Handler)
|
||||||
{
|
{
|
||||||
PKPROCESSOR_BLOCK ProcessorBlock;
|
PKPROCESSOR_BLOCK ProcessorBlock;
|
||||||
|
|
||||||
/* Get current processor block */
|
/* Get current processor block */
|
||||||
ProcessorBlock = KeGetCurrentProcessorBlock();
|
ProcessorBlock = KE::Processor::GetCurrentProcessorBlock();
|
||||||
|
|
||||||
/* Update interrupt handler */
|
/* Update interrupt handler */
|
||||||
ProcessorBlock->IdtBase[(UCHAR) Vector].Offset = (USHORT)((ULONG)Handler & 0xFFFF);
|
ProcessorBlock->IdtBase[(UCHAR) Vector].Offset = (USHORT)((ULONG)Handler & 0xFFFF);
|
||||||
ProcessorBlock->IdtBase[(UCHAR) Vector].ExtendedOffset = (USHORT)((ULONG)Handler >> 16);
|
ProcessorBlock->IdtBase[(UCHAR) Vector].ExtendedOffset = (USHORT)((ULONG)Handler >> 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -9,10 +9,6 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Kernel Library */
|
|
||||||
namespace KE
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This routine initializes XT kernel.
|
* This routine initializes XT kernel.
|
||||||
*
|
*
|
||||||
@@ -22,7 +18,7 @@ namespace KE
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KernelInit::InitializeKernel(VOID)
|
KE::KernelInit::InitializeKernel(VOID)
|
||||||
{
|
{
|
||||||
XTSTATUS Status;
|
XTSTATUS Status;
|
||||||
|
|
||||||
@@ -45,7 +41,7 @@ KernelInit::InitializeKernel(VOID)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KernelInit::InitializeMachine(VOID)
|
KE::KernelInit::InitializeMachine(VOID)
|
||||||
{
|
{
|
||||||
/* Re-enable IDE interrupts */
|
/* Re-enable IDE interrupts */
|
||||||
HlIoPortOutByte(0x376, 0);
|
HlIoPortOutByte(0x376, 0);
|
||||||
@@ -70,7 +66,7 @@ KernelInit::InitializeMachine(VOID)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KernelInit::StartKernel(VOID)
|
KE::KernelInit::StartKernel(VOID)
|
||||||
{
|
{
|
||||||
PKPROCESSOR_CONTROL_BLOCK Prcb;
|
PKPROCESSOR_CONTROL_BLOCK Prcb;
|
||||||
ULONG_PTR PageDirectory[2];
|
ULONG_PTR PageDirectory[2];
|
||||||
@@ -125,7 +121,7 @@ KernelInit::StartKernel(VOID)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KernelInit::SwitchBootStack(VOID)
|
KE::KernelInit::SwitchBootStack(VOID)
|
||||||
{
|
{
|
||||||
ULONG_PTR Stack;
|
ULONG_PTR Stack;
|
||||||
PVOID StartKernel;
|
PVOID StartKernel;
|
||||||
@@ -150,5 +146,3 @@ KernelInit::SwitchBootStack(VOID)
|
|||||||
"r" (StartKernel)
|
"r" (StartKernel)
|
||||||
: "edx", "ebp", "esp", "memory");
|
: "edx", "ebp", "esp", "memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
@@ -9,10 +9,6 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Kernel Library */
|
|
||||||
namespace KE
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes CPU architecture dependent context of a thread.
|
* Initializes CPU architecture dependent context of a thread.
|
||||||
*
|
*
|
||||||
@@ -37,11 +33,11 @@ namespace KE
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KThread::InitializeThreadContext(IN PKTHREAD Thread,
|
KE::KThread::InitializeThreadContext(IN PKTHREAD Thread,
|
||||||
IN PKSYSTEM_ROUTINE SystemRoutine,
|
IN PKSYSTEM_ROUTINE SystemRoutine,
|
||||||
IN PKSTART_ROUTINE StartRoutine,
|
IN PKSTART_ROUTINE StartRoutine,
|
||||||
IN PVOID StartContext,
|
IN PVOID StartContext,
|
||||||
IN PCONTEXT ContextRecord)
|
IN PCONTEXT ContextRecord)
|
||||||
{
|
{
|
||||||
PKTHREAD_INIT_FRAME ThreadFrame;
|
PKTHREAD_INIT_FRAME ThreadFrame;
|
||||||
PFX_SAVE_FORMAT FxSaveFormat;
|
PFX_SAVE_FORMAT FxSaveFormat;
|
||||||
@@ -50,7 +46,7 @@ KThread::InitializeThreadContext(IN PKTHREAD Thread,
|
|||||||
ThreadFrame = (PKTHREAD_INIT_FRAME)((ULONG_PTR)Thread->InitialStack - sizeof(KTHREAD_INIT_FRAME));
|
ThreadFrame = (PKTHREAD_INIT_FRAME)((ULONG_PTR)Thread->InitialStack - sizeof(KTHREAD_INIT_FRAME));
|
||||||
|
|
||||||
/* Fill floating point save area with zeroes */
|
/* Fill floating point save area with zeroes */
|
||||||
RtlZeroMemory(&ThreadFrame->NpxFrame, sizeof(FX_SAVE_AREA));
|
RTL::Memory::ZeroMemory(&ThreadFrame->NpxFrame, sizeof(FX_SAVE_AREA));
|
||||||
|
|
||||||
/* Check if context provided for this thread */
|
/* Check if context provided for this thread */
|
||||||
if(ContextRecord)
|
if(ContextRecord)
|
||||||
@@ -59,7 +55,7 @@ KThread::InitializeThreadContext(IN PKTHREAD Thread,
|
|||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
|
|
||||||
/* Fill trap frame with zeroes */
|
/* Fill trap frame with zeroes */
|
||||||
RtlZeroMemory(&ThreadFrame->TrapFrame, sizeof(KTRAP_FRAME));
|
RTL::Memory::ZeroMemory(&ThreadFrame->TrapFrame, sizeof(KTRAP_FRAME));
|
||||||
|
|
||||||
/* Disable debug registers and enable context registers */
|
/* Disable debug registers and enable context registers */
|
||||||
ContextRecord->ContextFlags &= ~CONTEXT_DEBUG_REGISTERS | CONTEXT_CONTROL;
|
ContextRecord->ContextFlags &= ~CONTEXT_DEBUG_REGISTERS | CONTEXT_CONTROL;
|
||||||
@@ -118,5 +114,3 @@ KThread::InitializeThreadContext(IN PKTHREAD Thread,
|
|||||||
/* Set thread stack */
|
/* Set thread stack */
|
||||||
Thread->KernelStack = &ThreadFrame->SwitchFrame;
|
Thread->KernelStack = &ThreadFrame->SwitchFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
@@ -9,10 +9,6 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Kernel Library */
|
|
||||||
namespace KE
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the processor block for the currently executing processor.
|
* Gets the processor block for the currently executing processor.
|
||||||
*
|
*
|
||||||
@@ -22,7 +18,7 @@ namespace KE
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
PKPROCESSOR_BLOCK
|
PKPROCESSOR_BLOCK
|
||||||
Processor::GetCurrentProcessorBlock(VOID)
|
KE::Processor::GetCurrentProcessorBlock(VOID)
|
||||||
{
|
{
|
||||||
/* Get processor block from FS register */
|
/* Get processor block from FS register */
|
||||||
return (PKPROCESSOR_BLOCK)AR::CpuFunc::ReadFSDualWord(FIELD_OFFSET(KPROCESSOR_BLOCK, Self));
|
return (PKPROCESSOR_BLOCK)AR::CpuFunc::ReadFSDualWord(FIELD_OFFSET(KPROCESSOR_BLOCK, Self));
|
||||||
@@ -37,7 +33,7 @@ Processor::GetCurrentProcessorBlock(VOID)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
PKPROCESSOR_CONTROL_BLOCK
|
PKPROCESSOR_CONTROL_BLOCK
|
||||||
Processor::GetCurrentProcessorControlBlock(VOID)
|
KE::Processor::GetCurrentProcessorControlBlock(VOID)
|
||||||
{
|
{
|
||||||
return (PKPROCESSOR_CONTROL_BLOCK)AR::CpuFunc::ReadFSDualWord(FIELD_OFFSET(KPROCESSOR_BLOCK, CurrentPrcb));
|
return (PKPROCESSOR_CONTROL_BLOCK)AR::CpuFunc::ReadFSDualWord(FIELD_OFFSET(KPROCESSOR_BLOCK, CurrentPrcb));
|
||||||
}
|
}
|
||||||
@@ -51,7 +47,7 @@ Processor::GetCurrentProcessorControlBlock(VOID)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
ULONG
|
ULONG
|
||||||
Processor::GetCurrentProcessorNumber(VOID)
|
KE::Processor::GetCurrentProcessorNumber(VOID)
|
||||||
{
|
{
|
||||||
return (ULONG)AR::CpuFunc::ReadFSDualWord(FIELD_OFFSET(KPROCESSOR_BLOCK, CpuNumber));
|
return (ULONG)AR::CpuFunc::ReadFSDualWord(FIELD_OFFSET(KPROCESSOR_BLOCK, CpuNumber));
|
||||||
}
|
}
|
||||||
@@ -65,7 +61,7 @@ Processor::GetCurrentProcessorNumber(VOID)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
PKTHREAD
|
PKTHREAD
|
||||||
Processor::GetCurrentThread(VOID)
|
KE::Processor::GetCurrentThread(VOID)
|
||||||
{
|
{
|
||||||
return (PKTHREAD)AR::CpuFunc::ReadFSDualWord(FIELD_OFFSET(KPROCESSOR_BLOCK, Prcb.CurrentThread));
|
return (PKTHREAD)AR::CpuFunc::ReadFSDualWord(FIELD_OFFSET(KPROCESSOR_BLOCK, Prcb.CurrentThread));
|
||||||
}
|
}
|
||||||
@@ -82,7 +78,7 @@ Processor::GetCurrentThread(VOID)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
Processor::SaveProcessorState(OUT PKPROCESSOR_STATE CpuState)
|
KE::Processor::SaveProcessorState(OUT PKPROCESSOR_STATE CpuState)
|
||||||
{
|
{
|
||||||
/* Save CR registers */
|
/* Save CR registers */
|
||||||
CpuState->SpecialRegisters.Cr0 = AR::CpuFunc::ReadControlRegister(0);
|
CpuState->SpecialRegisters.Cr0 = AR::CpuFunc::ReadControlRegister(0);
|
||||||
@@ -105,7 +101,6 @@ Processor::SaveProcessorState(OUT PKPROCESSOR_STATE CpuState)
|
|||||||
AR::CpuFunc::StoreTaskRegister(&CpuState->SpecialRegisters.Tr);
|
AR::CpuFunc::StoreTaskRegister(&CpuState->SpecialRegisters.Tr);
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -9,13 +9,9 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Kernel Library */
|
|
||||||
namespace KE
|
|
||||||
{
|
|
||||||
|
|
||||||
XTAPI
|
XTAPI
|
||||||
PEPROCESS
|
PEPROCESS
|
||||||
KProcess::GetInitialProcess(VOID)
|
KE::KProcess::GetInitialProcess(VOID)
|
||||||
{
|
{
|
||||||
return &InitialProcess;
|
return &InitialProcess;
|
||||||
}
|
}
|
||||||
@@ -44,7 +40,7 @@ KProcess::GetInitialProcess(VOID)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KProcess::InitializeProcess(IN OUT PKPROCESS Process,
|
KE::KProcess::InitializeProcess(IN OUT PKPROCESS Process,
|
||||||
IN KPRIORITY Priority,
|
IN KPRIORITY Priority,
|
||||||
IN KAFFINITY Affinity,
|
IN KAFFINITY Affinity,
|
||||||
IN PULONG_PTR DirectoryTable,
|
IN PULONG_PTR DirectoryTable,
|
||||||
@@ -79,7 +75,6 @@ KProcess::InitializeProcess(IN OUT PKPROCESS Process,
|
|||||||
Process->State = ProcessInMemory;
|
Process->State = ProcessInMemory;
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -36,7 +36,7 @@ KeStartXtSystem(IN PKERNEL_INITIALIZATION_BLOCK Parameters)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Save the kernel initialization block */
|
/* Save the kernel initialization block */
|
||||||
BootInformation::SetInitializationBlock(Parameters);
|
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 && BootInformation::GetDebugPrint())
|
||||||
|
@@ -9,13 +9,9 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Kernel Library */
|
|
||||||
namespace KE
|
|
||||||
{
|
|
||||||
|
|
||||||
XTAPI
|
XTAPI
|
||||||
PETHREAD
|
PETHREAD
|
||||||
KThread::GetInitialThread(VOID)
|
KE::KThread::GetInitialThread(VOID)
|
||||||
{
|
{
|
||||||
return &InitialThread;
|
return &InitialThread;
|
||||||
}
|
}
|
||||||
@@ -32,7 +28,7 @@ KThread::GetInitialThread(VOID)
|
|||||||
*/
|
*/
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
VOID
|
VOID
|
||||||
KThread::ExitDispatcher(IN KRUNLEVEL OldRunLevel)
|
KE::KThread::ExitDispatcher(IN KRUNLEVEL OldRunLevel)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
|
|
||||||
@@ -73,15 +69,15 @@ KThread::ExitDispatcher(IN KRUNLEVEL OldRunLevel)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
XTSTATUS
|
XTSTATUS
|
||||||
KThread::InitializeThread(IN PKPROCESS Process,
|
KE::KThread::InitializeThread(IN PKPROCESS Process,
|
||||||
IN OUT PKTHREAD Thread,
|
IN OUT PKTHREAD Thread,
|
||||||
IN PKSYSTEM_ROUTINE SystemRoutine,
|
IN PKSYSTEM_ROUTINE SystemRoutine,
|
||||||
IN PKSTART_ROUTINE StartRoutine,
|
IN PKSTART_ROUTINE StartRoutine,
|
||||||
IN PVOID StartContext,
|
IN PVOID StartContext,
|
||||||
IN PCONTEXT Context,
|
IN PCONTEXT Context,
|
||||||
IN PVOID EnvironmentBlock,
|
IN PVOID EnvironmentBlock,
|
||||||
IN PVOID Stack,
|
IN PVOID Stack,
|
||||||
IN BOOLEAN RunThread)
|
IN BOOLEAN RunThread)
|
||||||
{
|
{
|
||||||
PKWAIT_BLOCK TimerWaitBlock;
|
PKWAIT_BLOCK TimerWaitBlock;
|
||||||
BOOLEAN Allocation;
|
BOOLEAN Allocation;
|
||||||
@@ -217,7 +213,7 @@ KThread::InitializeThread(IN PKPROCESS Process,
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KThread::StartThread(IN PKTHREAD Thread)
|
KE::KThread::StartThread(IN PKTHREAD Thread)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
}
|
}
|
||||||
@@ -246,11 +242,11 @@ KThread::StartThread(IN PKTHREAD Thread)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KThread::SuspendNop(IN PKAPC Apc,
|
KE::KThread::SuspendNop(IN PKAPC Apc,
|
||||||
IN OUT PKNORMAL_ROUTINE *NormalRoutine,
|
IN OUT PKNORMAL_ROUTINE *NormalRoutine,
|
||||||
IN OUT PVOID *NormalContext,
|
IN OUT PVOID *NormalContext,
|
||||||
IN OUT PVOID *SystemArgument1,
|
IN OUT PVOID *SystemArgument1,
|
||||||
IN OUT PVOID *SystemArgument2)
|
IN OUT PVOID *SystemArgument2)
|
||||||
{
|
{
|
||||||
/* No action here */
|
/* No action here */
|
||||||
}
|
}
|
||||||
@@ -267,7 +263,7 @@ KThread::SuspendNop(IN PKAPC Apc,
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KThread::SuspendRundown(IN PKAPC Apc)
|
KE::KThread::SuspendRundown(IN PKAPC Apc)
|
||||||
{
|
{
|
||||||
/* No action here */
|
/* No action here */
|
||||||
}
|
}
|
||||||
@@ -290,14 +286,14 @@ KThread::SuspendRundown(IN PKAPC Apc)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
KThread::SuspendThread(IN PVOID NormalContext,
|
KE::KThread::SuspendThread(IN PVOID NormalContext,
|
||||||
IN PVOID SystemArgument1,
|
IN PVOID SystemArgument1,
|
||||||
IN PVOID SystemArgument2)
|
IN PVOID SystemArgument2)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -9,10 +9,6 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Kernel Library */
|
|
||||||
namespace KE
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether handled UBSAN error should be reported.
|
* Checks whether handled UBSAN error should be reported.
|
||||||
*
|
*
|
||||||
@@ -25,7 +21,7 @@ namespace KE
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
KUbsan::CheckReport(PKUBSAN_SOURCE_LOCATION Location)
|
KE::KUbsan::CheckReport(PKUBSAN_SOURCE_LOCATION Location)
|
||||||
{
|
{
|
||||||
/* Make sure, this error should be reported */
|
/* Make sure, this error should be reported */
|
||||||
return (BOOLEAN)!ActiveFrame;
|
return (BOOLEAN)!ActiveFrame;
|
||||||
@@ -46,8 +42,8 @@ KUbsan::CheckReport(PKUBSAN_SOURCE_LOCATION Location)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
KUbsan::EnterFrame(PKUBSAN_SOURCE_LOCATION Location,
|
KE::KUbsan::EnterFrame(PKUBSAN_SOURCE_LOCATION Location,
|
||||||
PCCHAR Reason)
|
PCCHAR Reason)
|
||||||
{
|
{
|
||||||
/* Enter UBSAN frame */
|
/* Enter UBSAN frame */
|
||||||
ActiveFrame = TRUE;
|
ActiveFrame = TRUE;
|
||||||
@@ -72,8 +68,8 @@ KUbsan::EnterFrame(PKUBSAN_SOURCE_LOCATION Location,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
LONGLONG
|
LONGLONG
|
||||||
KUbsan::GetSignedValue(PKUBSAN_TYPE_DESCRIPTOR Type,
|
KE::KUbsan::GetSignedValue(PKUBSAN_TYPE_DESCRIPTOR Type,
|
||||||
PVOID Value)
|
PVOID Value)
|
||||||
{
|
{
|
||||||
ULONG BitWidth, ExtraBits;
|
ULONG BitWidth, ExtraBits;
|
||||||
ULONG_PTR LongValue;
|
ULONG_PTR LongValue;
|
||||||
@@ -106,7 +102,7 @@ KUbsan::GetSignedValue(PKUBSAN_TYPE_DESCRIPTOR Type,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
PCCHAR
|
PCCHAR
|
||||||
KUbsan::GetTypeKind(UCHAR TypeCheckKind)
|
KE::KUbsan::GetTypeKind(UCHAR TypeCheckKind)
|
||||||
{
|
{
|
||||||
/* Get type kind name */
|
/* Get type kind name */
|
||||||
switch(TypeCheckKind)
|
switch(TypeCheckKind)
|
||||||
@@ -151,8 +147,8 @@ KUbsan::GetTypeKind(UCHAR TypeCheckKind)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
ULONGLONG
|
ULONGLONG
|
||||||
KUbsan::GetUnsignedValue(PKUBSAN_TYPE_DESCRIPTOR Type,
|
KE::KUbsan::GetUnsignedValue(PKUBSAN_TYPE_DESCRIPTOR Type,
|
||||||
PVOID Value)
|
PVOID Value)
|
||||||
{
|
{
|
||||||
ULONG BitWidth;
|
ULONG BitWidth;
|
||||||
|
|
||||||
@@ -188,9 +184,9 @@ KUbsan::GetUnsignedValue(PKUBSAN_TYPE_DESCRIPTOR Type,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
KUbsan::HandleDivisionOverflow(PKUBSAN_OVERFLOW_DATA Data,
|
KE::KUbsan::HandleDivisionOverflow(PKUBSAN_OVERFLOW_DATA Data,
|
||||||
PVOID Lhs,
|
PVOID Lhs,
|
||||||
PVOID Rhs)
|
PVOID Rhs)
|
||||||
{
|
{
|
||||||
/* Check if this error was already reported */
|
/* Check if this error was already reported */
|
||||||
if(!CheckReport(&Data->Location))
|
if(!CheckReport(&Data->Location))
|
||||||
@@ -236,9 +232,9 @@ KUbsan::HandleDivisionOverflow(PKUBSAN_OVERFLOW_DATA Data,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
KUbsan::HandleFloatCastOverflow(PKUBSAN_FLOAT_CAST_OVERFLOW_DATA Data,
|
KE::KUbsan::HandleFloatCastOverflow(PKUBSAN_FLOAT_CAST_OVERFLOW_DATA Data,
|
||||||
ULONG_PTR Lhs,
|
ULONG_PTR Lhs,
|
||||||
ULONG_PTR Rhs)
|
ULONG_PTR Rhs)
|
||||||
{
|
{
|
||||||
/* Check if this error was already reported */
|
/* Check if this error was already reported */
|
||||||
if(!CheckReport(&Data->Location))
|
if(!CheckReport(&Data->Location))
|
||||||
@@ -272,8 +268,8 @@ KUbsan::HandleFloatCastOverflow(PKUBSAN_FLOAT_CAST_OVERFLOW_DATA Data,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
KUbsan::HandleFunctionTypeMismatch(PKUBSAN_FUNCTION_TYPE_MISMATCH_DATA Data,
|
KE::KUbsan::HandleFunctionTypeMismatch(PKUBSAN_FUNCTION_TYPE_MISMATCH_DATA Data,
|
||||||
ULONG_PTR Pointer)
|
ULONG_PTR Pointer)
|
||||||
{
|
{
|
||||||
/* Check if this error was already reported */
|
/* Check if this error was already reported */
|
||||||
if(!CheckReport(&Data->Location))
|
if(!CheckReport(&Data->Location))
|
||||||
@@ -311,9 +307,9 @@ KUbsan::HandleFunctionTypeMismatch(PKUBSAN_FUNCTION_TYPE_MISMATCH_DATA Data,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
KUbsan::HandleIntegerOverflow(PKUBSAN_OVERFLOW_DATA Data,
|
KE::KUbsan::HandleIntegerOverflow(PKUBSAN_OVERFLOW_DATA Data,
|
||||||
ULONG_PTR Lhs,
|
ULONG_PTR Lhs,
|
||||||
ULONG_PTR Rhs)
|
ULONG_PTR Rhs)
|
||||||
{
|
{
|
||||||
/* Check if this error was already reported */
|
/* Check if this error was already reported */
|
||||||
if(!CheckReport(&Data->Location))
|
if(!CheckReport(&Data->Location))
|
||||||
@@ -344,7 +340,7 @@ KUbsan::HandleIntegerOverflow(PKUBSAN_OVERFLOW_DATA Data,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
KUbsan::HandleInvalidBuiltin(PKUBSAN_INVALID_BUILTIN_DATA Data)
|
KE::KUbsan::HandleInvalidBuiltin(PKUBSAN_INVALID_BUILTIN_DATA Data)
|
||||||
{
|
{
|
||||||
/* Check if this error was already reported */
|
/* Check if this error was already reported */
|
||||||
if(!CheckReport(&Data->Location))
|
if(!CheckReport(&Data->Location))
|
||||||
@@ -387,8 +383,8 @@ KUbsan::HandleInvalidBuiltin(PKUBSAN_INVALID_BUILTIN_DATA Data)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
KUbsan::HandleMisalignedAccess(PKUBSAN_TYPE_MISMATCH_DATA Data,
|
KE::KUbsan::HandleMisalignedAccess(PKUBSAN_TYPE_MISMATCH_DATA Data,
|
||||||
ULONG_PTR Pointer)
|
ULONG_PTR Pointer)
|
||||||
{
|
{
|
||||||
/* Check if this error was already reported */
|
/* Check if this error was already reported */
|
||||||
if(!CheckReport(&Data->Location))
|
if(!CheckReport(&Data->Location))
|
||||||
@@ -423,8 +419,8 @@ KUbsan::HandleMisalignedAccess(PKUBSAN_TYPE_MISMATCH_DATA Data,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
KUbsan::HandleNegateOverflow(PKUBSAN_OVERFLOW_DATA Data,
|
KE::KUbsan::HandleNegateOverflow(PKUBSAN_OVERFLOW_DATA Data,
|
||||||
ULONG_PTR OldValue)
|
ULONG_PTR OldValue)
|
||||||
{
|
{
|
||||||
/* Check if this error was already reported */
|
/* Check if this error was already reported */
|
||||||
if(!CheckReport(&Data->Location))
|
if(!CheckReport(&Data->Location))
|
||||||
@@ -459,7 +455,7 @@ KUbsan::HandleNegateOverflow(PKUBSAN_OVERFLOW_DATA Data,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
KUbsan::HandleNullPointerDereference(PKUBSAN_TYPE_MISMATCH_DATA Data)
|
KE::KUbsan::HandleNullPointerDereference(PKUBSAN_TYPE_MISMATCH_DATA Data)
|
||||||
{
|
{
|
||||||
/* Check if this error was already reported */
|
/* Check if this error was already reported */
|
||||||
if(!CheckReport(&Data->Location))
|
if(!CheckReport(&Data->Location))
|
||||||
@@ -493,8 +489,8 @@ KUbsan::HandleNullPointerDereference(PKUBSAN_TYPE_MISMATCH_DATA Data)
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
KUbsan::HandleObjectSizeMismatch(PKUBSAN_TYPE_MISMATCH_DATA Data,
|
KE::KUbsan::HandleObjectSizeMismatch(PKUBSAN_TYPE_MISMATCH_DATA Data,
|
||||||
ULONG_PTR Pointer)
|
ULONG_PTR Pointer)
|
||||||
{
|
{
|
||||||
/* Check if this error was already reported */
|
/* Check if this error was already reported */
|
||||||
if(!CheckReport(&Data->Location))
|
if(!CheckReport(&Data->Location))
|
||||||
@@ -529,8 +525,8 @@ KUbsan::HandleObjectSizeMismatch(PKUBSAN_TYPE_MISMATCH_DATA Data,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
KUbsan::HandleOutOfBounds(PKUBSAN_OUT_OF_BOUNDS_DATA Data,
|
KE::KUbsan::HandleOutOfBounds(PKUBSAN_OUT_OF_BOUNDS_DATA Data,
|
||||||
ULONG_PTR Index)
|
ULONG_PTR Index)
|
||||||
{
|
{
|
||||||
/* Check if this error was already reported */
|
/* Check if this error was already reported */
|
||||||
if(!CheckReport(&Data->Location))
|
if(!CheckReport(&Data->Location))
|
||||||
@@ -567,9 +563,9 @@ KUbsan::HandleOutOfBounds(PKUBSAN_OUT_OF_BOUNDS_DATA Data,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
KUbsan::HandlePointerOverflow(PKUBSAN_OVERFLOW_DATA Data,
|
KE::KUbsan::HandlePointerOverflow(PKUBSAN_OVERFLOW_DATA Data,
|
||||||
ULONG_PTR Lhs,
|
ULONG_PTR Lhs,
|
||||||
ULONG_PTR Rhs)
|
ULONG_PTR Rhs)
|
||||||
{
|
{
|
||||||
/* Check if this error was already reported */
|
/* Check if this error was already reported */
|
||||||
if(!CheckReport(&Data->Location))
|
if(!CheckReport(&Data->Location))
|
||||||
@@ -608,9 +604,9 @@ KUbsan::HandlePointerOverflow(PKUBSAN_OVERFLOW_DATA Data,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
KUbsan::HandleShiftOutOfBounds(PKUBSAN_SHIFT_OUT_OF_BOUNDS_DATA Data,
|
KE::KUbsan::HandleShiftOutOfBounds(PKUBSAN_SHIFT_OUT_OF_BOUNDS_DATA Data,
|
||||||
ULONG_PTR Lhs,
|
ULONG_PTR Lhs,
|
||||||
ULONG_PTR Rhs)
|
ULONG_PTR Rhs)
|
||||||
{
|
{
|
||||||
ULONG LhsBitWidth;
|
ULONG LhsBitWidth;
|
||||||
|
|
||||||
@@ -671,8 +667,8 @@ KUbsan::HandleShiftOutOfBounds(PKUBSAN_SHIFT_OUT_OF_BOUNDS_DATA Data,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
KUbsan::HandleTypeMismatch(PKUBSAN_TYPE_MISMATCH_DATA Data,
|
KE::KUbsan::HandleTypeMismatch(PKUBSAN_TYPE_MISMATCH_DATA Data,
|
||||||
ULONG_PTR Pointer)
|
ULONG_PTR Pointer)
|
||||||
{
|
{
|
||||||
/* Check the type of mismatch */
|
/* Check the type of mismatch */
|
||||||
if(!Pointer)
|
if(!Pointer)
|
||||||
@@ -701,13 +697,12 @@ KUbsan::HandleTypeMismatch(PKUBSAN_TYPE_MISMATCH_DATA Data,
|
|||||||
*/
|
*/
|
||||||
XTCDECL
|
XTCDECL
|
||||||
VOID
|
VOID
|
||||||
KUbsan::LeaveFrame()
|
KE::KUbsan::LeaveFrame()
|
||||||
{
|
{
|
||||||
/* Leave UBSAN frame */
|
/* Leave UBSAN frame */
|
||||||
ActiveFrame = FALSE;
|
ActiveFrame = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -9,10 +9,6 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Kernel Library */
|
|
||||||
namespace KE
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current running level of the current processor.
|
* Gets the current running level of the current processor.
|
||||||
*
|
*
|
||||||
@@ -22,7 +18,7 @@ namespace KE
|
|||||||
*/
|
*/
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
KRUNLEVEL
|
KRUNLEVEL
|
||||||
RunLevel::GetCurrentRunLevel(VOID)
|
KE::RunLevel::GetCurrentRunLevel(VOID)
|
||||||
{
|
{
|
||||||
return HlGetRunLevel();
|
return HlGetRunLevel();
|
||||||
}
|
}
|
||||||
@@ -39,7 +35,7 @@ RunLevel::GetCurrentRunLevel(VOID)
|
|||||||
*/
|
*/
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
VOID
|
VOID
|
||||||
RunLevel::LowerRunLevel(IN KRUNLEVEL RunLevel)
|
KE::RunLevel::LowerRunLevel(IN KRUNLEVEL RunLevel)
|
||||||
{
|
{
|
||||||
KRUNLEVEL OldRunLevel;
|
KRUNLEVEL OldRunLevel;
|
||||||
|
|
||||||
@@ -66,7 +62,7 @@ RunLevel::LowerRunLevel(IN KRUNLEVEL RunLevel)
|
|||||||
*/
|
*/
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
KRUNLEVEL
|
KRUNLEVEL
|
||||||
RunLevel::RaiseRunLevel(IN KRUNLEVEL RunLevel)
|
KE::RunLevel::RaiseRunLevel(IN KRUNLEVEL RunLevel)
|
||||||
{
|
{
|
||||||
KRUNLEVEL OldRunLevel;
|
KRUNLEVEL OldRunLevel;
|
||||||
|
|
||||||
@@ -84,7 +80,6 @@ RunLevel::RaiseRunLevel(IN KRUNLEVEL RunLevel)
|
|||||||
return OldRunLevel;
|
return OldRunLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
|
||||||
|
|
||||||
/* TEMPORARY FOR COMPATIBILITY WITH C CODE */
|
/* TEMPORARY FOR COMPATIBILITY WITH C CODE */
|
||||||
|
@@ -9,9 +9,6 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
namespace KE
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a kernel semaphore object.
|
* Initializes a kernel semaphore object.
|
||||||
*
|
*
|
||||||
@@ -30,9 +27,9 @@ namespace KE
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
Semaphore::InitializeSemaphore(IN PKSEMAPHORE Semaphore,
|
KE::Semaphore::InitializeSemaphore(IN PKSEMAPHORE Semaphore,
|
||||||
IN LONG Count,
|
IN LONG Count,
|
||||||
IN LONG Limit)
|
IN LONG Limit)
|
||||||
{
|
{
|
||||||
/* Initialize semaphore header and limit */
|
/* Initialize semaphore header and limit */
|
||||||
Semaphore->Header.Type = SemaphoreObject;
|
Semaphore->Header.Type = SemaphoreObject;
|
||||||
@@ -55,7 +52,7 @@ Semaphore::InitializeSemaphore(IN PKSEMAPHORE Semaphore,
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
LONG
|
LONG
|
||||||
Semaphore::ReadState(IN PKSEMAPHORE Semaphore)
|
KE::Semaphore::ReadState(IN PKSEMAPHORE Semaphore)
|
||||||
{
|
{
|
||||||
/* Return semaphore's signal state */
|
/* Return semaphore's signal state */
|
||||||
return Semaphore->Header.SignalState;
|
return Semaphore->Header.SignalState;
|
||||||
@@ -82,13 +79,11 @@ Semaphore::ReadState(IN PKSEMAPHORE Semaphore)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
LONG
|
LONG
|
||||||
Semaphore::ReleaseSemaphore(IN PKSEMAPHORE Semaphore,
|
KE::Semaphore::ReleaseSemaphore(IN PKSEMAPHORE Semaphore,
|
||||||
IN KPRIORITY Increment,
|
IN KPRIORITY Increment,
|
||||||
IN LONG Adjustment,
|
IN LONG Adjustment,
|
||||||
IN BOOLEAN Wait)
|
IN BOOLEAN Wait)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
@@ -9,10 +9,6 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Kernel Library */
|
|
||||||
namespace KE
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acquires a specified queued spinlock.
|
* Acquires a specified queued spinlock.
|
||||||
*
|
*
|
||||||
@@ -25,7 +21,7 @@ namespace KE
|
|||||||
*/
|
*/
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
VOID
|
VOID
|
||||||
SpinLock::AcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_LEVEL LockLevel)
|
KE::SpinLock::AcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_LEVEL LockLevel)
|
||||||
{
|
{
|
||||||
/* Acquire the queued spinlock */
|
/* Acquire the queued spinlock */
|
||||||
AcquireSpinLock(KE::Processor::GetCurrentProcessorControlBlock()->LockQueue[LockLevel].Lock);
|
AcquireSpinLock(KE::Processor::GetCurrentProcessorControlBlock()->LockQueue[LockLevel].Lock);
|
||||||
@@ -43,7 +39,7 @@ SpinLock::AcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_LEVEL LockLevel)
|
|||||||
*/
|
*/
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
VOID
|
VOID
|
||||||
SpinLock::AcquireSpinLock(IN OUT PKSPIN_LOCK SpinLock)
|
KE::SpinLock::AcquireSpinLock(IN OUT PKSPIN_LOCK SpinLock)
|
||||||
{
|
{
|
||||||
/* Try to acquire the lock */
|
/* Try to acquire the lock */
|
||||||
while(RTL::Atomic::BitTestAndSet((PLONG)SpinLock, 0))
|
while(RTL::Atomic::BitTestAndSet((PLONG)SpinLock, 0))
|
||||||
@@ -72,7 +68,7 @@ SpinLock::AcquireSpinLock(IN OUT PKSPIN_LOCK SpinLock)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
SpinLock::InitializeSpinLock(IN PKSPIN_LOCK SpinLock)
|
KE::SpinLock::InitializeSpinLock(IN PKSPIN_LOCK SpinLock)
|
||||||
{
|
{
|
||||||
/* Zero initialize spinlock */
|
/* Zero initialize spinlock */
|
||||||
*SpinLock = 0;
|
*SpinLock = 0;
|
||||||
@@ -90,7 +86,7 @@ SpinLock::InitializeSpinLock(IN PKSPIN_LOCK SpinLock)
|
|||||||
*/
|
*/
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
VOID
|
VOID
|
||||||
SpinLock::ReleaseQueuedSpinLock(IN KSPIN_LOCK_QUEUE_LEVEL LockLevel)
|
KE::SpinLock::ReleaseQueuedSpinLock(IN KSPIN_LOCK_QUEUE_LEVEL LockLevel)
|
||||||
{
|
{
|
||||||
/* Clear the lock */
|
/* Clear the lock */
|
||||||
ReleaseSpinLock(KE::Processor::GetCurrentProcessorControlBlock()->LockQueue[LockLevel].Lock);
|
ReleaseSpinLock(KE::Processor::GetCurrentProcessorControlBlock()->LockQueue[LockLevel].Lock);
|
||||||
@@ -108,7 +104,7 @@ SpinLock::ReleaseQueuedSpinLock(IN KSPIN_LOCK_QUEUE_LEVEL LockLevel)
|
|||||||
*/
|
*/
|
||||||
XTFASTCALL
|
XTFASTCALL
|
||||||
VOID
|
VOID
|
||||||
SpinLock::ReleaseSpinLock(IN OUT PKSPIN_LOCK SpinLock)
|
KE::SpinLock::ReleaseSpinLock(IN OUT PKSPIN_LOCK SpinLock)
|
||||||
{
|
{
|
||||||
/* Clear the lock */
|
/* Clear the lock */
|
||||||
RTL::Atomic::And32((PLONG)SpinLock, 0);
|
RTL::Atomic::And32((PLONG)SpinLock, 0);
|
||||||
@@ -116,5 +112,3 @@ SpinLock::ReleaseSpinLock(IN OUT PKSPIN_LOCK SpinLock)
|
|||||||
/* Add an explicit memory barrier */
|
/* Add an explicit memory barrier */
|
||||||
AR::CpuFunc::ReadWriteBarrier();
|
AR::CpuFunc::ReadWriteBarrier();
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
@@ -9,10 +9,6 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
/* Kernel Library */
|
|
||||||
namespace KE
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Looks for an unacquired system resource of the specified type and acquires it.
|
* Looks for an unacquired system resource of the specified type and acquires it.
|
||||||
*
|
*
|
||||||
@@ -28,8 +24,8 @@ namespace KE
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
XTSTATUS
|
XTSTATUS
|
||||||
SystemResources::AcquireResource(IN SYSTEM_RESOURCE_TYPE ResourceType,
|
KE::SystemResources::AcquireResource(IN SYSTEM_RESOURCE_TYPE ResourceType,
|
||||||
OUT PSYSTEM_RESOURCE_HEADER *ResourceHeader)
|
OUT PSYSTEM_RESOURCE_HEADER *ResourceHeader)
|
||||||
{
|
{
|
||||||
/* Get system resource and acquire an ownership */
|
/* Get system resource and acquire an ownership */
|
||||||
return GetSystemResource(ResourceType, TRUE, ResourceHeader);
|
return GetSystemResource(ResourceType, TRUE, ResourceHeader);
|
||||||
@@ -53,9 +49,9 @@ SystemResources::AcquireResource(IN SYSTEM_RESOURCE_TYPE ResourceType,
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
XTSTATUS
|
XTSTATUS
|
||||||
SystemResources::GetSystemResource(IN SYSTEM_RESOURCE_TYPE ResourceType,
|
KE::SystemResources::GetSystemResource(IN SYSTEM_RESOURCE_TYPE ResourceType,
|
||||||
IN BOOLEAN ResourceLock,
|
IN BOOLEAN ResourceLock,
|
||||||
OUT PSYSTEM_RESOURCE_HEADER *ResourceHeader)
|
OUT PSYSTEM_RESOURCE_HEADER *ResourceHeader)
|
||||||
{
|
{
|
||||||
PSYSTEM_RESOURCE_HEADER Resource;
|
PSYSTEM_RESOURCE_HEADER Resource;
|
||||||
PLIST_ENTRY ListEntry;
|
PLIST_ENTRY ListEntry;
|
||||||
@@ -141,8 +137,8 @@ SystemResources::GetSystemResource(IN SYSTEM_RESOURCE_TYPE ResourceType,
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
XTSTATUS
|
XTSTATUS
|
||||||
SystemResources::GetResource(IN SYSTEM_RESOURCE_TYPE ResourceType,
|
KE::SystemResources::GetResource(IN SYSTEM_RESOURCE_TYPE ResourceType,
|
||||||
OUT PSYSTEM_RESOURCE_HEADER *ResourceHeader)
|
OUT PSYSTEM_RESOURCE_HEADER *ResourceHeader)
|
||||||
{
|
{
|
||||||
/* Get system resource without acquiring an ownership */
|
/* Get system resource without acquiring an ownership */
|
||||||
return GetSystemResource(ResourceType, FALSE, ResourceHeader);
|
return GetSystemResource(ResourceType, FALSE, ResourceHeader);
|
||||||
@@ -157,7 +153,7 @@ SystemResources::GetResource(IN SYSTEM_RESOURCE_TYPE ResourceType,
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
SystemResources::InitializeResources(VOID)
|
KE::SystemResources::InitializeResources(VOID)
|
||||||
{
|
{
|
||||||
PSYSTEM_RESOURCE_HEADER ResourceHeader;
|
PSYSTEM_RESOURCE_HEADER ResourceHeader;
|
||||||
PLIST_ENTRY ListEntry, NextListEntry;
|
PLIST_ENTRY ListEntry, NextListEntry;
|
||||||
@@ -221,7 +217,7 @@ SystemResources::InitializeResources(VOID)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
SystemResources::ReleaseResource(IN PSYSTEM_RESOURCE_HEADER ResourceHeader)
|
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();
|
||||||
@@ -234,5 +230,3 @@ SystemResources::ReleaseResource(IN PSYSTEM_RESOURCE_HEADER ResourceHeader)
|
|||||||
SpinLock::ReleaseSpinLock(&ResourcesLock);
|
SpinLock::ReleaseSpinLock(&ResourcesLock);
|
||||||
AR::CpuFunc::SetInterruptFlag();
|
AR::CpuFunc::SetInterruptFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
@@ -9,9 +9,6 @@
|
|||||||
#include <xtos.hh>
|
#include <xtos.hh>
|
||||||
|
|
||||||
|
|
||||||
namespace KE
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cancels the timer.
|
* Cancels the timer.
|
||||||
*
|
*
|
||||||
@@ -24,7 +21,7 @@ namespace KE
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
Timer::CancelTimer(IN PKTIMER Timer)
|
KE::Timer::CancelTimer(IN PKTIMER Timer)
|
||||||
{
|
{
|
||||||
BOOLEAN Result;
|
BOOLEAN Result;
|
||||||
KRUNLEVEL RunLevel;
|
KRUNLEVEL RunLevel;
|
||||||
@@ -64,7 +61,7 @@ Timer::CancelTimer(IN PKTIMER Timer)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
Timer::ClearTimer(IN PKTIMER Timer)
|
KE::Timer::ClearTimer(IN PKTIMER Timer)
|
||||||
{
|
{
|
||||||
/* Clear signal state */
|
/* Clear signal state */
|
||||||
Timer->Header.SignalState = 0;
|
Timer->Header.SignalState = 0;
|
||||||
@@ -82,7 +79,7 @@ Timer::ClearTimer(IN PKTIMER Timer)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
Timer::GetState(IN PKTIMER Timer)
|
KE::Timer::GetState(IN PKTIMER Timer)
|
||||||
{
|
{
|
||||||
/* Return timer state */
|
/* Return timer state */
|
||||||
return (BOOLEAN)Timer->Header.SignalState;
|
return (BOOLEAN)Timer->Header.SignalState;
|
||||||
@@ -103,8 +100,8 @@ Timer::GetState(IN PKTIMER Timer)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
Timer::InitializeTimer(OUT PKTIMER Timer,
|
KE::Timer::InitializeTimer(OUT PKTIMER Timer,
|
||||||
IN KTIMER_TYPE Type)
|
IN KTIMER_TYPE Type)
|
||||||
{
|
{
|
||||||
/* Initialize the header */
|
/* Initialize the header */
|
||||||
Timer->Header.Type = TimerNotificationObject + (UCHAR)Type;
|
Timer->Header.Type = TimerNotificationObject + (UCHAR)Type;
|
||||||
@@ -132,7 +129,7 @@ Timer::InitializeTimer(OUT PKTIMER Timer,
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
ULONGLONG
|
ULONGLONG
|
||||||
Timer::QueryTimer(IN PKTIMER Timer)
|
KE::Timer::QueryTimer(IN PKTIMER Timer)
|
||||||
{
|
{
|
||||||
KRUNLEVEL RunLevel;
|
KRUNLEVEL RunLevel;
|
||||||
ULONGLONG DueTime;
|
ULONGLONG DueTime;
|
||||||
@@ -180,10 +177,10 @@ Timer::QueryTimer(IN PKTIMER Timer)
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
Timer::SetTimer(IN PKTIMER Timer,
|
KE::Timer::SetTimer(IN PKTIMER Timer,
|
||||||
IN LARGE_INTEGER DueTime,
|
IN LARGE_INTEGER DueTime,
|
||||||
IN LONG Period,
|
IN LONG Period,
|
||||||
IN PKDPC Dpc)
|
IN PKDPC Dpc)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
}
|
}
|
||||||
@@ -200,11 +197,9 @@ Timer::SetTimer(IN PKTIMER Timer,
|
|||||||
*/
|
*/
|
||||||
XTAPI
|
XTAPI
|
||||||
VOID
|
VOID
|
||||||
Timer::RemoveTimer(IN OUT PKTIMER Timer)
|
KE::Timer::RemoveTimer(IN OUT PKTIMER Timer)
|
||||||
{
|
{
|
||||||
/* Remove the timer from the list */
|
/* Remove the timer from the list */
|
||||||
Timer->Header.Inserted = FALSE;
|
Timer->Header.Inserted = FALSE;
|
||||||
RtlRemoveEntryList(&Timer->TimerListEntry);
|
RtlRemoveEntryList(&Timer->TimerListEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace */
|
|
||||||
|
Reference in New Issue
Block a user