mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-11-29 20:23:13 +03:00
cae5fbcf75
git-svn-id: svn://kolibrios.org@6295 a494cfbc-eb01-0410-851d-a64ba20cac60
70 lines
2.6 KiB
C
70 lines
2.6 KiB
C
#ifndef _LINUX_MM_H
|
|
#define _LINUX_MM_H
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#define VM_NORESERVE 0x00200000
|
|
|
|
#define nth_page(page,n) ((void*)(((page_to_phys(page)>>12)+(n))<<12))
|
|
|
|
#define __page_to_pfn(page) (page_to_phys(page)>>12)
|
|
|
|
/* to align the pointer to the (next) page boundary */
|
|
#define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
|
|
|
|
/*
|
|
* These are the virtual MM functions - opening of an area, closing and
|
|
* unmapping it (needed to keep files on disk up-to-date etc), pointer
|
|
* to the functions called when a no-page or a wp-page exception occurs.
|
|
*/
|
|
struct vm_operations_struct {
|
|
void (*open)(struct vm_area_struct * area);
|
|
void (*close)(struct vm_area_struct * area);
|
|
int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf);
|
|
|
|
/* notification that a previously read-only page is about to become
|
|
* writable, if an error is returned it will cause a SIGBUS */
|
|
int (*page_mkwrite)(struct vm_area_struct *vma, struct vm_fault *vmf);
|
|
|
|
/* called by access_process_vm when get_user_pages() fails, typically
|
|
* for use by special VMAs that can switch between memory and hardware
|
|
*/
|
|
int (*access)(struct vm_area_struct *vma, unsigned long addr,
|
|
void *buf, int len, int write);
|
|
#ifdef CONFIG_NUMA
|
|
/*
|
|
* set_policy() op must add a reference to any non-NULL @new mempolicy
|
|
* to hold the policy upon return. Caller should pass NULL @new to
|
|
* remove a policy and fall back to surrounding context--i.e. do not
|
|
* install a MPOL_DEFAULT policy, nor the task or system default
|
|
* mempolicy.
|
|
*/
|
|
int (*set_policy)(struct vm_area_struct *vma, struct mempolicy *new);
|
|
|
|
/*
|
|
* get_policy() op must add reference [mpol_get()] to any policy at
|
|
* (vma,addr) marked as MPOL_SHARED. The shared policy infrastructure
|
|
* in mm/mempolicy.c will do this automatically.
|
|
* get_policy() must NOT add a ref if the policy at (vma,addr) is not
|
|
* marked as MPOL_SHARED. vma policies are protected by the mmap_sem.
|
|
* If no [shared/vma] mempolicy exists at the addr, get_policy() op
|
|
* must return NULL--i.e., do not "fallback" to task or system default
|
|
* policy.
|
|
*/
|
|
struct mempolicy *(*get_policy)(struct vm_area_struct *vma,
|
|
unsigned long addr);
|
|
int (*migrate)(struct vm_area_struct *vma, const nodemask_t *from,
|
|
const nodemask_t *to, unsigned long flags);
|
|
#endif
|
|
/* called by sys_remap_file_pages() to populate non-linear mapping */
|
|
int (*remap_pages)(struct vm_area_struct *vma, unsigned long addr,
|
|
unsigned long size, pgoff_t pgoff);
|
|
};
|
|
#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK)
|
|
|
|
|
|
static inline int set_page_dirty(struct page *page)
|
|
{ return 0; };
|
|
|
|
#endif
|