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] Fix unitialized variable
[simgrid.git]
/
src
/
mc
/
mc_mmu.h
diff --git
a/src/mc/mc_mmu.h
b/src/mc/mc_mmu.h
index
f188da7
..
1fa7423
100644
(file)
--- a/
src/mc/mc_mmu.h
+++ b/
src/mc/mc_mmu.h
@@
-10,6
+10,10
@@
#include <stdint.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdbool.h>
+#include <simgrid_config.h>
+
+SG_BEGIN_DECL()
+
extern int xbt_pagesize;
extern int xbt_pagebits;
extern int xbt_pagesize;
extern int xbt_pagebits;
@@
-34,7
+38,7
@@
size_t mc_page_count(size_t size)
* @return Virtual memory page number of the given address
*/
static inline __attribute__ ((always_inline))
* @return Virtual memory page number of the given address
*/
static inline __attribute__ ((always_inline))
-size_t mc_page_number(
void* base,
void* address)
+size_t mc_page_number(
const void* base, const
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;
@@
-46,7
+50,7
@@
size_t mc_page_number(void* base, void* address)
* @return Offset within the memory page
*/
static inline __attribute__ ((always_inline))
* @return Offset within the memory page
*/
static inline __attribute__ ((always_inline))
-size_t mc_page_offset(void* address)
+size_t mc_page_offset(
const
void* address)
{
return ((uintptr_t) address) & (xbt_pagesize-1);
}
{
return ((uintptr_t) address) & (xbt_pagesize-1);
}
@@
-57,15
+61,17
@@
size_t mc_page_offset(void* address)
* @param page Index of the page
*/
static inline __attribute__ ((always_inline))
* @param page Index of the page
*/
static inline __attribute__ ((always_inline))
-void* mc_page_from_number(void* base, size_t page)
+void* mc_page_from_number(
const
void* base, size_t page)
{
return (void*) ((char*)base + (page << xbt_pagebits));
}
static inline __attribute__ ((always_inline))
{
return (void*) ((char*)base + (page << xbt_pagebits));
}
static inline __attribute__ ((always_inline))
-bool mc_same_page(
void* a,
void* b)
+bool mc_same_page(
const void* a, const
void* b)
{
return ((uintptr_t) a >> xbt_pagebits) == ((uintptr_t) b >> xbt_pagebits);
}
{
return ((uintptr_t) a >> xbt_pagebits) == ((uintptr_t) b >> xbt_pagebits);
}
+SG_END_DECL()
+
#endif
#endif