A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[mc] mremap does not like MAP_PRIVATE|MAP_ANONYMOUS regions
[simgrid.git]
/
src
/
mc
/
mc_mmu.h
diff --git
a/src/mc/mc_mmu.h
b/src/mc/mc_mmu.h
index
8df82fa
..
dd6f2da
100644
(file)
--- a/
src/mc/mc_mmu.h
+++ b/
src/mc/mc_mmu.h
@@
-8,6
+8,7
@@
#define MC_MMU_H
#include <stdint.h>
#define MC_MMU_H
#include <stdint.h>
+#include <stdbool.h>
#include "mc_private.h"
#include "mc_private.h"
@@
-30,9
+31,9
@@
static inline size_t mc_page_count(size_t size)
* @param address Address
* @return Virtual memory page number of the given address
*/
* @param address Address
* @return Virtual memory page number of the given address
*/
-static inline size_t mc_page_number(void* address)
+static inline size_t mc_page_number(void*
base, void*
address)
{
{
- return ((uintptr_t) address) >> xbt_pagebits;
+ return ((uintptr_t) address
- (uintptr_t) base
) >> xbt_pagebits;
}
/** @brief Get the offset of an address within a memory page
}
/** @brief Get the offset of an address within a memory page
@@
-55,4
+56,9
@@
static inline void* mc_page_from_number(void* base, size_t page)
return (void*) ((char*)base + (page << xbt_pagebits));
}
return (void*) ((char*)base + (page << xbt_pagebits));
}
+static inline bool mc_same_page(void* a, void* b)
+{
+ return mc_page_number(NULL, a) == mc_page_number(NULL, b);
+}
+
#endif
#endif