protected override void Cleanup() { if (managedMemory != null) { managedMemory.Dispose(); managedMemory = null; } }
public byte[] Should_the_origin_memory_contain_the_correct_data_when_using_the_INDEXER_method(int startOffset, int value) { using (var managedMemory = new ManagedMemory(10)) { using (var subset = new MemorySubset(managedMemory, 2, 4, false)) { subset[startOffset] = (byte)value; return(managedMemory.ToArray()); } } }
public byte[] Should_the_memory_be_set_to_the_correct_values(int channel, UInt16 value) { using (var memory = new ManagedMemory(COMMAND_SIZE)) { var device = new Tlc59711Device(memory); device.Channels.Set(channel, value); return(memory .Skip(4 + (channel * PWM_WORDSIZE)) .Take(2) .ToArray()); } }
public string Should_the_resulting_memory_be_correct(string description, Action <ITlc59711Settings> action) { using (var memory = new ManagedMemory(COMMAND_SIZE)) { var device = new Tlc59711Device(memory); action(device); Console.WriteLine("Running action on: {0}", description); return(memory .Take(4) .ToBitString()); } }
public void Should_the_origin_memory_contain_the_correct_data_when_using_the_INDEXER_method_exception(int startOffset, int value) { Assert.Throws <ArgumentOutOfRangeException>(() => { using (var managedMemory = new ManagedMemory(10)) { using (var subset = new MemorySubset(managedMemory, 2, 4, false)) { subset[startOffset] = (byte)value; } } }); }
public void Should_the_origin_memory_contain_the_correct_data_when_using_the_INDEXER_method(int startOffset, int value, byte[] expectedResult) { using (var managedMemory = new ManagedMemory(10)) { using (var subset = new MemorySubset(managedMemory, 2, 4, false)) { if (expectedResult == null) { Assert.Throws <ArgumentOutOfRangeException>(delegate { var result = subset[startOffset] = (byte)value; }); } else { subset[startOffset] = (byte)value; var memo = managedMemory.ToArray(); for (var i = 0; i < expectedResult.Length; i++) { Assert.AreEqual(expectedResult[i], memo[i]); } } } } }
protected override void EstablishContext() { managedMemory = new ManagedMemory(10); subset = new MemorySubset(managedMemory, 2, 4, true); }
protected override void EstablishContext() { managedMemory = new ManagedMemory(10); }
public byte[] Should_the_origin_memory_contain_the_correct_data_when_using_the_INDEXER_method(int startOffset, int value) { using (var managedMemory = new ManagedMemory(10)) { using (var subset = new MemorySubset(managedMemory, 2, 4, false)) { subset[startOffset] = (byte) value; return managedMemory.ToArray(); } } }
public byte[] Should_the_memory_be_set_to_the_correct_values(int channel, UInt16 value) { using (var memory = new ManagedMemory(COMMAND_SIZE)) { var device = new Tlc59711Device(memory); device.Channels.Set(channel, value); return memory .Skip(4 + (channel * PWM_WORDSIZE)) .Take(2) .ToArray(); } }
public string Should_the_resulting_memory_be_correct(string description, Action<ITlc59711Settings> action) { using (var memory = new ManagedMemory(COMMAND_SIZE)) { var device = new Tlc59711Device(memory); action(device); Debug.Print("Running action on: {0}", description); return memory .Take(4) .ToBitString(); } }
public static unsafe void Main() { try { ManagedMemory.InitializeGCMemory(); // Initialize static fields StartUp.InitializeAssembly(); KMath.Init(); BootInfo.SetupStage1(); // Write protect all possible pages and disallow execution on all non-code pages. Memory.InitialKernelProtect(); ApiContext.Current = new ApiHost(); Assert.Setup(AssertError); // Setup some pseudo devices DeviceManager.InitStage1(); //Setup Output and Debug devices DeviceManager.InitStage2(); // Write first output KernelMessage.WriteLine("<KERNEL:CONSOLE:BEGIN>"); PerformanceCounter.Setup(BootInfo.Header->KernelBootStartCycles); KernelMessage.WriteLine("Starting Abanu Kernel..."); KernelMessage.WriteLine("KConfig.UseKernelMemoryProtection: {0}", KConfig.UseKernelMemoryProtection); KernelMessage.WriteLine("KConfig.UsePAE: {0}", KConfig.UsePAE); KernelMessage.WriteLine("Apply PageTableType: {0}", (uint)BootInfo.Header->PageTableType); KernelMessage.WriteLine("GCInitialMemory: {0:X8}-{1:X8}", Address.GCInitialMemory, Address.GCInitialMemory + Address.GCInitialMemorySize - 1); CodeTests.Run(); // Detect environment (Memory Maps, Video Mode, etc.) BootInfo.SetupStage2(); KernelMemoryMapManager.Setup(); //KernelMemoryMapManager.Allocate(0x1000 * 1000, BootInfoMemoryType.PageDirectory); // Read own ELF-Headers and Sections KernelElf.Setup(); // Initialize the embedded code (actually only a little proof of concept code) NativeCalls.Setup(); PhysicalPageManager.Setup(); NonThreadTests.TestPhysicalPageAllocation(); VirtualPageManager.Setup(); // Setup final Memory Allocator Memory.Setup(); // Now Memory Sub System is working. At this point it's valid // to allocate memory dynamically // If we have a Framebuffer, lets try to initialize it. DeviceManager.InitFrameBuffer(); // Setup Programmable Interrupt Table PIC.Setup(); // Setup Interrupt Descriptor Table // Important Note: IDT depends on GDT. Never setup IDT before GDT. IDTManager.Setup(); InitializeUserMode(); SysCallManager.Setup(); KernelMessage.WriteLine("Initialize Runtime Metadata"); StartUp.InitializeRuntimeMetadata(); KernelMessage.WriteLine("Performing some Non-Thread Tests"); NonThreadTests.RunTests(); } catch (Exception ex) { Panic.Error(ex.Message); } if (KConfig.SingleThread) { StartupStage2(); } else { ProcessManager.Setup(StartupStage2); } }