source: sbliveos2/trunk/include/linux/mm.h@ 151

Last change on this file since 151 was 142, checked in by ktk, 25 years ago

Import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.9 KB
Line 
1/* $Id: mm.h 142 2000-04-23 14:55:46Z ktk $ */
2
3#ifndef _LINUX_MM_H
4#define _LINUX_MM_H
5
6#include <linux/sched.h>
7#include <linux/errno.h>
8#include <asm/page.h>
9
10/*
11 * GFP bitmasks..
12 */
13#define __GFP_WAIT 0x01
14#define __GFP_LOW 0x02
15#define __GFP_MED 0x04
16#define __GFP_HIGH 0x08
17#define __GFP_IO 0x10
18#define __GFP_SWAP 0x20
19#ifdef CONFIG_HIGHMEM
20#define __GFP_HIGHMEM 0x40
21#else
22#define __GFP_HIGHMEM 0x0 /* noop */
23#endif
24
25#define __GFP_DMA 0x80
26
27#define GFP_BUFFER (__GFP_LOW | __GFP_WAIT)
28#define GFP_ATOMIC (__GFP_HIGH)
29#define GFP_USER (__GFP_LOW | __GFP_WAIT | __GFP_IO)
30#define GFP_HIGHUSER (GFP_USER | __GFP_HIGHMEM)
31#define GFP_KERNEL (__GFP_MED | __GFP_WAIT | __GFP_IO)
32#define GFP_NFS (__GFP_HIGH | __GFP_WAIT | __GFP_IO)
33#define GFP_KSWAPD (__GFP_IO | __GFP_SWAP)
34
35/* Flag - indicates that the buffer will be suitable for DMA. Ignored on some
36 platforms, used as appropriate on others */
37
38#define GFP_DMA __GFP_DMA
39
40/* Flag - indicates that the buffer can be taken from high memory which is not
41 directly addressable by the kernel */
42
43#define GFP_HIGHMEM __GFP_HIGHMEM
44
45/*
46 * This struct defines a memory VMM memory area. There is one of these
47 * per VM-area/task. A VM area is any part of the process virtual memory
48 * space that has a special rule for the page-fault handlers (ie a shared
49 * library, the executable area etc).
50 */
51struct vm_area_struct {
52 struct mm_struct * vm_mm; /* VM area parameters */
53 unsigned long vm_start;
54 unsigned long vm_end;
55
56 /* linked list of VM areas per task, sorted by address */
57 struct vm_area_struct *vm_next;
58
59 pgprot_t vm_page_prot;
60 unsigned short vm_flags;
61
62 /* AVL tree of VM areas per task, sorted by address */
63 short vm_avl_height;
64 struct vm_area_struct * vm_avl_left;
65 struct vm_area_struct * vm_avl_right;
66
67 /* For areas with inode, the list inode->i_mmap, for shm areas,
68 * the list of attaches, otherwise unused.
69 */
70 struct vm_area_struct *vm_next_share;
71 struct vm_area_struct **vm_pprev_share;
72
73 struct vm_operations_struct * vm_ops;
74 unsigned long vm_pgoff; /* offset in PAGE_SIZE units, *not* PAGE_CACHE_SIZE */
75 struct file * vm_file;
76 void * vm_private_data; /* was vm_pte (shared mem) */
77};
78
79/*
80 * vm_flags..
81 */
82#define VM_READ 0x0001 /* currently active flags */
83#define VM_WRITE 0x0002
84#define VM_EXEC 0x0004
85#define VM_SHARED 0x0008
86
87#define VM_MAYREAD 0x0010 /* limits for mprotect() etc */
88#define VM_MAYWRITE 0x0020
89#define VM_MAYEXEC 0x0040
90#define VM_MAYSHARE 0x0080
91
92#define VM_GROWSDOWN 0x0100 /* general info on the segment */
93#define VM_GROWSUP 0x0200
94#define VM_SHM 0x0400 /* shared memory area, don't swap out */
95#define VM_DENYWRITE 0x0800 /* ETXTBSY on write attempts.. */
96
97#define VM_EXECUTABLE 0x1000
98#define VM_LOCKED 0x2000
99#define VM_IO 0x4000 /* Memory mapped I/O or similar */
100
101#define VM_STACK_FLAGS 0x0177
102
103/* Page flag bit values */
104#define PG_locked 0
105#define PG_error 1
106#define PG_referenced 2
107#define PG_uptodate 3
108#define PG_decr_after 5
109#define PG_DMA 7
110#define PG_slab 8
111#define PG_swap_cache 9
112#define PG_skip 10
113#define PG_swap_entry 11
114#define PG_highmem 12
115 /* bits 21-30 unused */
116#define PG_reserved 31
117
118typedef struct page {
119 unsigned long index;
120 atomic_t count;
121 unsigned long flags; /* atomic flags, some possibly updated asynchronously */
122 unsigned long virtual; /* nonzero if kmapped */
123} mem_map_t;
124
125extern mem_map_t * mem_map;
126
127#define free_page(addr) free_pages((addr),0)
128extern int free_pages(unsigned long addr, unsigned long order);
129
130#define virt_to_bus virt_to_phys
131extern unsigned long virt_to_phys(void * address);
132
133extern void * phys_to_virt(unsigned long address);
134
135#define __get_free_page(gfp_mask) __get_free_pages((gfp_mask),0)
136#define __get_dma_pages(gfp_mask, order) __get_free_pages((gfp_mask) | GFP_DMA,(order))
137
138extern void *__get_free_pages(int gfp_mask, unsigned long order);
139extern struct page * alloc_pages(int gfp_mask, unsigned long order);
140
141extern int remap_page_range(unsigned long from, unsigned long to, unsigned long size, pgprot_t prot);
142
143#endif
Note: See TracBrowser for help on using the repository browser.