mirror of
https://github.com/danbulant/Cosmos
synced 2026-06-11 10:41:33 +00:00
31 lines
1.1 KiB
C#
31 lines
1.1 KiB
C#
namespace Cosmos.Core
|
|
{
|
|
internal static unsafe class GlobalSystemInfo
|
|
{
|
|
private static GlobalInformationTable* mGlobalInformationTable;
|
|
public static GlobalInformationTable* GlobalInformationTable
|
|
{
|
|
get
|
|
{
|
|
if (mGlobalInformationTable == null)
|
|
{
|
|
// todo: should we align this structure somehow?
|
|
|
|
var xEndOfKernel = CPU.GetEndOfKernel();
|
|
CPU.ZeroFill(xEndOfKernel, (uint)(sizeof(GlobalInformationTable) + GetTotalDataLookupSize));
|
|
mGlobalInformationTable = (GlobalInformationTable*)xEndOfKernel;
|
|
mGlobalInformationTable->FirstDataLookupTable = (DataLookupTable*)(xEndOfKernel + sizeof(GlobalInformationTable));
|
|
}
|
|
return mGlobalInformationTable;
|
|
}
|
|
}
|
|
|
|
public static uint GetTotalDataLookupSize
|
|
{
|
|
get
|
|
{
|
|
return (uint)(sizeof(DataLookupTable) + (DataLookupTable.EntriesPerTable * sizeof(DataLookupEntry)));
|
|
}
|
|
}
|
|
}
|
|
}
|