some coverity fixes.
[minix.git] / servers / vm / region.h
blob6fdf245615e03dc7fa2ccbf45a154c4e3db08cf4
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"
22 struct phys_block {
23 #if SANITYCHECKS
24 u32_t seencount;
25 #endif
26 phys_bytes phys; /* physical memory */
27 u8_t refcount; /* Refcount of these pages */
28 #define PBSH_COW 1
29 #define PBSH_SMAP 2
30 u8_t share_flag; /* PBSH_COW or PBSH_SMAP */
32 /* first in list of phys_regions that reference this block */
33 struct phys_region *firstregion;
36 typedef struct vir_region {
37 vir_bytes vaddr; /* virtual address, offset from pagetable */
38 vir_bytes length; /* length in bytes */
39 physr_avl *phys; /* avl tree of physical memory blocks */
40 u16_t flags;
41 u32_t tag; /* Opaque to mapping code. */
42 struct vmproc *parent; /* Process that owns this vir_region. */
44 /* AVL fields */
45 struct vir_region *lower, *higher;
46 int factor;
47 } region_t;
49 /* Mapping flags: */
50 #define VR_WRITABLE 0x001 /* Process may write here. */
51 #define VR_NOPF 0x002 /* May not generate page faults. */
52 #define VR_PHYS64K 0x004 /* Physical memory must be 64k aligned. */
53 #define VR_LOWER16MB 0x008
54 #define VR_LOWER1MB 0x010
55 #define VR_CONTIG 0x020 /* Must be physically contiguous. */
56 #define VR_SHARED 0x040
57 #define VR_UNINITIALIZED 0x080 /* Do not clear after allocation */
59 /* Mapping type: */
60 #define VR_ANON 0x100 /* Memory to be cleared and allocated */
61 #define VR_DIRECT 0x200 /* Mapped, but not managed by VM */
63 /* Tag values: */
64 #define VRT_NONE 0xBEEF0000
65 #define VRT_HEAP 0xBEEF0001
66 #define VRT_TEXT 0xBEEF0002
67 #define VRT_STACK 0xBEEF0003
69 /* map_page_region flags */
70 #define MF_PREALLOC 0x01
72 #endif