Esempio n. 1
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();
            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;
            }
        }
Esempio n. 2
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();
            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;
            }
        }