secondary cache feature in vm.
[minix.git] / servers / vm / proto.h
blobbe635a0695a4795fa9b6ab7eb5139b11a519de19
1 /* Function prototypes. */
3 struct vmproc;
4 struct stat;
5 struct mem_map;
6 struct memory;
7 struct vir_region;
8 struct phys_region;
10 #include <minix/ipc.h>
11 #include <minix/endpoint.h>
12 #include <minix/safecopies.h>
13 #include <minix/vm.h>
14 #include <timers.h>
15 #include <stdio.h>
16 #include <pagetable.h>
18 #include "vm.h"
20 /* alloc.c */
21 _PROTOTYPE( phys_clicks alloc_mem, (phys_clicks clicks, u32_t flags) );
22 _PROTOTYPE( struct memlist *alloc_mem_in_list, (phys_bytes bytes, u32_t flags));
23 _PROTOTYPE( int do_adddma, (message *msg) );
24 _PROTOTYPE( int do_deldma, (message *msg) );
25 _PROTOTYPE( int do_getdma, (message *msg) );
26 _PROTOTYPE( void release_dma, (struct vmproc *vmp) );
27 _PROTOTYPE( void memstats, (int *nodes, int *pages, int *largest) );
28 _PROTOTYPE( void printmemstats, (void) );
29 _PROTOTYPE( void usedpages_reset, (void) );
30 _PROTOTYPE( int usedpages_add_f, (phys_bytes phys, phys_bytes len,
31 char *file, int line) );
32 _PROTOTYPE( void free_mem, (phys_clicks base, phys_clicks clicks) );
33 _PROTOTYPE( void free_mem_list, (struct memlist *list, int all));
34 _PROTOTYPE( void print_mem_list, (struct memlist *ml));
35 #define usedpages_add(a, l) usedpages_add_f(a, l, __FILE__, __LINE__)
37 _PROTOTYPE( void mem_init, (struct memory *chunks) );
39 /* utility.c */
40 _PROTOTYPE( int get_mem_map, (int proc_nr, struct mem_map *mem_map) );
41 _PROTOTYPE( void get_mem_chunks, (struct memory *mem_chunks));
42 _PROTOTYPE( void reserve_proc_mem, (struct memory *mem_chunks,
43 struct mem_map *map_ptr));
44 _PROTOTYPE( int vm_isokendpt, (endpoint_t ep, int *proc) );
45 _PROTOTYPE( int get_stack_ptr, (int proc_nr, vir_bytes *sp) );
46 _PROTOTYPE( int do_info, (message *) );
47 _PROTOTYPE( int swap_proc, (endpoint_t src_e, endpoint_t dst_e) );
49 /* exit.c */
50 _PROTOTYPE( void clear_proc, (struct vmproc *vmp) );
51 _PROTOTYPE( int do_exit, (message *msg) );
52 _PROTOTYPE( int do_willexit, (message *msg) );
53 _PROTOTYPE( void free_proc, (struct vmproc *vmp) );
55 /* fork.c */
56 _PROTOTYPE( int do_fork, (message *msg) );
58 /* exec.c */
59 _PROTOTYPE( struct vmproc *find_share, (struct vmproc *vmp_ign, Ino_t ino,
60 dev_t dev, time_t ctime) );
61 _PROTOTYPE( int do_exec_newmem, (message *msg) );
62 _PROTOTYPE( int proc_new, (struct vmproc *vmp, phys_bytes start,
63 phys_bytes text, phys_bytes data, phys_bytes stack, phys_bytes gap,
64 phys_bytes text_here, phys_bytes data_here, vir_bytes stacktop,
65 int prealloc_stack));
66 _PROTOTYPE( phys_bytes find_kernel_top, (void) );
68 /* break.c */
69 _PROTOTYPE( int do_brk, (message *msg) );
70 _PROTOTYPE( int adjust, (struct vmproc *rmp,
71 vir_clicks data_clicks, vir_bytes sp) );
72 _PROTOTYPE( int real_brk, (struct vmproc *vmp, vir_bytes v));
74 /* signal.c */
75 _PROTOTYPE( int do_push_sig, (message *msg) );
77 /* map_mem.c */
78 _PROTOTYPE( int map_memory, (endpoint_t sour, endpoint_t dest,
79 vir_bytes virt_s, vir_bytes virt_d, vir_bytes length, int flag));
80 _PROTOTYPE( int unmap_memory, (endpoint_t sour, endpoint_t dest,
81 vir_bytes virt_s, vir_bytes virt_d, vir_bytes length, int flag));
83 /* mmap.c */
84 _PROTOTYPE(int do_mmap, (message *msg) );
85 _PROTOTYPE(int do_munmap, (message *msg) );
86 _PROTOTYPE(int do_map_phys, (message *msg) );
87 _PROTOTYPE(int do_unmap_phys, (message *msg) );
88 _PROTOTYPE(int do_remap, (message *m) );
89 _PROTOTYPE(int do_get_phys, (message *m) );
90 _PROTOTYPE(int do_shared_unmap, (message *m) );
91 _PROTOTYPE(int do_get_refcount, (message *m) );
93 /* pagefaults.c */
94 _PROTOTYPE( void do_pagefaults, (message *m) );
95 _PROTOTYPE( void do_memory, (void) );
96 _PROTOTYPE( char *pf_errstr, (u32_t err));
97 _PROTOTYPE( int handle_memory, (struct vmproc *vmp, vir_bytes mem,
98 vir_bytes len, int wrflag));
100 /* $(ARCH)/pagetable.c */
101 _PROTOTYPE( void pt_init, (phys_bytes limit) );
102 _PROTOTYPE( void pt_check, (struct vmproc *vmp) );
103 _PROTOTYPE( int pt_new, (pt_t *pt) );
104 _PROTOTYPE( void pt_free, (pt_t *pt) );
105 _PROTOTYPE( int pt_writemap, (pt_t *pt, vir_bytes v, phys_bytes physaddr,
106 size_t bytes, u32_t flags, u32_t writemapflags));
107 _PROTOTYPE( int pt_checkrange, (pt_t *pt, vir_bytes v, size_t bytes, int write));
108 _PROTOTYPE( int pt_bind, (pt_t *pt, struct vmproc *who) );
109 _PROTOTYPE( void *vm_allocpage, (phys_bytes *p, int cat));
110 _PROTOTYPE( void pt_cycle, (void));
111 _PROTOTYPE( int pt_mapkernel, (pt_t *pt));
112 _PROTOTYPE( void vm_pagelock, (void *vir, int lockflag) );
113 _PROTOTYPE( int vm_addrok, (void *vir, int write) );
115 #if SANITYCHECKS
116 _PROTOTYPE( void pt_sanitycheck, (pt_t *pt, char *file, int line) );
117 #endif
119 /* slaballoc.c */
120 _PROTOTYPE(void *slaballoc,(int bytes));
121 _PROTOTYPE(void slabfree,(void *mem, int bytes));
122 _PROTOTYPE(void slabstats,(void));
123 _PROTOTYPE(void slab_sanitycheck, (char *file, int line));
124 #define SLABALLOC(var) (var = slaballoc(sizeof(*var)))
125 #define SLABFREE(ptr) do { slabfree(ptr, sizeof(*(ptr))); (ptr) = NULL; } while(0)
126 #if SANITYCHECKS
128 _PROTOTYPE(void slabunlock,(void *mem, int bytes));
129 _PROTOTYPE(void slablock,(void *mem, int bytes));
130 _PROTOTYPE(int slabsane_f,(char *file, int line, void *mem, int bytes));
131 #endif
133 /* region.c */
134 _PROTOTYPE(struct vir_region * map_page_region,(struct vmproc *vmp, \
135 vir_bytes min, vir_bytes max, vir_bytes length, vir_bytes what, \
136 u32_t flags, int mapflags));
137 _PROTOTYPE(struct vir_region * map_proc_kernel,(struct vmproc *dst));
138 _PROTOTYPE(int map_region_extend,(struct vmproc *vmp, struct vir_region *vr, vir_bytes delta));
139 _PROTOTYPE(int map_region_shrink,(struct vir_region *vr, vir_bytes delta));
140 _PROTOTYPE(int map_unmap_region,(struct vmproc *vmp, struct vir_region *vr, vir_bytes len));
141 _PROTOTYPE(int map_free_proc,(struct vmproc *vmp));
142 _PROTOTYPE(int map_proc_copy,(struct vmproc *dst, struct vmproc *src));
143 _PROTOTYPE(struct vir_region *map_lookup,(struct vmproc *vmp, vir_bytes addr));
144 _PROTOTYPE(int map_pf,(struct vmproc *vmp,
145 struct vir_region *region, vir_bytes offset, int write));
146 _PROTOTYPE(int map_handle_memory,(struct vmproc *vmp,
147 struct vir_region *region, vir_bytes offset, vir_bytes len, int write));
148 _PROTOTYPE(void map_printmap, (struct vmproc *vmp));
149 _PROTOTYPE(int map_writept, (struct vmproc *vmp));
150 _PROTOTYPE(void printregionstats, (struct vmproc *vmp));
151 _PROTOTYPE(phys_bytes map_lookup_phys, (struct vmproc *vmp, u32_t tag));
153 _PROTOTYPE(struct vir_region * map_region_lookup_tag, (struct vmproc *vmp, u32_t tag));
154 _PROTOTYPE(void map_region_set_tag, (struct vir_region *vr, u32_t tag));
155 _PROTOTYPE(u32_t map_region_get_tag, (struct vir_region *vr));
156 _PROTOTYPE(int map_remap, (struct vmproc *dvmp, vir_bytes da, size_t size,
157 struct vir_region *region, vir_bytes *r));
158 _PROTOTYPE(int map_get_phys, (struct vmproc *vmp, vir_bytes addr, phys_bytes *r));
159 _PROTOTYPE(int map_get_ref, (struct vmproc *vmp, vir_bytes addr, u8_t *cnt));
161 _PROTOTYPE(void pb_unreferenced, (struct vir_region *region,
162 struct phys_region *pr));
163 _PROTOTYPE(void get_usage_info, (struct vmproc *vmp,
164 struct vm_usage_info *vui));
165 _PROTOTYPE(int get_region_info, (struct vmproc *vmp,
166 struct vm_region_info *vri, int count, vir_bytes *nextp));
167 _PROTOTYPE(int copy_abs2region, (phys_bytes abs,
168 struct vir_region *destregion, phys_bytes offset, phys_bytes len));
169 #if SANITYCHECKS
170 _PROTOTYPE(void map_sanitycheck,(char *file, int line));
171 _PROTOTYPE(void blockstats,(void));
172 #endif
173 _PROTOTYPE(int do_forgetblocks, (message *m));
174 _PROTOTYPE(int do_forgetblock, (message *m));
175 _PROTOTYPE(int do_yieldblockgetblock, (message *m));
176 _PROTOTYPE(vir_bytes free_yielded, (vir_bytes bytes));
178 /* $(ARCH)/vm.c */
179 _PROTOTYPE( vir_bytes arch_map2vir, (struct vmproc *vmp, vir_bytes addr));
180 _PROTOTYPE( char *arch_map2str, (struct vmproc *vmp, vir_bytes addr));
181 _PROTOTYPE( vir_bytes arch_map2info, (struct vmproc *vmp, vir_bytes addr,
182 int *space, int *prot));
183 _PROTOTYPE( vir_bytes arch_vir2map, (struct vmproc *vmp, vir_bytes addr));
184 _PROTOTYPE( vir_bytes arch_vir2map_text, (struct vmproc *vmp, vir_bytes addr));
185 _PROTOTYPE( vir_bytes arch_addrok, (struct vmproc *vmp, vir_bytes addr));
187 /* rs.c */
188 _PROTOTYPE(int do_rs_set_priv, (message *m));
189 _PROTOTYPE(int do_rs_update, (message *m));
191 /* queryexit.c */
192 _PROTOTYPE(int do_query_exit, (message *m));
193 _PROTOTYPE(int do_notify_sig, (message *m));
194 _PROTOTYPE(void init_query_exit, (void));