xref: /386bsd/usr/src/kernel/include/i386/inline/kernel.h (revision a2142627)
1 /*
2  * Copyright (c) 1994 William F. Jolitz.
3  * 386BSD Copyright Restrictions Apply. All Other Rights Reserved.
4  *
5  * $Id: kernel.h,v 1.1 94/06/09 18:10:23 bill Exp Locker: bill $
6  * Inline function calls for the kernel, specific to the X86 processor
7  * family.
8  */
9 
10 __BEGIN_DECLS
11 /* kernel <-> user process primatives */
12 int copyin(struct proc *p, void *from, void *toaddr, u_int maxlength);
13 int copyin_(struct proc *p, const void *from, void *toaddr, const u_int size);
14 int copyinstr(struct proc *p, void *from, void *to, u_int maxlength, u_int *lencopied);
15 int copyout(struct proc *p, void *from, void *toaddr, u_int maxlength);
16 int copyout_(struct proc *p, const void *from, void *toaddr, const u_int size);
17 int copyoutstr(struct proc *p, void *from, void *to, u_int maxlength, u_int *lencopied);
18 int copystr(void *from, void *to, u_int maxlength, u_int *lencopied);
19 
20 #if	!defined(i486)
21 /* minimized 386 write protection bug workaround functions */
22 int copyout_4(int value, void *toaddr);
23 int copyout_2(short value, void *toaddr);
24 int copyout_1(char value, void *toaddr);
25 #endif
26 
27 /* min/max functions */
28 int imax(int i1, int i2);
29 int imin(int i1, int i2);
30 long lmax(long l1, long l2);
31 long lmin(long l1, long l2);
32 u_int max(u_int u1, u_int u2);
33 u_int min(u_int u1, u_int u2);
34 u_long ulmax(u_long u1, u_long u2);
35 u_long ulmin(u_long u1, u_long u2);
36 
37 /* queue functions */
38 void _insque(queue_t element, queue_t queue);
39 void _remque(queue_t element);
40 
41 /* process run queue functions */
42 void setrq(struct proc *p);
43 void remrq(struct proc *p);
44 __END_DECLS
45 
46 #ifndef __NO_INLINES
47 
48 #undef	__INLINE
49 #ifndef __NO_INLINES_BUT_EMIT_CODE
50 #define	__INLINE	extern inline
51 #else
52 #define	__INLINE
53 #endif
54 
55 /* standard functions */
56 #include "kernel/copystr.h"
57 #include "kernel/imax.h"
58 #include "kernel/imin.h"
59 #include "kernel/lmax.h"
60 #include "kernel/lmin.h"
61 #include "kernel/max.h"
62 #include "kernel/min.h"
63 #include "kernel/ulmax.h"
64 #include "kernel/ulmin.h"
65 
66 /* queue functions */
67 #ifdef _QUEUE_H_
68 #include "kernel/insque.h"
69 #include "kernel/remque.h"
70 #endif
71 
72 /* process functions */
73 #ifdef _PROC_H_
74 #include "kernel/copyin.h"
75 #include "kernel/copyin_.h"
76 #include "kernel/copyinstr.h"
77 
78 /* compensate for 386 lack of write-protection from kernel mode(see locore.s). */
79 #if defined(i486)
80 /* 486, Pentium, ... can accept inlines for these */
81 #include "kernel/copyout.h"
82 #include "kernel/copyout_.h"
83 #include "kernel/copyoutstr.h"
84 #else
85 /* minimize complexity for asm versions, since compiler can't optimize them */
86 #define copyout_(p, src, dst, len) \
87 		copyout_ ## len ((int)*src, dst)
88 #endif
89 
90 #include "kernel/remrq.h"
91 #include "kernel/setrq.h"
92 #endif
93 
94 #undef	__INLINE
95 #endif
96