summaryrefslogtreecommitdiffstats
path: root/include/linux/mm.h
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1995-11-14 08:00:00 +0000
committer <ralf@linux-mips.org>1995-11-14 08:00:00 +0000
commite7c2a72e2680827d6a733931273a93461c0d8d1b (patch)
treec9abeda78ef7504062bb2e816bcf3e3c9d680112 /include/linux/mm.h
parentec6044459060a8c9ce7f64405c465d141898548c (diff)
Import of Linux/MIPS 1.3.0
Diffstat (limited to 'include/linux/mm.h')
-rw-r--r--include/linux/mm.h141
1 files changed, 91 insertions, 50 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index d1f1b3a98..c59651f38 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1,13 +1,17 @@
#ifndef _LINUX_MM_H
#define _LINUX_MM_H
-#include <asm/page.h>
-
#include <linux/sched.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/string.h>
+extern unsigned long high_memory;
+
+#include <asm/page.h>
+
+#ifdef __KERNEL__
+
#define VERIFY_READ 0
#define VERIFY_WRITE 1
@@ -32,10 +36,20 @@ struct vm_area_struct {
struct task_struct * vm_task; /* VM area parameters */
unsigned long vm_start;
unsigned long vm_end;
- unsigned short vm_page_prot;
+ pgprot_t vm_page_prot;
unsigned short vm_flags;
- struct vm_area_struct * vm_next; /* linked list */
- struct vm_area_struct * vm_share; /* linked list */
+/* AVL tree of VM areas per task, sorted by address */
+ short vm_avl_height;
+ struct vm_area_struct * vm_avl_left;
+ struct vm_area_struct * vm_avl_right;
+/* linked list of VM areas per task, sorted by address */
+ struct vm_area_struct * vm_next;
+/* for areas with inode, the circular list inode->i_mmap */
+/* for shm areas, the circular list of attaches */
+/* otherwise unused */
+ struct vm_area_struct * vm_next_share;
+ struct vm_area_struct * vm_prev_share;
+/* more */
struct vm_operations_struct * vm_ops;
unsigned long vm_offset;
struct inode * vm_inode;
@@ -65,31 +79,33 @@ struct vm_area_struct {
#define VM_STACK_FLAGS 0x0177
/*
- * These are the virtual MM functions - opening of an area, closing 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, and the function which decides on sharing
- * of pages between different processes.
+ * mapping from the currently active vm_flags protection bits (the
+ * low four bits) to a page protection mask..
+ */
+extern pgprot_t protection_map[16];
+
+
+/*
+ * 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);
+ void (*unmap)(struct vm_area_struct *area, unsigned long, size_t);
+ void (*protect)(struct vm_area_struct *area, unsigned long, size_t, unsigned int newprot);
+ void (*sync)(struct vm_area_struct *area, unsigned long, size_t, unsigned int flags);
+ void (*advise)(struct vm_area_struct *area, unsigned long, size_t, unsigned int advise);
unsigned long (*nopage)(struct vm_area_struct * area, unsigned long address,
- unsigned long page, int error_code);
+ unsigned long page, int write_access);
unsigned long (*wppage)(struct vm_area_struct * area, unsigned long address,
unsigned long page);
- int (*share)(struct vm_area_struct * from, struct vm_area_struct * to, unsigned long address);
- int (*unmap)(struct vm_area_struct *area, unsigned long, size_t);
- void (*swapout)(struct vm_area_struct *, unsigned long *);
- unsigned long (*swapin)(struct vm_area_struct *, unsigned long);
+ void (*swapout)(struct vm_area_struct *, unsigned long, pte_t *);
+ pte_t (*swapin)(struct vm_area_struct *, unsigned long, unsigned long);
};
-extern unsigned long __bad_page(void);
-extern unsigned long __bad_pagetable(void);
-extern unsigned long __zero_page(void);
-
-#define BAD_PAGETABLE __bad_pagetable()
-#define BAD_PAGE __bad_page()
-#define ZERO_PAGE __zero_page()
+extern mem_map_t * mem_map;
/* planning stage.. */
#define P_DIRTY 0x0001
@@ -110,8 +126,6 @@ struct page_info {
};
/* end of planning stage */
-#ifdef __KERNEL__
-
/*
* Free area management
*/
@@ -137,14 +151,14 @@ extern unsigned char * free_area_map[NR_MEM_LISTS];
*/
#define __get_free_page(priority) __get_free_pages((priority),0)
extern unsigned long __get_free_pages(int priority, unsigned long gfporder);
+extern unsigned long __get_dma_pages(int priority, unsigned long gfporder);
extern inline unsigned long get_free_page(int priority)
{
unsigned long page;
page = __get_free_page(priority);
if (page)
- memset((void *)page, 0, 4096);
-
+ memset((void *) page, 0, PAGE_SIZE);
return page;
}
@@ -162,17 +176,17 @@ extern void clear_page_tables(struct task_struct * tsk);
extern int copy_page_tables(struct task_struct * to);
extern int clone_page_tables(struct task_struct * to);
extern int unmap_page_range(unsigned long from, unsigned long size);
-extern int remap_page_range(unsigned long from, unsigned long to, unsigned long size, int mask);
-extern int zeromap_page_range(unsigned long from, unsigned long size, int mask);
+extern int remap_page_range(unsigned long from, unsigned long to, unsigned long size, pgprot_t prot);
+extern int zeromap_page_range(unsigned long from, unsigned long size, pgprot_t prot);
-extern void do_wp_page(struct vm_area_struct * vma, unsigned long address,
- unsigned long error_code);
-extern void do_no_page(struct vm_area_struct * vma, unsigned long address,
- unsigned long error_code);
+extern void handle_mm_fault(struct vm_area_struct *vma, unsigned long address, int write_access);
+extern void do_wp_page(struct vm_area_struct * vma, unsigned long address, int write_access);
+extern void do_no_page(struct vm_area_struct * vma, unsigned long address, int write_access);
extern unsigned long paging_init(unsigned long start_mem, unsigned long end_mem);
+extern void mem_init(unsigned long start_mem, unsigned long end_mem);
extern void show_mem(void);
-extern void oom(struct task_struct * task);
+extern void oom(struct task_struct * tsk);
extern void si_meminfo(struct sysinfo * val);
/* vmalloc.c */
@@ -183,32 +197,31 @@ extern int vread(char *buf, char *addr, int count);
/* swap.c */
-extern void swap_free(unsigned long page_nr);
-extern unsigned long swap_duplicate(unsigned long page_nr);
-extern unsigned long swap_in(unsigned long entry);
+extern void swap_free(unsigned long);
+extern void swap_duplicate(unsigned long);
+extern void swap_in(struct vm_area_struct *, pte_t *, unsigned long id, int write_access);
+
extern void si_swapinfo(struct sysinfo * val);
extern void rw_swap_page(int rw, unsigned long nr, char * buf);
/* mmap.c */
-extern int do_mmap(struct file * file, unsigned long addr, unsigned long len,
+extern unsigned long do_mmap(struct file * file, unsigned long addr, unsigned long len,
unsigned long prot, unsigned long flags, unsigned long off);
-extern void merge_segments(struct vm_area_struct *);
+extern struct vm_area_struct * find_vma (struct task_struct *, unsigned long);
+extern struct vm_area_struct * find_vma_intersection (struct task_struct *, unsigned long, unsigned long);
+extern void merge_segments(struct task_struct *, unsigned long, unsigned long);
extern void insert_vm_struct(struct task_struct *, struct vm_area_struct *);
+extern void remove_shared_vm_struct(struct vm_area_struct *);
+extern void build_mmap_avl(struct task_struct *);
+extern void exit_mmap(struct task_struct *);
extern int do_munmap(unsigned long, size_t);
-extern unsigned long get_unmapped_area(unsigned long);
+extern unsigned long get_unmapped_area(unsigned long, unsigned long);
#define read_swap_page(nr,buf) \
rw_swap_page(READ,(nr),(buf))
#define write_swap_page(nr,buf) \
rw_swap_page(WRITE,(nr),(buf))
-extern unsigned long high_memory;
-
-#define MAP_NR(addr) ((addr) >> PAGE_SHIFT)
-#define MAP_PAGE_RESERVED (1<<15)
-
-extern unsigned short * mem_map;
-
#define GFP_BUFFER 0x00
#define GFP_ATOMIC 0x01
#define GFP_USER 0x02
@@ -247,13 +260,41 @@ extern unsigned long swap_cache_find_success;
extern inline unsigned long in_swap_cache(unsigned long addr)
{
- return swap_cache[addr >> PAGE_SHIFT];
+ return swap_cache[MAP_NR(addr)];
}
-/*
- * Include machine dependend stuff
- */
-#include <asm/mm.h>
+extern inline long find_in_swap_cache (unsigned long addr)
+{
+ unsigned long entry;
+
+#ifdef SWAP_CACHE_INFO
+ swap_cache_find_total++;
+#endif
+ entry = (unsigned long) xchg_ptr(swap_cache + MAP_NR(addr), NULL);
+#ifdef SWAP_CACHE_INFO
+ if (entry)
+ swap_cache_find_success++;
+#endif
+ return entry;
+}
+
+extern inline int delete_from_swap_cache(unsigned long addr)
+{
+ unsigned long entry;
+
+#ifdef SWAP_CACHE_INFO
+ swap_cache_del_total++;
+#endif
+ entry= (unsigned long) xchg_ptr(swap_cache + MAP_NR(addr), NULL);
+ if (entry) {
+#ifdef SWAP_CACHE_INFO
+ swap_cache_del_success++;
+#endif
+ swap_free(entry);
+ return 1;
+ }
+ return 0;
+}
#endif /* __KERNEL__ */