-// ***** Region management:
-
-/** @brief Take a per-page snapshot of a region
- *
- * @param data The start of the region (must be at the beginning of a page)
- * @param pag_count Number of pages of the region
- * @return Snapshot page numbers of this new snapshot
- */
-size_t* mc_take_page_snapshot_region(mc_process_t process,
- void* data, size_t page_count)
-{
- size_t* pagenos = (size_t*) malloc(page_count * sizeof(size_t));
-
- const bool is_self = process->is_self();
-
- void* temp = NULL;
- if (!is_self)
- temp = malloc(xbt_pagesize);
-
- for (size_t i=0; i!=page_count; ++i) {
-
- // Otherwise, we need to store the page the hard way
- // (by reading its content):
- void* page = (char*) data + (i << xbt_pagebits);
- xbt_assert(mc_page_offset(page)==0, "Not at the beginning of a page");
- void* page_data;
- if (is_self) {
- page_data = page;
- } else {
- /* Adding another copy (and a syscall) will probably slow things a lot.
- TODO, optimize this somehow (at least by grouping the syscalls)
- if needed. Either:
- - reduce the number of syscalls;
- - let the application snapshot itself;
- - move the segments in shared memory (this will break `fork` however).
- */
- page_data = temp;
- process->read_bytes(
- temp, xbt_pagesize, remote(page),
- simgrid::mc::ProcessIndexDisabled);
- }
- pagenos[i] = mc_model_checker->page_store().store_page(page_data);
-
- }
-
- free(temp);
- return pagenos;
-}
-
-void mc_free_page_snapshot_region(size_t* pagenos, size_t page_count)
-{
- for (size_t i=0; i!=page_count; ++i) {
- mc_model_checker->page_store().unref_page(pagenos[i]);
- }
-}
-