public Ram(byte[] ram, uint frameSize) { VirtualAddressCalculator = new VirtualAddressCalculator(frameSize); FrameSize = frameSize; _ram = ram; _pageTable = Enumerable.Range(0, (int) (ram.Length/frameSize)) .Select(x => CreateFrame(0, (uint) x)) .Select(x => new List<Frame> {x}) .ToArray(); }
public Ram(byte[] ram, uint frameSize) { VirtualAddressCalculator = new VirtualAddressCalculator(frameSize); FrameSize = frameSize; _ram = ram; _pageTable = Enumerable.Range(0, (int)(ram.Length / frameSize)) .Select(x => CreateFrame(0, (uint)x)) .Select(x => new List <Frame> { x }) .ToArray(); }
public void SetUp() { _calculator = new VirtualAddressCalculator(4096); Assert.That(_calculator.PageSize, Is.EqualTo(4096)); Assert.That(_calculator.MaxPages, Is.EqualTo(1 << 20)); Assert.That(_calculator.PageShift, Is.EqualTo(12)); Assert.That(_calculator.OffsetMask, Is.EqualTo(4095)); }
public void VirtualAddressCalculations() { var c = new VirtualAddressCalculator(16); Assert.That(c.PageSize, Is.EqualTo(16)); Assert.That(c.MaxPages, Is.EqualTo(1 << 28)); }
public VirtualAddress ToVirtualAddress(Page page) { return(VirtualAddressCalculator.New(0, (int)page.PageNumber)); }