vm: include no-caching bits in PTF_ALLFLAGS for flags sanity check.
[minix.git] / kernel / proto.h
blobb8ff91a2c2fdbfe0a391d7499116b7537c0b0738
1 /* Function prototypes. */
3 #ifndef PROTO_H
4 #define PROTO_H
6 #include <minix/safecopies.h>
7 #include <machine/archtypes.h>
8 #include <a.out.h>
10 /* Struct declarations. */
11 struct proc;
12 struct timer;
14 /* clock.c */
15 _PROTOTYPE( clock_t get_uptime, (void) );
16 _PROTOTYPE( void set_timer, (struct timer *tp, clock_t t, tmr_func_t f) );
17 _PROTOTYPE( void reset_timer, (struct timer *tp) );
18 _PROTOTYPE( void ser_dump_proc, (void) );
20 _PROTOTYPE( void cycles_accounting_init, (void) );
22 * This functions start and stop accounting for process, kernel or idle cycles.
23 * It inherently have to account for some kernel cycles for process too,
24 * therefore it should be called asap after trapping to kernel and as late as
25 * possible before returning to userspace. These function is architecture
26 * dependent
28 _PROTOTYPE( void cycles_accounting_stop, (struct proc * p) );
29 /* this is a wrapper to make calling it from assembly easier */
30 _PROTOTYPE( void cycles_accounting_stop_idle, (void) );
32 /* main.c */
33 _PROTOTYPE( void main, (void) );
34 _PROTOTYPE( void prepare_shutdown, (int how) );
35 _PROTOTYPE( void minix_shutdown, (struct timer *tp) );
37 /* proc.c */
39 _PROTOTYPE( int do_ipc, (reg_t r1, reg_t r2, reg_t r3) );
40 _PROTOTYPE( int mini_notify, (const struct proc *src, endpoint_t dst) );
41 _PROTOTYPE( void enqueue, (struct proc *rp) );
42 _PROTOTYPE( void dequeue, (const struct proc *rp) );
43 _PROTOTYPE( struct proc * schedcheck, (void) );
44 _PROTOTYPE( struct proc * arch_finish_schedcheck, (void) );
45 _PROTOTYPE( struct proc *endpoint_lookup, (endpoint_t ep) );
46 #if DEBUG_ENABLE_IPC_WARNINGS
47 _PROTOTYPE( int isokendpt_f, (const char *file, int line, endpoint_t e, int *p, int f));
48 #define isokendpt_d(e, p, f) isokendpt_f(__FILE__, __LINE__, (e), (p), (f))
49 #else
50 _PROTOTYPE( int isokendpt_f, (endpoint_t e, int *p, int f) );
51 #define isokendpt_d(e, p, f) isokendpt_f((e), (p), (f))
52 #endif
53 _PROTOTYPE( void check_ticks_left, (struct proc *p));
55 /* start.c */
56 _PROTOTYPE( void cstart, (U16_t cs, U16_t ds, U16_t mds,
57 U16_t parmoff, U16_t parmsize) );
59 /* system.c */
60 _PROTOTYPE( int get_priv, (register struct proc *rc, int proc_type) );
61 _PROTOTYPE( void set_sendto_bit, (const struct proc *rc, int id) );
62 _PROTOTYPE( void unset_sendto_bit, (const struct proc *rc, int id) );
63 _PROTOTYPE( void send_sig, (endpoint_t proc_nr, int sig_nr) );
64 _PROTOTYPE( void cause_sig, (proc_nr_t proc_nr, int sig_nr) );
65 _PROTOTYPE( void sig_delay_done, (struct proc *rp) );
66 _PROTOTYPE( void kernel_call, (message *m_user, struct proc * caller) );
67 _PROTOTYPE( void system_init, (void) );
68 #define numap_local(proc_nr, vir_addr, bytes) \
69 umap_local(proc_addr(proc_nr), D, (vir_addr), (bytes))
70 _PROTOTYPE( phys_bytes umap_grant, (struct proc *, cp_grant_id_t, vir_bytes));
71 _PROTOTYPE( void clear_endpoint, (struct proc *rc) );
72 _PROTOTYPE( void clear_ipc, (struct proc *rc) );
73 _PROTOTYPE( void clear_ipc_refs, (struct proc *rc, int caller_ret) );
74 _PROTOTYPE( phys_bytes umap_bios, (vir_bytes vir_addr, vir_bytes bytes));
75 _PROTOTYPE( void kernel_call_resume, (struct proc *p));
77 /* system/do_newmap.c */
78 _PROTOTYPE( int newmap, (struct proc * caller, struct proc *rp,
79 struct mem_map *map_ptr));
81 /* system/do_vtimer.c */
82 _PROTOTYPE( void vtimer_check, (struct proc *rp) );
84 /* interrupt.c */
85 _PROTOTYPE( void put_irq_handler, (irq_hook_t *hook, int irq,
86 irq_handler_t handler) );
87 _PROTOTYPE( void rm_irq_handler, (const irq_hook_t *hook) );
88 _PROTOTYPE( void enable_irq, (const irq_hook_t *hook) );
89 _PROTOTYPE( int disable_irq, (const irq_hook_t *hook) );
91 /* debug.c */
92 _PROTOTYPE( int runqueues_ok, (void) );
93 _PROTOTYPE( char *rtsflagstr, (int flags) );
94 _PROTOTYPE( char *miscflagstr, (int flags) );
95 _PROTOTYPE( char *schedulerstr, (struct proc *scheduler) );
97 /* system/do_safemap.c */
98 _PROTOTYPE( int map_invoke_vm, (struct proc * caller, int req_type,
99 endpoint_t end_d, int seg_d, vir_bytes off_d,
100 endpoint_t end_s, int seg_s, vir_bytes off_s,
101 size_t size, int flag));
103 /* system/do_safecopy.c */
104 _PROTOTYPE( int verify_grant, (endpoint_t, endpoint_t,
105 cp_grant_id_t, vir_bytes, int,
106 vir_bytes, vir_bytes *, endpoint_t *));
108 /* system/do_sysctl.c */
109 _PROTOTYPE( int do_sysctl, (struct proc * caller, message *m));
111 #if SPROFILE
112 /* profile.c */
113 _PROTOTYPE( void init_profile_clock, (u32_t) );
114 _PROTOTYPE( void stop_profile_clock, (void) );
115 #endif
117 /* functions defined in architecture-dependent files. */
118 _PROTOTYPE( void prot_init, (void) );
119 _PROTOTYPE( phys_bytes phys_copy, (phys_bytes source, phys_bytes dest,
120 phys_bytes count) );
121 _PROTOTYPE( void phys_copy_fault, (void));
122 _PROTOTYPE( void phys_copy_fault_in_kernel, (void));
123 #define virtual_copy(src, dst, bytes) \
124 virtual_copy_f(NULL, src, dst, bytes, 0)
125 #define virtual_copy_vmcheck(caller, src, dst, bytes) \
126 virtual_copy_f(caller, src, dst, bytes, 1)
127 _PROTOTYPE( int virtual_copy_f, (struct proc * caller,
128 struct vir_addr *src, struct vir_addr *dst,
129 vir_bytes bytes, int vmcheck) );
130 _PROTOTYPE( int data_copy, (endpoint_t from, vir_bytes from_addr,
131 endpoint_t to, vir_bytes to_addr, size_t bytes));
132 _PROTOTYPE( int data_copy_vmcheck, (struct proc *,
133 endpoint_t from, vir_bytes from_addr,
134 endpoint_t to, vir_bytes to_addr, size_t bytes));
135 _PROTOTYPE( void alloc_segments, (struct proc *rp) );
136 _PROTOTYPE( void vm_init, (struct proc *first) );
137 _PROTOTYPE( phys_bytes umap_local, (register struct proc *rp, int seg,
138 vir_bytes vir_addr, vir_bytes bytes));
139 _PROTOTYPE( void cp_mess, (int src,phys_clicks src_clicks,
140 vir_bytes src_offset, phys_clicks dst_clicks, vir_bytes dst_offset));
141 _PROTOTYPE( phys_bytes umap_remote, (const struct proc* rp, int seg,
142 vir_bytes vir_addr, vir_bytes bytes) );
143 _PROTOTYPE( phys_bytes umap_virtual, (struct proc* rp,
144 int seg, vir_bytes vir_addr, vir_bytes bytes) );
145 _PROTOTYPE( phys_bytes seg2phys, (U16_t) );
146 _PROTOTYPE( int vm_phys_memset, (phys_bytes source, u8_t pattern,
147 phys_bytes count) );
148 _PROTOTYPE( vir_bytes alloc_remote_segment, (u32_t *, segframe_t *,
149 int, phys_bytes, vir_bytes, int));
150 _PROTOTYPE( int intr_init, (int, int) );
151 _PROTOTYPE( int intr_disabled, (void) );
152 _PROTOTYPE( void halt_cpu, (void) );
153 _PROTOTYPE( void arch_init, (void) );
154 _PROTOTYPE( void ser_putc, (char) );
155 _PROTOTYPE( void arch_shutdown, (int) );
156 _PROTOTYPE( void arch_monitor, (void) );
157 _PROTOTYPE( void arch_get_aout_headers, (int i, struct exec *h) );
158 _PROTOTYPE( void restart, (void) );
159 _PROTOTYPE( void read_tsc, (unsigned long *high, unsigned long *low) );
160 _PROTOTYPE( int arch_init_profile_clock, (u32_t freq) );
161 _PROTOTYPE( void arch_stop_profile_clock, (void) );
162 _PROTOTYPE( void arch_ack_profile_clock, (void) );
163 _PROTOTYPE( void do_ser_debug, (void) );
164 _PROTOTYPE( int arch_get_params, (char *parm, int max));
165 _PROTOTYPE( int arch_set_params, (char *parm, int max));
166 _PROTOTYPE( void arch_pre_exec, (struct proc *pr, u32_t, u32_t));
167 _PROTOTYPE( int arch_umap, (const struct proc *pr, vir_bytes, vir_bytes,
168 int, phys_bytes *));
169 _PROTOTYPE( int arch_do_vmctl, (message *m_ptr, struct proc *p));
170 _PROTOTYPE( int vm_contiguous, (const struct proc *targetproc, vir_bytes vir_buf, size_t count));
171 _PROTOTYPE( void proc_stacktrace, (struct proc *proc) );
172 _PROTOTYPE( int vm_lookup, (const struct proc *proc, vir_bytes virtual, vir_bytes *result, u32_t *ptent));
173 _PROTOTYPE( int delivermsg, (struct proc *target));
174 _PROTOTYPE( void arch_do_syscall, (struct proc *proc) );
175 _PROTOTYPE( int arch_phys_map, (int index, phys_bytes *addr,
176 phys_bytes *len, int *flags));
177 _PROTOTYPE( int arch_phys_map_reply, (int index, vir_bytes addr));
178 _PROTOTYPE( int arch_enable_paging, (struct proc * caller, const message * m_ptr));
180 _PROTOTYPE( int copy_msg_from_user, (struct proc * p, message * user_mbuf,
181 message * dst));
182 _PROTOTYPE( int copy_msg_to_user, (struct proc * p, message * src,
183 message * user_mbuf));
184 _PROTOTYPE(void switch_address_space, (struct proc * p));
185 #endif /* PROTO_H */