Make VM fix up memory for kernel that crosses region boundaries
[minix.git] / servers / vm / region.h
blob69419ec58acd4a2407c148eedf35558e74e47f14
2 #ifndef _REGION_H
3 #define _REGION_H 1
5 #include <minix/callnr.h>
6 #include <minix/com.h>
7 #include <minix/config.h>
8 #include <minix/const.h>
9 #include <minix/ds.h>
10 #include <minix/endpoint.h>
11 #include <minix/keymap.h>
12 #include <minix/minlib.h>
13 #include <minix/type.h>
14 #include <minix/ipc.h>
15 #include <minix/sysutil.h>
16 #include <minix/syslib.h>
17 #include <minix/const.h>
19 struct phys_block {
20 #if SANITYCHECKS
21 u32_t seencount;
22 #endif
23 vir_bytes length; /* no. of contiguous bytes */
24 phys_bytes phys; /* physical memory */
25 u8_t refcount; /* Refcount of these pages */
27 /* first in list of phys_regions that reference this block */
28 struct phys_region *firstregion;
31 typedef struct phys_region {
32 struct phys_block *ph;
33 struct vir_region *parent; /* parent vir_region. */
34 vir_bytes offset; /* offset from start of vir region */
35 #if SANITYCHECKS
36 int written; /* written to pagetable */
37 #endif
39 /* list of phys_regions that reference the same phys_block */
40 struct phys_region *next_ph_list;
42 /* AVL fields */
43 struct phys_region *less, *greater;
44 int factor;
45 } phys_region_t;
47 #include "physravl.h"
49 struct vir_region {
50 struct vir_region *next; /* next virtual region in this process */
51 vir_bytes vaddr; /* virtual address, offset from pagetable */
52 vir_bytes length; /* length in bytes */
53 physr_avl *phys; /* avl tree of physical memory blocks */
54 u16_t flags;
55 u32_t tag; /* Opaque to mapping code. */
56 struct vmproc *parent; /* Process that owns this vir_region. */
59 /* Mapping flags: */
60 #define VR_WRITABLE 0x001 /* Process may write here. */
61 #define VR_NOPF 0x002 /* May not generate page faults. */
62 #define VR_PHYS64K 0x004 /* Physical memory must be 64k aligned. */
63 #define VR_LOWER16MB 0x008
64 #define VR_LOWER1MB 0x010
66 /* Mapping type: */
67 #define VR_ANON 0x100 /* Memory to be cleared and allocated */
68 #define VR_DIRECT 0x200 /* Mapped, but not managed by VM */
69 #define VR_SHARED 0x40
71 /* Tag values: */
72 #define VRT_NONE 0xBEEF0000
73 #define VRT_HEAP 0xBEEF0001
74 #define VRT_CODE 0xBEEF0002
76 /* map_page_region flags */
77 #define MF_PREALLOC 0x01
78 #define MF_CONTIG 0x02
80 #endif