Begin with memory work.

This commit is contained in:
Matthijs ter Woord 2015-07-25 11:54:11 -04:00
parent 517b373ded
commit 0bd99c1cfd
5 changed files with 58 additions and 0 deletions

View file

@ -77,6 +77,10 @@
<ItemGroup>
<Compile Include="BaseIOGroups.cs" />
<Compile Include="Bootstrap.cs" />
<Compile Include="DataLookupEntry.cs" />
<Compile Include="DataLookupTable.cs" />
<Compile Include="GlobalInformationTable.cs" />
<Compile Include="GlobalSystemInfo.cs" />
<Compile Include="HMI.cs" />
<Compile Include="IOGroup\COM.cs" />
<Compile Include="IOGroup\Network\AMDPCNetIIIOGroup.cs" />
@ -126,6 +130,9 @@
<Content Include="MemoryBlock.html" />
<Content Include="PIC.html" />
</ItemGroup>
<ItemGroup>
<Folder Include="MemoryManagers\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View file

@ -0,0 +1,9 @@
namespace Cosmos.Core
{
internal unsafe struct DataLookupEntry
{
public void* DataBlock;
public uint Size;
public uint Refcount;
}
}

View file

@ -0,0 +1,13 @@
namespace Cosmos.Core
{
// The DataLookupTable (DLT) basically is a linked list.
internal unsafe struct DataLookupTable
{
public const int EntriesPerTable = 170;
public DataLookupTable* Previous;
public DataLookupTable* Next;
public DataLookupEntry* Entries;
}
}

View file

@ -0,0 +1,7 @@
namespace Cosmos.Core
{
internal unsafe struct GlobalInformationTable
{
public DataLookupTable* FirstDataLookupTable;
}
}

View file

@ -0,0 +1,22 @@
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();
mGlobalInformationTable = (GlobalInformationTable*)xEndOfKernel;
mGlobalInformationTable->FirstDataLookupTable = (DataLookupTable*)(xEndOfKernel + sizeof(GlobalInformationTable));
}
return mGlobalInformationTable;
}
}
}
}