public void Teardown() { Marshal.FreeHGlobal(RamPointer); Memory = null; Thread = null; UnicornEmu = null; }
public void Teardown() { Marshal.FreeHGlobal(_ramPointer); _memory = null; _thread = null; _unicornEmu = null; }
public void Setup() { _currAddress = CodeBaseAddress; _ram = new MemoryBlock(Size * 2); _memory = new MemoryManager(1ul << 16); _memory.IncrementReferenceCount(); _memory.Map(CodeBaseAddress, _ram.GetPointer(0, Size * 2), Size * 2); _context = CpuContext.CreateExecutionContext(); Translator.IsReadyForTranslation.Set(); _cpuContext = new CpuContext(_memory, for64Bit: true); // Prevent registering LCQ functions in the FunctionTable to avoid initializing and populating the table, // which improves test durations. Optimizations.AllowLcqInFunctionTable = false; Optimizations.UseUnmanagedDispatchLoop = false; if (_unicornAvailable) { _unicornEmu = new UnicornAArch64(); _unicornEmu.MemoryMap(CodeBaseAddress, Size, MemoryPermission.READ | MemoryPermission.EXEC); _unicornEmu.MemoryMap(DataBaseAddress, Size, MemoryPermission.READ | MemoryPermission.WRITE); _unicornEmu.PC = CodeBaseAddress; } }
public void Teardown() { Marshal.FreeHGlobal(_ramPointer); _memory = null; _context = null; _translator = null; _unicornEmu = null; }
static CpuTest() { UnicornAvailable = UnicornAArch64.IsAvailable(); if (!UnicornAvailable) { Console.WriteLine("WARNING: Could not find unicorn"); } }
public void Teardown() { _memory.Dispose(); _context.Dispose(); _ram.Dispose(); _memory = null; _context = null; _cpuContext = null; _unicornEmu = null; }
public void Teardown() { _memory.DecrementReferenceCount(); _context.Dispose(); _ram.Dispose(); _memory = null; _context = null; _cpuContext = null; _unicornEmu = null; _usingMemory = false; }
public void Setup() { _currAddress = CodeBaseAddress; _ram = new MemoryBlock(Size * 2); _memory = new MemoryManager(_ram, 1ul << 16); _memory.Map(CodeBaseAddress, 0, Size * 2); _context = CpuContext.CreateExecutionContext(); _cpuContext = new CpuContext(_memory); if (_unicornAvailable) { _unicornEmu = new UnicornAArch64(); _unicornEmu.MemoryMap(CodeBaseAddress, Size, MemoryPermission.READ | MemoryPermission.EXEC); _unicornEmu.MemoryMap(DataBaseAddress, Size, MemoryPermission.READ | MemoryPermission.WRITE); _unicornEmu.PC = CodeBaseAddress; } }
public void Setup() { Position = 0x1000; Size = 0x1000; EntryPoint = Position; ATranslator Translator = new ATranslator(); RamPointer = Marshal.AllocHGlobal(new IntPtr(Size)); Memory = new AMemory(RamPointer); Memory.Map(Position, 0, Size); Thread = new AThread(Translator, Memory, EntryPoint); if (UnicornAvailable) { UnicornEmu = new UnicornAArch64(); UnicornEmu.MemoryMap((ulong)Position, (ulong)Size, MemoryPermission.READ | MemoryPermission.EXEC); UnicornEmu.PC = (ulong)EntryPoint; } }
public void Setup() { Position = 0x1000; _size = 0x1000; _entryPoint = Position; Translator translator = new Translator(); _ramPointer = Marshal.AllocHGlobal(new IntPtr(_size)); _memory = new MemoryManager(_ramPointer); _memory.Map(Position, 0, _size); _thread = new CpuThread(translator, _memory, _entryPoint); if (_unicornAvailable) { _unicornEmu = new UnicornAArch64(); _unicornEmu.MemoryMap((ulong)Position, (ulong)_size, MemoryPermission.READ | MemoryPermission.EXEC); _unicornEmu.PC = (ulong)_entryPoint; } }
public void Setup() { _currAddress = 0x1000; _size = 0x1000; _entryPoint = _currAddress; _ram = new MemoryBlock(_size); _memory = new MemoryManager(_ram, 1UL << 16); _memory.Map(_currAddress, 0, _size); _context = CpuContext.CreateExecutionContext(); _cpuContext = new CpuContext(_memory); if (_unicornAvailable) { _unicornEmu = new UnicornAArch64(); _unicornEmu.MemoryMap(_currAddress, _size, MemoryPermission.READ | MemoryPermission.EXEC); _unicornEmu.PC = _entryPoint; } }
public void Setup() { _currAddress = 0x1000; _size = 0x1000; _entryPoint = _currAddress; _ramPointer = Marshal.AllocHGlobal(new IntPtr(_size)); _memory = new MemoryManager(_ramPointer); _memory.Map((long)_currAddress, 0, _size); _context = new ExecutionContext(); _translator = new Translator(_memory); if (_unicornAvailable) { _unicornEmu = new UnicornAArch64(); _unicornEmu.MemoryMap(_currAddress, (ulong)_size, MemoryPermission.READ | MemoryPermission.EXEC); _unicornEmu.PC = _entryPoint; } }
public void Setup() { _currAddress = CodeBaseAddress; _ram = new MemoryBlock(Size * 2); _memory = new MemoryManager(1ul << 16); _memory.IncrementReferenceCount(); _memory.Map(CodeBaseAddress, _ram.GetPointer(0, Size * 2), Size * 2); _context = CpuContext.CreateExecutionContext(); Translator.IsReadyForTranslation.Set(); _cpuContext = new CpuContext(_memory); if (_unicornAvailable) { _unicornEmu = new UnicornAArch64(); _unicornEmu.MemoryMap(CodeBaseAddress, Size, MemoryPermission.READ | MemoryPermission.EXEC); _unicornEmu.MemoryMap(DataBaseAddress, Size, MemoryPermission.READ | MemoryPermission.WRITE); _unicornEmu.PC = CodeBaseAddress; } }
public void Add() { UnicornAArch64 unicorn = new UnicornAArch64(); unicorn.MemoryMap(0x1000, 0x4000000, MemoryPermission.READ | MemoryPermission.EXEC | MemoryPermission.WRITE); unicorn.X[1] = 1; unicorn.X[2] = 2; unicorn.PC = 0x1004; Assert.True(unicorn.X[1] == 1); Assert.True(unicorn.X[2] == 2); Assert.True(unicorn.PC == 0x1004); unicorn.DumpMemoryInformation(); unicorn.MemoryWrite32(0x1004, 0x8b020020); // ADD X0, X1, X2 unicorn.MemoryWrite32(0x1008, 0x14000000); // B . unicorn.Step(); Assert.True(unicorn.X[0] == 3); Assert.True(unicorn.PC == 0x1008); }