mirror of
https://github.com/danbulant/Cosmos
synced 2026-06-13 19:52:25 +00:00
Begin with memory work.
This commit is contained in:
parent
517b373ded
commit
0bd99c1cfd
5 changed files with 58 additions and 0 deletions
|
|
@ -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.
|
||||
|
|
|
|||
9
source/Cosmos.Core/DataLookupEntry.cs
Normal file
9
source/Cosmos.Core/DataLookupEntry.cs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
namespace Cosmos.Core
|
||||
{
|
||||
internal unsafe struct DataLookupEntry
|
||||
{
|
||||
public void* DataBlock;
|
||||
public uint Size;
|
||||
public uint Refcount;
|
||||
}
|
||||
}
|
||||
13
source/Cosmos.Core/DataLookupTable.cs
Normal file
13
source/Cosmos.Core/DataLookupTable.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
7
source/Cosmos.Core/GlobalInformationTable.cs
Normal file
7
source/Cosmos.Core/GlobalInformationTable.cs
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
namespace Cosmos.Core
|
||||
{
|
||||
internal unsafe struct GlobalInformationTable
|
||||
{
|
||||
public DataLookupTable* FirstDataLookupTable;
|
||||
}
|
||||
}
|
||||
22
source/Cosmos.Core/GlobalSystemInfo.cs
Normal file
22
source/Cosmos.Core/GlobalSystemInfo.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue