Cosmos/source/Cosmos.Core/GlobalSystemInfo.cs
Matthijs ter Woord e91b500738 .
2015-07-29 18:58:42 -04:00

38 lines
1.5 KiB
C#

using Cosmos.Debug.Kernel;
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) + TotalDataLookupTableSize) * 4);
mGlobalInformationTable = (GlobalInformationTable*)xEndOfKernel;
uint xFirstDataLookupLocation = (uint)(xEndOfKernel + sizeof(GlobalInformationTable));
Debugger.DoSend("Setting FirstDataLookupTable to ");
Debugger.DoSendNumber(xFirstDataLookupLocation);
mGlobalInformationTable->FirstDataLookupTable = (DataLookupTable*)xFirstDataLookupLocation;
Debugger.DoSend("FirstDataLookupTable was set to ");
Debugger.DoSendNumber((uint)mGlobalInformationTable->FirstDataLookupTable);
}
return mGlobalInformationTable;
}
}
public static uint TotalDataLookupTableSize
{
get
{
return (uint)(sizeof(DataLookupTable) + (DataLookupTable.EntriesPerTable * sizeof(DataLookupEntry)));
}
}
}
}