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] Add mc_snapshot_read_pointer()
[simgrid.git]
/
src
/
mc
/
mc_mmu.h
diff --git
a/src/mc/mc_mmu.h
b/src/mc/mc_mmu.h
index
0fe1715
..
f188da7
100644
(file)
--- a/
src/mc/mc_mmu.h
+++ b/
src/mc/mc_mmu.h
@@
-10,14
+10,16
@@
#include <stdint.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdbool.h>
-#include "mc_private.h"
+extern int xbt_pagesize;
+extern int xbt_pagebits;
/** @brief How many memory pages are necessary to store size bytes?
*
* @param size Byte size
* @return Number of memory pages
*/
/** @brief How many memory pages are necessary to store size bytes?
*
* @param size Byte size
* @return Number of memory pages
*/
-static inline size_t mc_page_count(size_t size)
+static inline __attribute__ ((always_inline))
+size_t mc_page_count(size_t size)
{
size_t page_count = size >> xbt_pagebits;
if (size & (xbt_pagesize-1)) {
{
size_t page_count = size >> xbt_pagebits;
if (size & (xbt_pagesize-1)) {
@@
-31,7
+33,8
@@
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* base, void* address)
+static inline __attribute__ ((always_inline))
+size_t mc_page_number(void* base, void* address)
{
xbt_assert(address>=base, "The address is not in the range");
return ((uintptr_t) address - (uintptr_t) base) >> xbt_pagebits;
{
xbt_assert(address>=base, "The address is not in the range");
return ((uintptr_t) address - (uintptr_t) base) >> xbt_pagebits;
@@
-42,7
+45,8
@@
static inline size_t mc_page_number(void* base, void* address)
* @param address Address
* @return Offset within the memory page
*/
* @param address Address
* @return Offset within the memory page
*/
-static inline size_t mc_page_offset(void* address)
+static inline __attribute__ ((always_inline))
+size_t mc_page_offset(void* address)
{
return ((uintptr_t) address) & (xbt_pagesize-1);
}
{
return ((uintptr_t) address) & (xbt_pagesize-1);
}
@@
-52,14
+56,16
@@
static inline size_t mc_page_offset(void* address)
* @param base Address of the first page
* @param page Index of the page
*/
* @param base Address of the first page
* @param page Index of the page
*/
-static inline void* mc_page_from_number(void* base, size_t page)
+static inline __attribute__ ((always_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)
+static inline __attribute__ ((always_inline))
+bool mc_same_page(void* a, void* b)
{
{
- return
mc_page_number(NULL, a) == mc_page_number(NULL, b
);
+ return
((uintptr_t) a >> xbt_pagebits) == ((uintptr_t) b >> xbt_pagebits
);
}
#endif
}
#endif