singrdk/base/Imported/Bartok/runtime/shared/GCs/CentralPT.cs

48 lines
1.7 KiB
C#
Raw Normal View History

2008-11-17 18:29:00 -05:00
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
2008-03-05 09:52:00 -05:00
/*******************************************************************/
/* WARNING */
/* This file should be identical in the Bartok and Singularity */
/* depots. Master copy resides in Bartok Depot. Changes should be */
/* made to Bartok Depot and propagated to Singularity Depot. */
/*******************************************************************/
namespace System.GCs {
using System.Runtime.CompilerServices;
using System.Threading;
internal class CentralPT: PageTable {
[PreInitRefCounts]
[NoStackLinkCheck]
new internal static unsafe void Initialize() {
SetProcessTag((uint) Thread.GetCurrentProcessIndex() << 16);
pageTableCount = new UIntPtr(1U) << (int) (31 - PageBits);
UIntPtr pageTableSize = pageTableCount * sizeof(uint);
halPageDescriptor = (uint *)
MemoryManager.AllocateMemory(pageTableSize);
UIntPtr startPage = Page((UIntPtr) halPageDescriptor);
UIntPtr pageCount = PageCount(PagePad(pageTableCount));
SetType(startPage, pageCount, PageType.System);
SetProcess(UIntPtr.Zero, pageTableCount);
}
[Inline]
internal static unsafe uint PageTableEntryImpl(UIntPtr page)
{
return *(halPageDescriptor + page);
}
[Inline]
2008-11-17 18:29:00 -05:00
internal static unsafe void SetPageTableEntryImpl(UIntPtr page,
uint value)
2008-03-05 09:52:00 -05:00
{
*(halPageDescriptor + page) = value;
}
}
}