/// <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; } } }
/// <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; } } }
/// <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); }); }
/// <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); }