1 2 #ifndef _VM_H 3 #define _VM_H 1 4 5 #define _SYSTEM 1 6 7 /* Compile in asserts and custom sanity checks at all? */ 8 #define SANITYCHECKS 0 9 #define CACHE_SANITY 0 10 #define VMSTATS 0 11 12 /* VM behaviour */ 13 #define MEMPROTECT 0 /* Slab objects not mapped. Access with USE() */ 14 #define JUNKFREE 0 /* Fill freed pages with junk */ 15 16 #include <sys/errno.h> 17 18 #include "sanitycheck.h" 19 #include "region.h" 20 21 /* Memory flags to pt_allocmap() and alloc_mem(). */ 22 #define PAF_CLEAR 0x01 /* Clear physical memory. */ 23 #define PAF_CONTIG 0x02 /* Physically contiguous. */ 24 #define PAF_ALIGN64K 0x04 /* Aligned to 64k boundary. */ 25 #define PAF_LOWER16MB 0x08 26 #define PAF_LOWER1MB 0x10 27 #define PAF_ALIGN16K 0x40 /* Aligned to 16k boundary. */ 28 29 #define MARK do { if(mark) { printf("%d\n", __LINE__); } } while(0) 30 31 /* special value for v in pt_allocmap */ 32 #define AM_AUTO ((u32_t) -1) 33 34 /* How noisy are we supposed to be? */ 35 #define VERBOSE 0 36 #define LU_DEBUG 0 37 38 /* Minimum stack region size - 64MB. */ 39 #define MINSTACKREGION (64*1024*1024) 40 41 /* If so, this level: */ 42 #define SCL_NONE 0 /* No sanity checks - assert()s only. */ 43 #define SCL_TOP 1 /* Main loop and other high-level places. */ 44 #define SCL_FUNCTIONS 2 /* Function entry/exit. */ 45 #define SCL_DETAIL 3 /* Detailled steps. */ 46 #define SCL_MAX 3 /* Highest value. */ 47 48 /* Type of page allocations. */ 49 #define VMP_SPARE 0 50 #define VMP_PAGETABLE 1 51 #define VMP_PAGEDIR 2 52 #define VMP_SLAB 3 53 #define VMP_CATEGORIES 4 54 55 /* Flags to pt_writemap(). */ 56 #define WMF_OVERWRITE 0x01 /* Caller knows map may overwrite. */ 57 #define WMF_WRITEFLAGSONLY 0x02 /* Copy physaddr and update flags. */ 58 #define WMF_FREE 0x04 /* Free pages overwritten. */ 59 #define WMF_VERIFY 0x08 /* Check pagetable contents. */ 60 61 #define MAP_NONE 0xFFFFFFFE 62 #define NO_MEM ((phys_clicks) MAP_NONE) /* returned by alloc_mem() with mem is up */ 63 64 /* And what is the highest addressable piece of memory? */ 65 #define VM_DATATOP kernel_boot_info.user_end 66 67 #define VM_STACKTOP kernel_boot_info.user_sp 68 69 /* Live update will work only with magic instrumentation. Live update requires 70 * strict separation of regions within the process to succeed. Therefore, 71 * apply this strict separation only if magic instrumentation is used. 72 * Otherwise, do not place such limitations on processes. 73 */ 74 #ifdef _MINIX_MAGIC 75 #define VM_MMAPTOP (VM_STACKTOP-DEFAULT_STACK_LIMIT) 76 #define VM_MMAPBASE (VM_MMAPTOP/2) 77 #else 78 #define VM_MMAPTOP VM_DATATOP 79 #define VM_MMAPBASE VM_PAGE_SIZE 80 #endif 81 82 extern char _end; 83 #define VM_OWN_HEAPSTART ((vir_bytes) (&_end)) 84 #define VM_OWN_HEAPBASE roundup(VM_OWN_HEAPSTART, VM_PAGE_SIZE) 85 #define VM_OWN_MMAPBASE (VM_OWN_HEAPBASE+1024*1024*1024) 86 #define VM_OWN_MMAPTOP (VM_OWN_MMAPBASE+100 * 1024 * 1024) 87 88 #endif 89