Esempio n. 1
0
        public void Setup()
        {
            _currAddress = CodeBaseAddress;

            _ram    = new MemoryBlock(Size * 2);
            _memory = new MemoryManager(_ram, 1ul << 16);
            _memory.IncrementReferenceCount();
            _memory.Map(CodeBaseAddress, 0, Size * 2);

            _context           = CpuContext.CreateExecutionContext();
            _context.IsAarch32 = true;
            Translator.IsReadyForTranslation.Set();

            _cpuContext = new CpuContext(_memory, for64Bit: false);

            // 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 UnicornAArch32();
                _unicornEmu.MemoryMap(CodeBaseAddress, Size, MemoryPermission.READ | MemoryPermission.EXEC);
                _unicornEmu.MemoryMap(DataBaseAddress, Size, MemoryPermission.READ | MemoryPermission.WRITE);
                _unicornEmu.PC = CodeBaseAddress;
            }
        }
Esempio n. 2
0
 public void Teardown()
 {
     Marshal.FreeHGlobal(_ramPointer);
     _memory     = null;
     _context    = null;
     _translator = null;
     _unicornEmu = null;
 }
Esempio n. 3
0
        static CpuTest32()
        {
            _unicornAvailable = UnicornAArch32.IsAvailable();

            if (!_unicornAvailable)
            {
                Console.WriteLine("WARNING: Could not find Unicorn.");
            }
        }
Esempio n. 4
0
 public void Teardown()
 {
     _memory.Dispose();
     _context.Dispose();
     _ram.Dispose();
     _memory     = null;
     _context    = null;
     _cpuContext = null;
     _unicornEmu = null;
 }
Esempio n. 5
0
        public void Teardown()
        {
            _memory.DecrementReferenceCount();
            _context.Dispose();
            _ram.Dispose();

            _memory     = null;
            _context    = null;
            _cpuContext = null;
            _unicornEmu = null;

            _usingMemory = false;
        }
Esempio n. 6
0
        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();
            _context.IsAarch32 = true;

            _cpuContext = new CpuContext(_memory);

            if (_unicornAvailable)
            {
                _unicornEmu = new UnicornAArch32();
                _unicornEmu.MemoryMap(CodeBaseAddress, Size, MemoryPermission.READ | MemoryPermission.EXEC);
                _unicornEmu.MemoryMap(DataBaseAddress, Size, MemoryPermission.READ | MemoryPermission.WRITE);
                _unicornEmu.PC = CodeBaseAddress;
            }
        }
Esempio n. 7
0
        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();
            _context.IsAarch32 = true;
            Translator.IsReadyForTranslation.Set();

            _cpuContext = new CpuContext(_memory);

            if (_unicornAvailable)
            {
                _unicornEmu = new UnicornAArch32();
                _unicornEmu.MemoryMap(CodeBaseAddress, Size, MemoryPermission.READ | MemoryPermission.EXEC);
                _unicornEmu.MemoryMap(DataBaseAddress, Size, MemoryPermission.READ | MemoryPermission.WRITE);
                _unicornEmu.PC = CodeBaseAddress;
            }
        }
Esempio n. 8
0
        public void Setup()
        {
            _currAddress = 0x1000;
            _size        = 0x1000;

            _entryPoint = _currAddress;

            _ramPointer = Marshal.AllocHGlobal(new IntPtr(_size * 2));
            _memory     = new MemoryManager(_ramPointer, addressSpaceBits: 16, useFlatPageTable: true);
            _memory.Map((long)_currAddress, 0, _size * 2);

            _context           = new ExecutionContext();
            _context.IsAarch32 = true;

            _translator = new Translator(_memory);

            if (_unicornAvailable)
            {
                _unicornEmu = new UnicornAArch32();
                _unicornEmu.MemoryMap(_currAddress, (ulong)_size, MemoryPermission.READ | MemoryPermission.EXEC);
                _unicornEmu.MemoryMap((ulong)(_currAddress + _size), (ulong)_size, MemoryPermission.READ | MemoryPermission.WRITE);
                _unicornEmu.PC = _entryPoint;
            }
        }
Esempio n. 9
0
        public void Setup()
        {
            _currAddress = 0x1000;
            _size        = 0x1000;

            _entryPoint = _currAddress;

            _ram    = new MemoryBlock(_size * 2);
            _memory = new MemoryManager(_ram, 1UL << 16);
            _memory.Map(_currAddress, 0, _size * 2);

            _context           = CpuContext.CreateExecutionContext();
            _context.IsAarch32 = true;

            _cpuContext = new CpuContext(_memory);

            if (_unicornAvailable)
            {
                _unicornEmu = new UnicornAArch32();
                _unicornEmu.MemoryMap(_currAddress, _size, MemoryPermission.READ | MemoryPermission.EXEC);
                _unicornEmu.MemoryMap(_currAddress + _size, _size, MemoryPermission.READ | MemoryPermission.WRITE);
                _unicornEmu.PC = _entryPoint;
            }
        }