update for HEAD-2003091401
[reactos.git] / ntoskrnl / include / internal / i386 / mm.h
1 /*
2  * Lowlevel memory managment definitions
3  */
4
5 #ifndef __NTOSKRNL_INCLUDE_INTERNAL_I386_MM_H
6 #define __NTOSKRNL_INCLUDE_INTERNAL_I386_MM_H
7
8 struct _EPROCESS;
9
10 #if 0
11 /*
12  * Page access attributes (or these together)
13  */
14 #define PA_READ            (1<<0)
15 #define PA_WRITE           ((1<<0)+(1<<1)) 
16 #define PA_EXECUTE         PA_READ
17 #define PA_PCD             (1<<4)
18 #define PA_PWT             (1<<3)
19
20 /*
21  * Page attributes
22  */
23 #define PA_USER            (1<<2)
24 #define PA_SYSTEM          (0)
25 #endif
26
27 // #define PAGE_SIZE (4096)
28
29 PULONG MmGetPageEntry(PVOID Address);
30
31 #define KERNEL_BASE        (0xc0000000)
32
33 #define FLUSH_TLB   {                           \
34                         unsigned int tmp;       \
35                         __asm__ __volatile__(   \
36                             "movl %%cr3,%0\n\t" \
37                             "movl %0,%%cr3\n\t" \
38                             : "=r" (tmp)        \
39                             :: "memory");       \
40                     }
41
42 PULONG MmGetPageDirectory(VOID);
43
44 #if 0
45 extern inline PULONG get_page_directory(void)
46 {
47         unsigned int page_dir=0;
48         __asm__("movl %%cr3,%0\n\t"
49                 : "=r" (page_dir));
50         return((PULONG)page_dir);
51 }
52 #endif
53
54
55 /*
56  * Amount of memory that can be mapped by a page table
57  */
58 #define PAGE_TABLE_SIZE (4*1024*1024)
59
60 #define PAGE_MASK(x) (x&(~0xfff))
61 #define VADDR_TO_PT_OFFSET(x)  (((x/1024)%4096))
62 #define VADDR_TO_PD_OFFSET(x)  ((x)/(4*1024*1024))
63
64 #endif /* __NTOSKRNL_INCLUDE_INTERNAL_I386_MM_H */