support msync() system call. refs #382

Msync(2) of this version writes only the pages which the calling process
modified. Modifications of the other processes are not written.
This commit is contained in:
NAKAMURA Gou
2014-07-09 14:19:26 +09:00
parent 6485578a7f
commit 16af976a71
8 changed files with 356 additions and 0 deletions

View File

@ -37,6 +37,7 @@ typedef void memobj_ref_func_t(struct memobj *obj);
typedef int memobj_get_page_func_t(struct memobj *obj, off_t off, int p2align, uintptr_t *physp);
typedef uintptr_t memobj_copy_page_func_t(struct memobj *obj, uintptr_t orgphys, int p2align);
typedef int memobj_flush_page_func_t(struct memobj *obj, uintptr_t phys, size_t pgsize);
typedef int memobj_invalidate_page_func_t(struct memobj *obj, uintptr_t phys, size_t pgsize);
struct memobj_ops {
memobj_release_func_t * release;
@ -44,6 +45,7 @@ struct memobj_ops {
memobj_get_page_func_t * get_page;
memobj_copy_page_func_t * copy_page;
memobj_flush_page_func_t * flush_page;
memobj_invalidate_page_func_t * invalidate_page;
};
static inline void memobj_release(struct memobj *obj)
@ -86,6 +88,15 @@ static inline int memobj_flush_page(struct memobj *obj, uintptr_t phys, size_t p
return 0;
}
static inline int memobj_invalidate_page(struct memobj *obj, uintptr_t phys,
size_t pgsize)
{
if (obj->ops->invalidate_page) {
return (*obj->ops->invalidate_page)(obj, phys, pgsize);
}
return 0;
}
static inline void memobj_lock(struct memobj *obj)
{
ihk_mc_spinlock_lock_noirq(&obj->lock);