drop safemap code
[minix.git] / servers / vm / region.h
blob4e9365b6a84f9f6d96d3d2fa8551ffe14ceaf496
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 #include "phys_region.h"
20 #include "physravl.h"
21 #include "memtype.h"
22 #include "vm.h"
24 struct phys_block {
25 #if SANITYCHECKS
26 u32_t seencount;
27 #endif
28 phys_bytes phys; /* physical memory */
29 u8_t refcount; /* Refcount of these pages */
31 /* what kind of memory is it? */
32 mem_type_t *memtype;
34 /* first in list of phys_regions that reference this block */
35 struct phys_region *firstregion;
38 typedef struct vir_region {
39 vir_bytes vaddr; /* virtual address, offset from pagetable */
40 vir_bytes length; /* length in bytes */
41 physr_avl *phys; /* avl tree of physical memory blocks */
42 u16_t flags;
43 struct vmproc *parent; /* Process that owns this vir_region. */
44 mem_type_t *memtype; /* Default instantiated memory type. */
45 int remaps;
46 u32_t id; /* unique id */
48 union {
49 phys_bytes phys;
50 struct {
51 endpoint_t ep;
52 vir_bytes vaddr;
53 int id;
54 } shared;
55 } param;
57 /* AVL fields */
58 struct vir_region *lower, *higher;
59 int factor;
60 } region_t;
62 /* Mapping flags: */
63 #define VR_WRITABLE 0x001 /* Process may write here. */
64 #define VR_PHYS64K 0x004 /* Physical memory must be 64k aligned. */
65 #define VR_LOWER16MB 0x008
66 #define VR_LOWER1MB 0x010
67 #define VR_CONTIG 0x020 /* Must be physically contiguous. */
68 #define VR_SHARED 0x040
69 #define VR_UNINITIALIZED 0x080 /* Do not clear after allocation */
71 /* Mapping type: */
72 #define VR_ANON 0x100 /* Memory to be cleared and allocated */
73 #define VR_DIRECT 0x200 /* Mapped, but not managed by VM */
75 /* map_page_region flags */
76 #define MF_PREALLOC 0x01
78 #endif