1 | /*- |
---|
2 | * Copyright (c) 1982, 1988, 1991, 1993 |
---|
3 | * The Regents of the University of California. All rights reserved. |
---|
4 | * (c) UNIX System Laboratories, Inc. |
---|
5 | * All or some portions of this file are derived from material licensed |
---|
6 | * to the University of California by American Telephone and Telegraph |
---|
7 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with |
---|
8 | * the permission of UNIX System Laboratories, Inc. |
---|
9 | * |
---|
10 | * Redistribution and use in source and binary forms, with or without |
---|
11 | * modification, are permitted provided that the following conditions |
---|
12 | * are met: |
---|
13 | * 1. Redistributions of source code must retain the above copyright |
---|
14 | * notice, this list of conditions and the following disclaimer. |
---|
15 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
16 | * notice, this list of conditions and the following disclaimer in the |
---|
17 | * documentation and/or other materials provided with the distribution. |
---|
18 | * 3. All advertising materials mentioning features or use of this software |
---|
19 | * must display the following acknowledgement: |
---|
20 | * This product includes software developed by the University of |
---|
21 | * California, Berkeley and its contributors. |
---|
22 | * 4. Neither the name of the University nor the names of its contributors |
---|
23 | * may be used to endorse or promote products derived from this software |
---|
24 | * without specific prior written permission. |
---|
25 | * |
---|
26 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
---|
27 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
28 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
29 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
---|
30 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
---|
31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
---|
32 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
---|
33 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
---|
34 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
---|
35 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
---|
36 | * SUCH DAMAGE. |
---|
37 | * |
---|
38 | * @(#)systm.h 8.7 (Berkeley) 3/29/95 |
---|
39 | * $Id$ |
---|
40 | */ |
---|
41 | |
---|
42 | #ifndef _SYS_SYSTM_H_ |
---|
43 | #define _SYS_SYSTM_H_ |
---|
44 | |
---|
45 | #include <rtems/rtems_bsdnet_internal.h> /* for __BSD_VA_LIST__ */ |
---|
46 | #include <machine/cpufunc.h> |
---|
47 | |
---|
48 | extern int securelevel; /* system security level (see init(8)) */ |
---|
49 | |
---|
50 | extern int cold; /* nonzero if we are doing a cold boot */ |
---|
51 | extern const char *panicstr; /* panic message */ |
---|
52 | extern char version[]; /* system version */ |
---|
53 | extern char copyright[]; /* system copyright */ |
---|
54 | |
---|
55 | extern int selwait; /* select timeout address */ |
---|
56 | |
---|
57 | extern u_char curpriority; /* priority of current process */ |
---|
58 | |
---|
59 | extern int physmem; /* physical memory */ |
---|
60 | |
---|
61 | extern dev_t dumpdev; /* dump device */ |
---|
62 | extern long dumplo; /* offset into dumpdev */ |
---|
63 | |
---|
64 | extern dev_t rootdev; /* root device */ |
---|
65 | extern struct vnode *rootvp; /* vnode equivalent to above */ |
---|
66 | |
---|
67 | extern dev_t swapdev; /* swapping device */ |
---|
68 | extern struct vnode *swapdev_vp;/* vnode equivalent to above */ |
---|
69 | |
---|
70 | extern int boothowto; /* reboot flags, from console subsystem */ |
---|
71 | extern int bootverbose; /* nonzero to print verbose messages */ |
---|
72 | |
---|
73 | /* |
---|
74 | * General function declarations. |
---|
75 | */ |
---|
76 | void Debugger(const char *msg); |
---|
77 | int nullop(void); |
---|
78 | int eopnotsupp(void); |
---|
79 | int einval(void); |
---|
80 | int seltrue(dev_t dev, int which, struct proc *p); |
---|
81 | int ureadc(int, struct uio *); |
---|
82 | void *hashinit(int count, int type, u_long *hashmask); |
---|
83 | void *phashinit(int count, int type, u_long *nentries); |
---|
84 | |
---|
85 | void panic(const char *, ...) __dead2; |
---|
86 | void boot(int) __dead2; |
---|
87 | void cpu_boot(int); |
---|
88 | void tablefull(const char *); |
---|
89 | int addlog(const char *, ...); |
---|
90 | int kvprintf(char const *, void (*)(int, void*), void *, int, |
---|
91 | _BSD_VA_LIST_); |
---|
92 | void log(int, const char *, ...); |
---|
93 | int printf(const char *, ...); |
---|
94 | int sprintf(char *buf, const char *, ...); |
---|
95 | void uprintf(const char *, ...); |
---|
96 | void ttyprintf(struct tty *, const char *, ...); |
---|
97 | |
---|
98 | #define bcopy(f,t,n) memcpy((t),(f),(n)) |
---|
99 | #define bzero(p,n) memset((p),(0),(n)) |
---|
100 | |
---|
101 | int copystr(const void *kfaddr, void *kdaddr, size_t len, |
---|
102 | size_t *lencopied); |
---|
103 | int copyinstr(const void *udaddr, void *kaddr, size_t len, |
---|
104 | size_t *lencopied); |
---|
105 | #ifndef __rtems__ |
---|
106 | /* FIXME: these clash with defines in rtems_bsdnet_internal.h */ |
---|
107 | int copyin(const void *udaddr, void *kaddr, size_t len); |
---|
108 | int copyout(const void *kaddr, void *udaddr, size_t len); |
---|
109 | #endif |
---|
110 | |
---|
111 | int fubyte(const void *base); |
---|
112 | int fuibyte(const void *base); |
---|
113 | int subyte(void *base, int byte); |
---|
114 | int suibyte(void *base, int byte); |
---|
115 | int fuword(const void *base); |
---|
116 | int suword(void *base, int word); |
---|
117 | int susword(void *base, int word); |
---|
118 | |
---|
119 | int hzto(struct timeval *tv); |
---|
120 | void realitexpire(void *); |
---|
121 | |
---|
122 | struct clockframe; |
---|
123 | void hardclock(struct clockframe *frame); |
---|
124 | void softclock(void); |
---|
125 | void statclock(struct clockframe *frame); |
---|
126 | |
---|
127 | void startprofclock(struct proc *); |
---|
128 | void stopprofclock(struct proc *); |
---|
129 | void setstatclockrate(int hzrate); |
---|
130 | |
---|
131 | void hardupdate(long); |
---|
132 | void hardpps(struct timeval *tvp, long usec); |
---|
133 | |
---|
134 | #include <sys/libkern.h> |
---|
135 | |
---|
136 | /* Initialize the world */ |
---|
137 | extern void consinit(void); |
---|
138 | extern void usrinfoinit(void); |
---|
139 | extern void cpu_initclocks(void); |
---|
140 | extern void vntblinit(void); |
---|
141 | extern void nchinit(void); |
---|
142 | |
---|
143 | /* Finalize the world. */ |
---|
144 | void shutdown_nice(void); |
---|
145 | |
---|
146 | /* |
---|
147 | * Kernel to clock driver interface. |
---|
148 | */ |
---|
149 | void inittodr(time_t base); |
---|
150 | void resettodr(void); |
---|
151 | void startrtclock(void); |
---|
152 | |
---|
153 | /* Timeouts */ |
---|
154 | typedef void (timeout_t)(void *); /* actual timeout function type */ |
---|
155 | typedef timeout_t *timeout_func_t; /* a pointer to this type */ |
---|
156 | |
---|
157 | void timeout(timeout_func_t, void *, int); |
---|
158 | void untimeout(timeout_func_t, void *); |
---|
159 | void logwakeup(void); |
---|
160 | |
---|
161 | /* Various other callout lists that modules might want to know about */ |
---|
162 | /* shutdown callout list definitions */ |
---|
163 | typedef void (*bootlist_fn)(int,void *); |
---|
164 | int at_shutdown(bootlist_fn function, void *arg, int); |
---|
165 | int rm_at_shutdown(bootlist_fn function, void *arg); |
---|
166 | #define SHUTDOWN_PRE_SYNC 0 |
---|
167 | #define SHUTDOWN_POST_SYNC 1 |
---|
168 | |
---|
169 | /* forking */ /* XXX not yet */ |
---|
170 | typedef void (*forklist_fn)(struct proc *parent,struct proc *child,int flags); |
---|
171 | int at_fork(forklist_fn function); |
---|
172 | int rm_at_fork(forklist_fn function); |
---|
173 | |
---|
174 | /* exiting */ |
---|
175 | typedef void (*exitlist_fn)(struct proc *procp); |
---|
176 | int at_exit(exitlist_fn function); |
---|
177 | int rm_at_exit(exitlist_fn function); |
---|
178 | |
---|
179 | /* Not exactly a callout LIST, but a callout entry.. */ |
---|
180 | /* Allow an external module to define a hardware watchdog tickler */ |
---|
181 | /* Normally a process would do this, but there are times when the */ |
---|
182 | /* kernel needs to be able to hold off the watchdog, when the process */ |
---|
183 | /* is not active, e.g. when dumping core. Costs us a whole 4 bytes to */ |
---|
184 | /* make this generic. the variable is in kern_shutdown.c */ |
---|
185 | typedef void (*watchdog_tickle_fn)(void); |
---|
186 | extern watchdog_tickle_fn wdog_tickler; |
---|
187 | |
---|
188 | |
---|
189 | /* |
---|
190 | * Common `proc' functions are declared here so that proc.h can be included |
---|
191 | * less often. |
---|
192 | */ |
---|
193 | int tsleep(void *chan, int pri, char *wmesg, int timo); |
---|
194 | void wakeup(void *chan); |
---|
195 | |
---|
196 | #endif /* !_SYS_SYSTM_H_ */ |
---|