1 /* Function prototypes. */
9 #include <minix/endpoint.h>
10 #include <minix/safecopies.h>
13 #include <pagetable.h>
18 _PROTOTYPE( phys_clicks alloc_mem_f
, (phys_clicks clicks
, u32_t flags
) );
19 _PROTOTYPE( int do_adddma
, (message
*msg
) );
20 _PROTOTYPE( int do_deldma
, (message
*msg
) );
21 _PROTOTYPE( int do_getdma
, (message
*msg
) );
22 _PROTOTYPE( int do_allocmem
, (message
*msg
) );
23 _PROTOTYPE( void release_dma
, (struct vmproc
*vmp
) );
24 _PROTOTYPE( void memstats
, (int *nodes
, int *pages
, int *largest
) );
25 _PROTOTYPE( void printmemstats
, (void) );
26 _PROTOTYPE( void usedpages_reset
, (void) );
27 _PROTOTYPE( int usedpages_add_f
, (phys_bytes phys
, phys_bytes len
,
28 char *file
, int line
) );
29 _PROTOTYPE( void free_mem_f
, (phys_clicks base
, phys_clicks clicks
) );
30 #define usedpages_add(a, l) usedpages_add_f(a, l, __FILE__, __LINE__)
32 #define ALLOC_MEM(clicks, flags) alloc_mem_f(clicks, flags)
33 #define FREE_MEM(base, clicks) free_mem_f(base, clicks)
35 _PROTOTYPE( void mem_init
, (struct memory
*chunks
) );
38 _PROTOTYPE( int get_mem_map
, (int proc_nr
, struct mem_map
*mem_map
) );
39 _PROTOTYPE( void get_mem_chunks
, (struct memory
*mem_chunks
));
40 _PROTOTYPE( void reserve_proc_mem
, (struct memory
*mem_chunks
,
41 struct mem_map
*map_ptr
));
42 _PROTOTYPE( int vm_isokendpt
, (endpoint_t ep
, int *proc
) );
43 _PROTOTYPE( int get_stack_ptr
, (int proc_nr
, vir_bytes
*sp
) );
44 _PROTOTYPE( int do_ctl
, (message
*) );
47 _PROTOTYPE( void clear_proc
, (struct vmproc
*vmp
) );
48 _PROTOTYPE( int do_exit
, (message
*msg
) );
49 _PROTOTYPE( int do_willexit
, (message
*msg
) );
50 _PROTOTYPE( void free_proc
, (struct vmproc
*vmp
) );
53 _PROTOTYPE( int do_fork
, (message
*msg
) );
56 _PROTOTYPE( struct vmproc
*find_share
, (struct vmproc
*vmp_ign
, Ino_t ino
,
57 Dev_t dev
, time_t ctime
) );
58 _PROTOTYPE( int do_exec_newmem
, (message
*msg
) );
59 _PROTOTYPE( int proc_new
, (struct vmproc
*vmp
, phys_bytes start
,
60 phys_bytes text
, phys_bytes data
, phys_bytes stack
, phys_bytes gap
,
61 phys_bytes text_here
, phys_bytes data_here
, vir_bytes stacktop
));
62 _PROTOTYPE( phys_bytes find_kernel_top
, (void) );
65 _PROTOTYPE( int do_brk
, (message
*msg
) );
66 _PROTOTYPE( int adjust
, (struct vmproc
*rmp
,
67 vir_clicks data_clicks
, vir_bytes sp
) );
68 _PROTOTYPE( int real_brk
, (struct vmproc
*vmp
, vir_bytes v
));
71 _PROTOTYPE( int do_push_sig
, (message
*msg
) );
74 _PROTOTYPE( int do_vfs_reply
, (message
*msg
) );
75 _PROTOTYPE( int vfs_open
, (struct vmproc
*for_who
, callback_t callback
,
76 cp_grant_id_t filename_gid
, int filename_len
, int flags
, int mode
));
77 _PROTOTYPE( int vfs_close
, (struct vmproc
*for_who
, callback_t callback
,
81 _PROTOTYPE(int do_mmap
, (message
*msg
) );
82 _PROTOTYPE(int do_munmap
, (message
*msg
) );
83 _PROTOTYPE(int do_map_phys
, (message
*msg
) );
84 _PROTOTYPE(int do_unmap_phys
, (message
*msg
) );
85 _PROTOTYPE(int do_remap
, (message
*m
) );
86 _PROTOTYPE(int do_get_phys
, (message
*m
) );
87 _PROTOTYPE(int do_shared_unmap
, (message
*m
) );
88 _PROTOTYPE(int do_get_refcount
, (message
*m
) );
91 _PROTOTYPE( void do_pagefaults
, (void) );
92 _PROTOTYPE( void do_memory
, (void) );
93 _PROTOTYPE( char *pf_errstr
, (u32_t err
));
94 _PROTOTYPE( int handle_memory
, (struct vmproc
*vmp
, vir_bytes mem
,
95 vir_bytes len
, int wrflag
));
97 /* $(ARCH)/pagetable.c */
98 _PROTOTYPE( void pt_init
, (phys_bytes limit
) );
99 _PROTOTYPE( void pt_check
, (struct vmproc
*vmp
) );
100 _PROTOTYPE( int pt_new
, (pt_t
*pt
) );
101 _PROTOTYPE( int pt_identity
, (pt_t
*pt
) );
102 _PROTOTYPE( void pt_free
, (pt_t
*pt
) );
103 _PROTOTYPE( int pt_writemap
, (pt_t
*pt
, vir_bytes v
, phys_bytes physaddr
,
104 size_t bytes
, u32_t flags
, u32_t writemapflags
));
105 _PROTOTYPE( int pt_checkrange
, (pt_t
*pt
, vir_bytes v
, size_t bytes
, int write
));
106 _PROTOTYPE( int pt_bind
, (pt_t
*pt
, struct vmproc
*who
) );
107 _PROTOTYPE( void *vm_allocpage
, (phys_bytes
*p
, int cat
));
108 _PROTOTYPE( void pt_cycle
, (void));
109 _PROTOTYPE( int pt_mapkernel
, (pt_t
*pt
));
110 _PROTOTYPE( void vm_pagelock
, (void *vir
, int lockflag
) );
113 _PROTOTYPE( void pt_sanitycheck
, (pt_t
*pt
, char *file
, int line
) );
116 /* $(ARCH)/pagefaults.c */
117 _PROTOTYPE( int arch_get_pagefault
, (endpoint_t
*who
, vir_bytes
*addr
, u32_t
*err
));
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) slabfree(ptr, sizeof(*(ptr)))
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
));
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
));
152 _PROTOTYPE(struct vir_region
* map_region_lookup_tag
, (struct vmproc
*vmp
, u32_t tag
));
153 _PROTOTYPE(void map_region_set_tag
, (struct vir_region
*vr
, u32_t tag
));
154 _PROTOTYPE(u32_t map_region_get_tag
, (struct vir_region
*vr
));
155 _PROTOTYPE(int map_remap
, (struct vmproc
*dvmp
, vir_bytes da
, size_t size
,
156 struct vir_region
*region
, vir_bytes
*r
));
157 _PROTOTYPE(int map_get_phys
, (struct vmproc
*vmp
, vir_bytes addr
, phys_bytes
*r
));
158 _PROTOTYPE(int map_get_ref
, (struct vmproc
*vmp
, vir_bytes addr
, u8_t
*cnt
));
161 _PROTOTYPE(void map_sanitycheck
,(char *file
, int line
));
165 _PROTOTYPE( vir_bytes
, arch_map2vir(struct vmproc
*vmp
, vir_bytes addr
));
166 _PROTOTYPE( char *, arch_map2str(struct vmproc
*vmp
, vir_bytes addr
));
167 _PROTOTYPE( vir_bytes
, arch_vir2map(struct vmproc
*vmp
, vir_bytes addr
));
168 _PROTOTYPE( vir_bytes
, arch_vir2map_text(struct vmproc
*vmp
, vir_bytes addr
));
169 _PROTOTYPE( vir_bytes
, arch_addrok(struct vmproc
*vmp
, vir_bytes addr
));
172 _PROTOTYPE(int do_rs_set_priv
, (message
*m
));
175 _PROTOTYPE(int do_query_exit
, (message
*m
));
176 _PROTOTYPE(int do_notify_sig
, (message
*m
));
177 _PROTOTYPE(void init_query_exit
, (void));