public void UnmapMemory(Range range)
{
using(machine.ObtainPausedState())
{
var startAddress = checked((uint)range.StartAddress);
var endAddress = checked((uint)(range.EndAddress - 1));
ValidateMemoryRangeAndThrow(startAddress, (uint)range.Size);
// when unmapping memory, two things has to be done
// first is to flag address range as no-memory (that is, I/O)
TlibUnmapRange(startAddress, endAddress);
// and second is to remove mappings that are not used anymore
currentMappings = currentMappings.
Where(x => TlibIsRangeMapped((uint)x.Segment.StartingOffset, (uint)(x.Segment.StartingOffset + x.Segment.Size)) == 1).ToList();
}
}