root/include/linux/mm.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. __bad_page
  2. __bad_pagetable

   1 #ifndef _MM_H
   2 #define _MM_H
   3 
   4 #define PAGE_SIZE 4096
   5 
   6 #include <linux/fs.h>
   7 #include <linux/kernel.h>
   8 #include <linux/signal.h>
   9 
  10 /*
  11  * BAD_PAGE is the page that is used for page faults when linux
  12  * is out-of-memory. Older versions of linux just did a
  13  * do_exit(), but using this instead means there is less risk
  14  * for a process dying in kernel mode, possibly leaving a inode
  15  * unused etc..
  16  *
  17  * BAD_PAGETABLE is the accompanying page-table: it is initialized
  18  * to point to BAD_PAGE entries.
  19  */
  20 extern unsigned long inline __bad_page(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  21 {
  22         extern char empty_bad_page[PAGE_SIZE];
  23 
  24         __asm__ __volatile__("cld ; rep ; stosl"
  25                 ::"a" (0),
  26                   "D" ((long) empty_bad_page),
  27                   "c" (1024)
  28                 :"di","cx");
  29         return (unsigned long) empty_bad_page;
  30 }
  31 #define BAD_PAGE __bad_page()
  32 
  33 extern unsigned long inline __bad_pagetable(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  34 {
  35         extern char empty_bad_page_table[PAGE_SIZE];
  36 
  37         __asm__ __volatile__("cld ; rep ; stosl"
  38                 ::"a" (7+BAD_PAGE),
  39                   "D" ((long) empty_bad_page_table),
  40                   "c" (1024)
  41                 :"di","cx");
  42         return (unsigned long) empty_bad_page_table;
  43 }
  44 #define BAD_PAGETABLE __bad_pagetable()
  45 
  46 extern unsigned int swap_device;
  47 extern struct inode * swap_file;
  48 
  49 extern int nr_free_pages;
  50 
  51 extern void rw_swap_page(int rw, unsigned int nr, char * buf);
  52 
  53 #define read_swap_page(nr,buf) \
  54         rw_swap_page(READ,(nr),(buf))
  55 #define write_swap_page(nr,buf) \
  56         rw_swap_page(WRITE,(nr),(buf))
  57 
  58 /* memory.c */
  59         
  60 extern unsigned long get_free_page(int priority);
  61 extern unsigned long put_dirty_page(unsigned long page,unsigned long address);
  62 extern void free_page(unsigned long addr);
  63 extern int free_page_tables(unsigned long from,unsigned long size);
  64 extern int copy_page_tables(unsigned long from,unsigned long to,long size);
  65 extern int unmap_page_range(unsigned long from, unsigned long size);
  66 extern int remap_page_range(unsigned long from, unsigned long to, unsigned long size,
  67          int permiss);
  68 extern void write_verify(unsigned long address);
  69 
  70 extern void do_wp_page(unsigned long error_code, unsigned long address,
  71         struct task_struct *tsk, unsigned long user_esp);
  72 extern void do_no_page(unsigned long error_code, unsigned long address,
  73         struct task_struct *tsk, unsigned long user_esp);
  74 
  75 extern unsigned long mem_init(unsigned long start_mem, unsigned long end_mem);
  76 extern void show_mem(void);
  77 extern void do_page_fault(unsigned long *esp, unsigned long error_code);
  78 extern void oom(struct task_struct * task);
  79 
  80 /* swap.c */
  81 
  82 extern void swap_free(unsigned int page_nr);
  83 extern void swap_in(unsigned long *table_ptr);
  84 
  85 #define invalidate() \
  86 __asm__("movl %%eax,%%cr3"::"a" (0))
  87 
  88 extern unsigned long low_memory;
  89 extern unsigned long high_memory;
  90 extern unsigned long paging_pages;
  91 
  92 #define MAP_NR(addr) (((addr)-low_memory)>>12)
  93 #define USED 100
  94 
  95 extern unsigned char * mem_map;
  96 
  97 #define PAGE_DIRTY      0x40
  98 #define PAGE_ACCESSED   0x20
  99 #define PAGE_USER       0x04
 100 #define PAGE_RW         0x02
 101 #define PAGE_PRESENT    0x01
 102 
 103 #define GFP_BUFFER      0x00
 104 #define GFP_USER        0x01
 105 #define GFP_KERNEL      0x02
 106 
 107 #endif

/* [previous][next][first][last][top][bottom][index][help] */