Calculate aligned boot image size from loader parameters
Some checks failed
Builds / ExectOS (amd64, debug) (push) Failing after 20s
Builds / ExectOS (i686, debug) (push) Failing after 20s
Builds / ExectOS (amd64, release) (push) Failing after 32s
Builds / ExectOS (i686, release) (push) Failing after 28s

This commit is contained in:
2026-01-29 20:08:27 +01:00
parent 7f6114f8e5
commit a7820ff568

View File

@@ -10,6 +10,39 @@
#include <xtos.hh>
/**
* Computes the size of the boot image.
*
* @param BootImageSize
* Supplies a pointer to a variable that will receive the size of the boot image in pages.
*
* @return This routine does not return any value.
*
* @since XT 1.0
*/
XTAPI
VOID
MM::Manager::ComputeBootImageSize(OUT PPFN_NUMBER BootImageSize)
{
PKERNEL_INITIALIZATION_BLOCK InitializationBlock;
PFN_NUMBER ImageSize;
ULONG PteSize;
/* Get the kernel initialization block */
InitializationBlock = KE::BootInformation::GetInitializationBlock();
/* Get the size of a PTE */
PteSize = MM::Paging::GetPteSize();
/* Calculate the size of the boot image */
ImageSize = InitializationBlock->BootImageSize * MM_PAGE_SIZE;
ImageSize = (ImageSize + ((MM_PAGE_SIZE / PteSize) * MM_PAGE_SIZE) - 1) &
~(((MM_PAGE_SIZE / PteSize) * MM_PAGE_SIZE) - 1);
/* Return number of pages used by the boot image */
*BootImageSize = ImageSize / MM_PAGE_SIZE;
}
/**
* Retrieves the amount of total available memory in the system.
*
@@ -40,6 +73,13 @@ MM::Manager::GetMemoryLayout(VOID)
return &MemoryLayout;
}
/**
* Retrieves the number of system PTEs.
*
* @return This routine returns the number of system PTEs.
*
* @since XT 1.0
*/
XTAPI
PFN_NUMBER
MM::Manager::GetNumberOfSystemPtes()