235 // From an NMT point of view we treat the first heap mapping (marked0) as committed |
235 // From an NMT point of view we treat the first heap mapping (marked0) as committed |
236 return ZAddress::marked0(offset); |
236 return ZAddress::marked0(offset); |
237 } |
237 } |
238 |
238 |
239 void ZPhysicalMemoryBacking::map(ZPhysicalMemory pmem, uintptr_t offset) const { |
239 void ZPhysicalMemoryBacking::map(ZPhysicalMemory pmem, uintptr_t offset) const { |
240 if (ZUnmapBadViews) { |
240 if (ZVerifyViews) { |
241 // Only map the good view, for debugging only |
241 // Map good view |
242 map_view(pmem, ZAddress::good(offset), AlwaysPreTouch); |
242 map_view(pmem, ZAddress::good(offset), AlwaysPreTouch); |
243 } else { |
243 } else { |
244 // Map all views |
244 // Map all views |
245 map_view(pmem, ZAddress::marked0(offset), AlwaysPreTouch); |
245 map_view(pmem, ZAddress::marked0(offset), AlwaysPreTouch); |
246 map_view(pmem, ZAddress::marked1(offset), AlwaysPreTouch); |
246 map_view(pmem, ZAddress::marked1(offset), AlwaysPreTouch); |
247 map_view(pmem, ZAddress::remapped(offset), AlwaysPreTouch); |
247 map_view(pmem, ZAddress::remapped(offset), AlwaysPreTouch); |
248 } |
248 } |
249 } |
249 } |
250 |
250 |
251 void ZPhysicalMemoryBacking::unmap(ZPhysicalMemory pmem, uintptr_t offset) const { |
251 void ZPhysicalMemoryBacking::unmap(ZPhysicalMemory pmem, uintptr_t offset) const { |
252 if (ZUnmapBadViews) { |
252 if (ZVerifyViews) { |
253 // Only map the good view, for debugging only |
253 // Unmap good view |
254 unmap_view(pmem, ZAddress::good(offset)); |
254 unmap_view(pmem, ZAddress::good(offset)); |
255 } else { |
255 } else { |
256 // Unmap all views |
256 // Unmap all views |
257 unmap_view(pmem, ZAddress::marked0(offset)); |
257 unmap_view(pmem, ZAddress::marked0(offset)); |
258 unmap_view(pmem, ZAddress::marked1(offset)); |
258 unmap_view(pmem, ZAddress::marked1(offset)); |
259 unmap_view(pmem, ZAddress::remapped(offset)); |
259 unmap_view(pmem, ZAddress::remapped(offset)); |
260 } |
260 } |
261 } |
261 } |
262 |
262 |
263 void ZPhysicalMemoryBacking::flip(ZPhysicalMemory pmem, uintptr_t offset) const { |
263 void ZPhysicalMemoryBacking::debug_map(ZPhysicalMemory pmem, uintptr_t offset) const { |
264 assert(ZUnmapBadViews, "Should be enabled"); |
264 // Map good view |
265 const uintptr_t addr_good = ZAddress::good(offset); |
265 assert(ZVerifyViews, "Should be enabled"); |
266 const uintptr_t addr_bad = ZAddress::is_marked(ZAddressGoodMask) ? ZAddress::remapped(offset) : ZAddress::marked(offset); |
266 map_view(pmem, ZAddress::good(offset), false /* pretouch */); |
267 // Map/Unmap views |
267 } |
268 map_view(pmem, addr_good, false /* pretouch */); |
268 |
269 unmap_view(pmem, addr_bad); |
269 void ZPhysicalMemoryBacking::debug_unmap(ZPhysicalMemory pmem, uintptr_t offset) const { |
270 } |
270 // Unmap good view |
|
271 assert(ZVerifyViews, "Should be enabled"); |
|
272 unmap_view(pmem, ZAddress::good(offset)); |
|
273 } |