Exemplo n.º 1
0
 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();
 }
Exemplo n.º 2
0
 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();
 }
Exemplo n.º 3
0
 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));
 }
Exemplo n.º 4
0
 public void VirtualAddressCalculations()
 {
     var c = new VirtualAddressCalculator(16);
     Assert.That(c.PageSize, Is.EqualTo(16));
     Assert.That(c.MaxPages, Is.EqualTo(1 << 28));
 }
Exemplo n.º 5
0
 public VirtualAddress ToVirtualAddress(Page page)
 {
     return(VirtualAddressCalculator.New(0, (int)page.PageNumber));
 }