]> AND Public Git Repository - simgrid.git/blobdiff - src/mc/sosp/Region.hpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Missing const marker
[simgrid.git] / src / mc / sosp / Region.hpp
index 3079060f1b74ab205f941d6db571e504692abfdc..0131713643b40939eaab43cce437cf4baa03cb1e 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2020. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -61,9 +61,27 @@ public:
 
   /** @brief Restore a region from a snapshot */
   void restore();
+
+  /** @brief Read memory that was snapshotted in this region
+   *
+   *  @param target  Buffer to store contiguously the value if it spans over several pages
+   *  @param addr    Process (non-snapshot) address of the data
+   *  @param size    Size of the data to read in bytes
+   *  @return Pointer where the data is located (either target buffer or original location)
+   */
+  void* read(void* target, const void* addr, std::size_t size) const;
 };
 
 } // namespace mc
 } // namespace simgrid
 
+int MC_snapshot_region_memcmp(const void* addr1, const simgrid::mc::Region* region1, const void* addr2,
+                              const simgrid::mc::Region* region2, std::size_t size);
+
+static XBT_ALWAYS_INLINE void* MC_region_read_pointer(const simgrid::mc::Region* region, const void* addr)
+{
+  void* res;
+  return *(void**)region->read(&res, addr, sizeof(void*));
+}
+
 #endif