1 /* Function prototypes. */
10 #include <minix/ipc.h>
11 #include <minix/endpoint.h>
12 #include <minix/safecopies.h>
16 #include <pagetable.h>
21 _PROTOTYPE( phys_clicks alloc_mem_f
, (phys_clicks clicks
, u32_t flags
) );
22 _PROTOTYPE( int do_adddma
, (message
*msg
) );
23 _PROTOTYPE( int do_deldma
, (message
*msg
) );
24 _PROTOTYPE( int do_getdma
, (message
*msg
) );
25 _PROTOTYPE( void release_dma
, (struct vmproc
*vmp
) );
26 _PROTOTYPE( void memstats
, (int *nodes
, int *pages
, int *largest
) );
27 _PROTOTYPE( void printmemstats
, (void) );
28 _PROTOTYPE( void usedpages_reset
, (void) );
29 _PROTOTYPE( int usedpages_add_f
, (phys_bytes phys
, phys_bytes len
,
30 char *file
, int line
) );
31 _PROTOTYPE( void free_mem_f
, (phys_clicks base
, phys_clicks clicks
) );
32 #define usedpages_add(a, l) usedpages_add_f(a, l, __FILE__, __LINE__)
34 #define ALLOC_MEM(clicks, flags) alloc_mem_f(clicks, flags)
35 #define FREE_MEM(base, clicks) free_mem_f(base, clicks)
37 _PROTOTYPE( void mem_init
, (struct memory
*chunks
) );
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
*) );
49 _PROTOTYPE( void clear_proc
, (struct vmproc
*vmp
) );
50 _PROTOTYPE( int do_exit
, (message
*msg
) );
51 _PROTOTYPE( int do_willexit
, (message
*msg
) );
52 _PROTOTYPE( void free_proc
, (struct vmproc
*vmp
) );
55 _PROTOTYPE( int do_fork
, (message
*msg
) );
58 _PROTOTYPE( struct vmproc
*find_share
, (struct vmproc
*vmp_ign
, Ino_t ino
,
59 Dev_t dev
, time_t ctime
) );
60 _PROTOTYPE( int do_exec_newmem
, (message
*msg
) );
61 _PROTOTYPE( int proc_new
, (struct vmproc
*vmp
, phys_bytes start
,
62 phys_bytes text
, phys_bytes data
, phys_bytes stack
, phys_bytes gap
,
63 phys_bytes text_here
, phys_bytes data_here
, vir_bytes stacktop
));
64 _PROTOTYPE( phys_bytes find_kernel_top
, (void) );
67 _PROTOTYPE( int do_brk
, (message
*msg
) );
68 _PROTOTYPE( int adjust
, (struct vmproc
*rmp
,
69 vir_clicks data_clicks
, vir_bytes sp
) );
70 _PROTOTYPE( int real_brk
, (struct vmproc
*vmp
, vir_bytes v
));
73 _PROTOTYPE( int do_push_sig
, (message
*msg
) );
76 _PROTOTYPE( int map_memory
, (endpoint_t sour
, endpoint_t dest
,
77 vir_bytes virt_s
, vir_bytes virt_d
, vir_bytes length
, int flag
));
78 _PROTOTYPE( int unmap_memory
, (endpoint_t sour
, endpoint_t dest
,
79 vir_bytes virt_s
, vir_bytes virt_d
, vir_bytes length
, int flag
));
82 _PROTOTYPE(int do_mmap
, (message
*msg
) );
83 _PROTOTYPE(int do_munmap
, (message
*msg
) );
84 _PROTOTYPE(int do_map_phys
, (message
*msg
) );
85 _PROTOTYPE(int do_unmap_phys
, (message
*msg
) );
86 _PROTOTYPE(int do_remap
, (message
*m
) );
87 _PROTOTYPE(int do_get_phys
, (message
*m
) );
88 _PROTOTYPE(int do_shared_unmap
, (message
*m
) );
89 _PROTOTYPE(int do_get_refcount
, (message
*m
) );
92 _PROTOTYPE( void do_pagefaults
, (void) );
93 _PROTOTYPE( void do_memory
, (void) );
94 _PROTOTYPE( char *pf_errstr
, (u32_t err
));
95 _PROTOTYPE( int handle_memory
, (struct vmproc
*vmp
, vir_bytes mem
,
96 vir_bytes len
, int wrflag
));
98 /* $(ARCH)/pagetable.c */
99 _PROTOTYPE( void pt_init
, (phys_bytes limit
) );
100 _PROTOTYPE( void pt_check
, (struct vmproc
*vmp
) );
101 _PROTOTYPE( int pt_new
, (pt_t
*pt
) );
102 _PROTOTYPE( int pt_identity
, (pt_t
*pt
) );
103 _PROTOTYPE( void pt_free
, (pt_t
*pt
) );
104 _PROTOTYPE( int pt_writemap
, (pt_t
*pt
, vir_bytes v
, phys_bytes physaddr
,
105 size_t bytes
, u32_t flags
, u32_t writemapflags
));
106 _PROTOTYPE( int pt_checkrange
, (pt_t
*pt
, vir_bytes v
, size_t bytes
, int write
));
107 _PROTOTYPE( int pt_bind
, (pt_t
*pt
, struct vmproc
*who
) );
108 _PROTOTYPE( void *vm_allocpage
, (phys_bytes
*p
, int cat
));
109 _PROTOTYPE( void pt_cycle
, (void));
110 _PROTOTYPE( int pt_mapkernel
, (pt_t
*pt
));
111 _PROTOTYPE( void vm_pagelock
, (void *vir
, int lockflag
) );
114 _PROTOTYPE( void pt_sanitycheck
, (pt_t
*pt
, char *file
, int line
) );
117 /* $(ARCH)/pagefaults.c */
118 _PROTOTYPE( int arch_get_pagefault
, (endpoint_t
*who
, vir_bytes
*addr
, u32_t
*err
));
121 _PROTOTYPE(void *slaballoc
,(int bytes
));
122 _PROTOTYPE(void slabfree
,(void *mem
, int bytes
));
123 _PROTOTYPE(void slabstats
,(void));
124 _PROTOTYPE(void slab_sanitycheck
, (char *file
, int line
));
125 #define SLABALLOC(var) (var = slaballoc(sizeof(*var)))
126 #define SLABFREE(ptr) slabfree(ptr, sizeof(*(ptr)))
129 _PROTOTYPE(void slabunlock
,(void *mem
, int bytes
));
130 _PROTOTYPE(void slablock
,(void *mem
, int bytes
));
131 _PROTOTYPE(int slabsane_f
,(char *file
, int line
, void *mem
, int bytes
));
135 _PROTOTYPE(struct vir_region
* map_page_region
,(struct vmproc
*vmp
, \
136 vir_bytes min
, vir_bytes max
, vir_bytes length
, vir_bytes what
, \
137 u32_t flags
, int mapflags
));
138 _PROTOTYPE(struct vir_region
* map_proc_kernel
,(struct vmproc
*dst
));
139 _PROTOTYPE(int map_region_extend
,(struct vmproc
*vmp
, struct vir_region
*vr
, vir_bytes delta
));
140 _PROTOTYPE(int map_region_shrink
,(struct vir_region
*vr
, vir_bytes delta
));
141 _PROTOTYPE(int map_unmap_region
,(struct vmproc
*vmp
, struct vir_region
*vr
, vir_bytes len
));
142 _PROTOTYPE(int map_free_proc
,(struct vmproc
*vmp
));
143 _PROTOTYPE(int map_proc_copy
,(struct vmproc
*dst
, struct vmproc
*src
));
144 _PROTOTYPE(struct vir_region
*map_lookup
,(struct vmproc
*vmp
, vir_bytes addr
));
145 _PROTOTYPE(int map_pf
,(struct vmproc
*vmp
,
146 struct vir_region
*region
, vir_bytes offset
, int write
));
147 _PROTOTYPE(int map_handle_memory
,(struct vmproc
*vmp
,
148 struct vir_region
*region
, vir_bytes offset
, vir_bytes len
, int write
));
149 _PROTOTYPE(void map_printmap
, (struct vmproc
*vmp
));
150 _PROTOTYPE(int map_writept
, (struct vmproc
*vmp
));
151 _PROTOTYPE(void printregionstats
, (struct vmproc
*vmp
));
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(int map_copy_ph_block
, (struct vmproc
*vmp
,
162 struct vir_region
*region
, struct phys_region
*ph
));
163 _PROTOTYPE(void pb_unreferenced
, (struct vir_region
*region
,
164 struct phys_region
*pr
));
165 _PROTOTYPE(void get_usage_info
, (struct vmproc
*vmp
,
166 struct vm_usage_info
*vui
));
167 _PROTOTYPE(int get_region_info
, (struct vmproc
*vmp
,
168 struct vm_region_info
*vri
, int count
, vir_bytes
*nextp
));
170 _PROTOTYPE(void map_sanitycheck
,(char *file
, int line
));
174 _PROTOTYPE( vir_bytes arch_map2vir
, (struct vmproc
*vmp
, vir_bytes addr
));
175 _PROTOTYPE( char *arch_map2str
, (struct vmproc
*vmp
, vir_bytes addr
));
176 _PROTOTYPE( vir_bytes arch_map2info
, (struct vmproc
*vmp
, vir_bytes addr
,
177 int *space
, int *prot
));
178 _PROTOTYPE( vir_bytes arch_vir2map
, (struct vmproc
*vmp
, vir_bytes addr
));
179 _PROTOTYPE( vir_bytes arch_vir2map_text
, (struct vmproc
*vmp
, vir_bytes addr
));
180 _PROTOTYPE( vir_bytes arch_addrok
, (struct vmproc
*vmp
, vir_bytes addr
));
183 _PROTOTYPE(int do_rs_set_priv
, (message
*m
));
186 _PROTOTYPE(int do_query_exit
, (message
*m
));
187 _PROTOTYPE(int do_notify_sig
, (message
*m
));
188 _PROTOTYPE(void init_query_exit
, (void));