Skip to content

Commit

Permalink
Clarify things a bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
mterwoord committed Jun 8, 2016
1 parent df0f38a commit 8dde71a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions Docs/Kernel/Memory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
On initialization of the kernel, a GlobalInformationTable is setup. This contains the address of the first DataLookupEntry
2 changes: 1 addition & 1 deletion source/Cosmos.Core/DataLookupTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Cosmos.Core
{
// The DataLookupTable (DLT) basically is a linked list.
// The DataLookupTable (DLT) basically is a double linked list.
[StructLayout(LayoutKind.Explicit)]
internal unsafe struct DataLookupTable
{
Expand Down
8 changes: 4 additions & 4 deletions source/Cosmos.Core/Heap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public static uint MemAlloc(uint aLength)
DataLookupTable* xCurrentTable = GlobalSystemInfo.GlobalInformationTable->FirstDataLookupTable;
DataLookupTable* xPreviousTable = null;
uint xResult;
#region Loop through existing tables and see if we find a free spot
while (xCurrentTable != null)
{
mDebugger.SendInternal($"Scanning DataLookupTable {xCurrentTableIdx}");
Expand All @@ -86,6 +87,7 @@ public static uint MemAlloc(uint aLength)
mLastTableIndex = xCurrentTableIdx;
mLastEntryIndex = 0;
}
#endregion Loop through existing tables and see if we find a free spot

// no tables found, lets create a new one, and use that
if (xPreviousTable == null)
Expand Down Expand Up @@ -143,6 +145,7 @@ private static bool ScanDataLookupTable(uint aTableIdx, DataLookupTable* aTable,
//mDebugger.Trace($"Item.Refcount", xCurrentEntry->Refcount);
if (xCurrentEntry->Size == 0)
{
#region Found an uninitialized entry
mDebugger.SendInternal($"Found an entry at position {(uint)i}");
// found an entry now. Let's set it
if (aTable->Next != null)
Expand Down Expand Up @@ -188,11 +191,8 @@ private static bool ScanDataLookupTable(uint aTableIdx, DataLookupTable* aTable,

aHandle = (uint)xCurrentEntry;
//mDebugger.Trace($"Returning handle ", aHandle);
if (aHandle == 0x0213D185)
{
mDebugger.SendInternal("Last known one");
}
mLastEntryIndex = i;
#endregion Found an uninitialized entry
return true;
}

Expand Down

0 comments on commit 8dde71a

Please sign in to comment.