示例#1
0
        /// <summary>
        /// Performs guest to host memory synchronization of the buffer data.
        /// </summary>
        /// <remarks>
        /// This causes the buffer data to be overwritten if a write was detected from the CPU,
        /// since the last call to this method.
        /// </remarks>
        /// <param name="address">Start address of the range to synchronize</param>
        /// <param name="size">Size in bytes of the range to synchronize</param>
        public void SynchronizeMemory(ulong address, ulong size)
        {
            if (_useGranular)
            {
                _memoryTrackingGranular.QueryModified(address, size, _modifiedDelegate, _context.SequenceNumber);
            }
            else
            {
                if (_context.SequenceNumber != _sequenceNumber && _memoryTracking.DirtyOrVolatile())
                {
                    _memoryTracking.Reprotect();

                    if (_modifiedRanges != null)
                    {
                        _modifiedRanges.ExcludeModifiedRegions(Address, Size, _loadDelegate);
                    }
                    else
                    {
                        _context.Renderer.SetBufferData(Handle, 0, _context.PhysicalMemory.GetSpan(Address, (int)Size));
                    }

                    _sequenceNumber = _context.SequenceNumber;
                }
            }
        }
示例#2
0
 /// <summary>
 /// Performs guest to host memory synchronization of the buffer data.
 /// </summary>
 /// <remarks>
 /// This causes the buffer data to be overwritten if a write was detected from the CPU,
 /// since the last call to this method.
 /// </remarks>
 /// <param name="address">Start address of the range to synchronize</param>
 /// <param name="size">Size in bytes of the range to synchronize</param>
 public void SynchronizeMemory(ulong address, ulong size)
 {
     if (_useGranular)
     {
         _memoryTrackingGranular.QueryModified(address, size, _modifiedDelegate, _context.SequenceNumber);
     }
     else
     {
         if (_memoryTracking.Dirty && _context.SequenceNumber != _sequenceNumber)
         {
             _memoryTracking.Reprotect();
             _context.Renderer.SetBufferData(Handle, 0, _context.PhysicalMemory.GetSpan(Address, (int)Size));
             _sequenceNumber = _context.SequenceNumber;
         }
     }
 }
示例#3
0
        /// <summary>
        /// Synchronizes host memory with guest memory.
        /// This causes invalidation of pool entries,
        /// if a modification of entries by the CPU is detected.
        /// </summary>
        public void SynchronizeMemory()
        {
            _memoryTracking.QueryModified((ulong mAddress, ulong mSize) =>
            {
                if (mAddress < Address)
                {
                    mAddress = Address;
                }

                ulong maxSize = Address + Size - mAddress;

                if (mSize > maxSize)
                {
                    mSize = maxSize;
                }

                InvalidateRangeImpl(mAddress, mSize);
            });
        }
示例#4
0
 /// <summary>
 /// Synchronizes host memory with guest memory.
 /// This causes invalidation of pool entries,
 /// if a modification of entries by the CPU is detected.
 /// </summary>
 public void SynchronizeMemory()
 {
     _memoryTracking.QueryModified(_modifiedDelegate);
 }