-
-/* FIXME: Horrible hack! because the mmalloc library doesn't provide yet of */
-/* an API to query about the status of a heap, we simply call mmstats and */
-/* because I now how does structure looks like, then I redefine it here */
-
-struct mstats
- {
- size_t bytes_total; /* Total size of the heap. */
- size_t chunks_used; /* Chunks allocated by the user. */
- size_t bytes_used; /* Byte total of user-allocated chunks. */
- size_t chunks_free; /* Chunks in the free list. */
- size_t bytes_free; /* Byte total of chunks in the free list. */
- };
-
-extern struct mstats mmstats(void *);
-
-/* Copy std_heap to "to_heap" allocating the required space for it */
-size_t MC_save_heap(void **to_heap)
-{
- size_t heap_size = mmstats(std_heap).bytes_total;
-
- *to_heap = calloc(heap_size, 1);
-
- xbt_assert(*to_heap != NULL);
-
- memcpy(*to_heap, std_heap, heap_size);
-
- return heap_size;
-}
-
-/* Copy the data segment of libsimgrid to "data" allocating the space for it */
-size_t MC_save_dataseg(void **data)
-{
- *data = calloc(libsimgrid_data_size, 1);
- memcpy(*data, libsimgrid_data_addr_start, libsimgrid_data_size);
- return libsimgrid_data_size;
-}
-
-/* Restore std_heap from "src_heap" */
-void MC_restore_heap(void *src_heap, size_t size)
-{
- memcpy(std_heap, src_heap, size);
-}
-
-/* Restore the data segment of libsimgrid from "src_data" */
-void MC_restore_dataseg(void *src_data, size_t size)
-{
- memcpy(libsimgrid_data_addr_start, src_data, size);
-}
-
-
-
-
-