diff --git a/xtoskrnl/includes/mm/kpool.hh b/xtoskrnl/includes/mm/kpool.hh index 58afda6..1a11bbf 100644 --- a/xtoskrnl/includes/mm/kpool.hh +++ b/xtoskrnl/includes/mm/kpool.hh @@ -17,9 +17,6 @@ namespace MM { class KernelPool { - private: - STATIC UCHAR ProcessorStructuresData[MAXIMUM_PROCESSORS][KPROCESSOR_STRUCTURES_SIZE]; - public: STATIC XTAPI XTSTATUS AllocateKernelStack(OUT PVOID *Stack, IN ULONG StackSize); diff --git a/xtoskrnl/mm/data.cc b/xtoskrnl/mm/data.cc index d686660..0895c0f 100644 --- a/xtoskrnl/mm/data.cc +++ b/xtoskrnl/mm/data.cc @@ -45,9 +45,6 @@ PVOID MM::HardwarePool::HardwareHeapStart = MM_HARDWARE_HEAP_START_ADDRESS; /* Number of used hardware allocation descriptors */ ULONG MM::HardwarePool::UsedHardwareAllocationDescriptors = 0; -/* Processor structures data (THIS IS A TEMPORARY HACK) */ -UCHAR MM::KernelPool::ProcessorStructuresData[MAXIMUM_PROCESSORS][KPROCESSOR_STRUCTURES_SIZE] = {{0}}; - /* Global structure describing the virtual memory layout of the system */ MMMEMORY_LAYOUT MM::Manager::MemoryLayout; diff --git a/xtoskrnl/mm/kpool.cc b/xtoskrnl/mm/kpool.cc index a8c8835..c6d5a13 100644 --- a/xtoskrnl/mm/kpool.cc +++ b/xtoskrnl/mm/kpool.cc @@ -113,12 +113,15 @@ MM::KernelPool::AllocateProcessorStructures(IN ULONG CpuNumber, PKPROCESSOR_BLOCK ProcessorBlock; PVOID ProcessorStructures; UINT_PTR Address; + XTSTATUS Status; - /* Not implemented yet, this is just a hack */ - UNIMPLEMENTED; - - /* Assign memory for processor structures from preallocated buffer */ - ProcessorStructures = &ProcessorStructuresData[CpuNumber - 1]; + /* Assign memory for processor structures */ + Status = MM::Allocator::AllocatePool(NonPagedPool, KPROCESSOR_STRUCTURES_SIZE, &ProcessorStructures); + if(Status != STATUS_SUCCESS) + { + /* Failed to allocate memory, return status code */ + return Status; + } /* Make sure all structures are zeroed */ RTL::Memory::ZeroMemory(ProcessorStructures, KPROCESSOR_STRUCTURES_SIZE);