-/** @brief Read memory from a snapshot region
- *
- * @param addr Process (non-snapshot) address of the data
- * @param region Snapshot memory region where the data is located
- * @param target Buffer to store the value
- * @param size Size of the data to read in bytes
- * @return Pointer where the data is located (target buffer of original location)
- */
-static XBT_ALWAYS_INLINE const void* MC_region_read(simgrid::mc::Region* region, void* target, const void* addr,
- std::size_t size)
-{
- xbt_assert(region);
-
- xbt_assert(region->contain(simgrid::mc::remote(addr)), "Trying to read out of the region boundary.");
-
- // Last byte of the region:
- void* end = (char*)addr + size - 1;
- if (simgrid::mc::mmu::same_chunk((std::uintptr_t)addr, (std::uintptr_t)end)) {
- // The memory is contained in a single page:
- return mc_translate_address_region((uintptr_t)addr, region);
- }
- // Otherwise, the memory spans several pages:
- return MC_region_read_fragmented(region, target, addr, size);
-}
-
-static XBT_ALWAYS_INLINE void* MC_region_read_pointer(simgrid::mc::Region* region, const void* addr)
-{
- void* res;
- return *(void**)MC_region_read(region, &res, addr, sizeof(void*));
-}
-