示例#1
0
文件: Ram.cs 项目: andy-uq/TinyOS
 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();
 }
示例#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();
 }
示例#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));
 }
示例#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));
 }
示例#5
0
 public VirtualAddress ToVirtualAddress(Page page)
 {
     return(VirtualAddressCalculator.New(0, (int)page.PageNumber));
 }