vm: allow split of mem_anon_contig region
[minix3.git] / minix / servers / vm / region.h
blob29982abbd4ff5f0bea8d4fad71cb7e7eb2493005
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/minlib.h>
12 #include <minix/type.h>
13 #include <minix/ipc.h>
14 #include <minix/sysutil.h>
15 #include <minix/syslib.h>
16 #include <minix/const.h>
18 #include "phys_region.h"
19 #include "memtype.h"
20 #include "vm.h"
21 #include "fdref.h"
23 struct phys_block {
24 #if SANITYCHECKS
25 u32_t seencount;
26 #endif
27 phys_bytes phys; /* physical memory */
29 /* first in list of phys_regions that reference this block */
30 struct phys_region *firstregion;
31 u8_t refcount; /* Refcount of these pages */
32 u8_t flags;
35 #define PBF_INCACHE 0x01
37 typedef struct vir_region {
38 vir_bytes vaddr; /* virtual address, offset from pagetable */
39 vir_bytes length; /* length in bytes */
40 struct phys_region **physblocks;
41 u16_t flags;
42 struct vmproc *parent; /* Process that owns this vir_region. */
43 mem_type_t *def_memtype; /* Default instantiated memory type. */
44 int remaps;
45 int id; /* unique id */
47 union {
48 phys_bytes phys; /* VR_DIRECT */
49 struct {
50 endpoint_t ep;
51 vir_bytes vaddr;
52 int id;
53 } shared;
54 struct phys_block *pb_cache;
55 struct {
56 int inited;
57 struct fdref *fdref;
58 u64_t offset;
59 u16_t clearend;
60 } file;
61 } param;
63 /* AVL fields */
64 struct vir_region *lower, *higher;
65 int factor;
66 } region_t;
68 /* Mapping flags: */
69 #define VR_WRITABLE 0x001 /* Process may write here. */
70 #define VR_PHYS64K 0x004 /* Physical memory must be 64k aligned. */
71 #define VR_LOWER16MB 0x008
72 #define VR_LOWER1MB 0x010
73 #define VR_SHARED 0x040
74 #define VR_UNINITIALIZED 0x080 /* Do not clear after allocation */
76 /* Mapping type: */
77 #define VR_ANON 0x100 /* Memory to be cleared and allocated */
78 #define VR_DIRECT 0x200 /* Mapped, but not managed by VM */
80 /* map_page_region flags */
81 #define MF_PREALLOC 0x01
83 #endif