X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/81e2987ceb9329c50f0ac8109504aa5c784071e2..ab1a94e98438ed2d29533aca9e613d667237c3d0:/src/smpi/smpi_memory.cpp diff --git a/src/smpi/smpi_memory.cpp b/src/smpi/smpi_memory.cpp index 34e3d8fc1e..76ed963ed8 100644 --- a/src/smpi/smpi_memory.cpp +++ b/src/smpi/smpi_memory.cpp @@ -9,21 +9,21 @@ #include #include #include + +#ifndef WIN32 #include #include #include "../xbt/memory_map.hpp" #include "private.h" +#include "private.hpp" -XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_memory, smpi, - "Memory layout support for SMPI"); - -#define TOPAGE(addr) (void *)(((unsigned long)(addr) / xbt_pagesize) * xbt_pagesize) +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_memory, smpi, "Memory layout support for SMPI"); -#define PROT_RWX (PROT_READ | PROT_WRITE | PROT_EXEC) -#define PROT_RW (PROT_READ | PROT_WRITE ) -#define PROT_RX (PROT_READ | PROT_EXEC ) +static const int PROT_RWX = (PROT_READ | PROT_WRITE | PROT_EXEC); +static const int PROT_RW = (PROT_READ | PROT_WRITE ); +XBT_ATTRIB_UNUSED static const int PROT_RX = (PROT_READ | PROT_EXEC ); void smpi_get_executable_global_size(void) { @@ -38,17 +38,14 @@ void smpi_get_executable_global_size(void) // anonymous data segment. This does not happen in practice, however. // File backed RW entry: - if (i->pathname == full_name - && (i->prot & PROT_RWX) == PROT_RW) { + if (i->pathname == full_name && (i->prot & PROT_RWX) == PROT_RW) { smpi_start_data_exe = (char*) i->start_addr; smpi_size_data_exe = i->end_addr - i->start_addr; ++i; /* Here we are making the assumption that a suitable empty region following the rw- area is the end of the data segment. It would be better to check with the size of the data segment. */ - if (i != map.end() - && i->pathname.empty() - && (i->prot & PROT_RWX) == PROT_RW + if (i != map.end() && i->pathname.empty() && (i->prot & PROT_RWX) == PROT_RW && i->start_addr == (std::uint64_t) smpi_start_data_exe + smpi_size_data_exe) { smpi_size_data_exe = i->end_addr - (std::uint64_t) smpi_start_data_exe; } @@ -57,3 +54,4 @@ void smpi_get_executable_global_size(void) } xbt_die("Did not find my data segment."); } +#endif