RTEMS CPU Kit with SuperCore  4.11.3
kernel.h
Go to the documentation of this file.
1 /*-
2  * Copyright (c) 1995 Terrence R. Lambert
3  * All rights reserved.
4  *
5  * Copyright (c) 1990, 1993
6  * The Regents of the University of California. All rights reserved.
7  * (c) UNIX System Laboratories, Inc.
8  * All or some portions of this file are derived from material licensed
9  * to the University of California by American Telephone and Telegraph
10  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
11  * the permission of UNIX System Laboratories, Inc.
12  *
13  * Redistribution and use in source and binary forms, with or without
14  * modification, are permitted provided that the following conditions
15  * are met:
16  * 1. Redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer.
18  * 2. Redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution.
21  * 3. All advertising materials mentioning features or use of this software
22  * must display the following acknowledgement:
23  * This product includes software developed by the University of
24  * California, Berkeley and its contributors.
25  * 4. Neither the name of the University nor the names of its contributors
26  * may be used to endorse or promote products derived from this software
27  * without specific prior written permission.
28  *
29  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
30  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32  * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
33  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39  * SUCH DAMAGE.
40  *
41  * @(#)kernel.h 8.3 (Berkeley) 1/21/94
42  */
43 
44 #ifndef _SYS_KERNEL_H_
45 #define _SYS_KERNEL_H_
46 
47 #include <sys/linker_set.h>
48 
49 #ifdef _KERNEL
50 
51 /* Global variables for the kernel. */
52 
53 /* 1.1 */
54 extern long hostid;
55 extern char hostname[MAXHOSTNAMELEN];
56 extern char domainname[MAXHOSTNAMELEN];
57 extern char kernelname[MAXPATHLEN];
58 
59 /* 1.2 */
60 extern volatile struct timeval mono_time;
61 extern struct timeval boottime;
62 extern struct timeval runtime;
63 /* extern volatile struct timeval time; */
64 extern struct timezone tz; /* XXX */
65 
66 extern int tick; /* usec per tick (1000000 / hz) */
67 extern int hz; /* system clock's frequency */
68 extern int psratio; /* ratio: prof / stat */
69 extern int stathz; /* statistics clock's frequency */
70 extern int profhz; /* profiling clock's frequency */
71 extern int ticks;
72 
73 #endif /* _KERNEL */
74 
75 /*
76  * Enumerated types for known system startup interfaces.
77  *
78  * Startup occurs in ascending numeric order; the list entries are
79  * sorted prior to attempting startup to guarantee order. Items
80  * of the same level are arbitrated for order based on the 'order'
81  * element.
82  *
83  * These numbers are arbitrary and are chosen ONLY for ordering; the
84  * enumeration values are explicit rather than implicit to provide
85  * for binary compatibility with inserted elements.
86  *
87  * The SI_SUB_RUN_SCHEDULER value must have the highest lexical value.
88  *
89  * The SI_SUB_CONSOLE and SI_SUB_SWAP values represent values used by
90  * the BSD 4.4Lite but not by FreeBSD; they are maintained in dependent
91  * order to support porting.
92  *
93  * The SI_SUB_PROTO_BEGIN and SI_SUB_PROTO_END bracket a range of
94  * initializations to take place at splimp(). This is a historical
95  * wart that should be removed -- probably running everything at
96  * splimp() until the first init that doesn't want it is the correct
97  * fix. They are currently present to ensure historical behavior.
98  */
99 enum sysinit_sub_id {
100  SI_SUB_DUMMY = 0x00000000, /* not executed; for linker*/
101  SI_SUB_CONSOLE = 0x08000000, /* console*/
102  SI_SUB_COPYRIGHT = 0x08000001, /* first use of console*/
103  SI_SUB_VM = 0x10000000, /* virtual memory system init*/
104  SI_SUB_KMEM = 0x18000000, /* kernel memory*/
105  SI_SUB_CPU = 0x20000000, /* CPU resource(s)*/
106  SI_SUB_DEVFS = 0x22000000, /* get DEVFS ready */
107  SI_SUB_DRIVERS = 0x23000000, /* Let Drivers initialize */
108  SI_SUB_CONFIGURE = 0x24000000, /* Configure devices */
109  SI_SUB_INTRINSIC = 0x28000000, /* proc 0*/
110  SI_SUB_RUN_QUEUE = 0x30000000, /* the run queue*/
111  SI_SUB_VM_CONF = 0x38000000, /* config VM, set limits*/
112  SI_SUB_VFS = 0x40000000, /* virtual file system*/
113  SI_SUB_CLOCKS = 0x48000000, /* real time and stat clocks*/
114  SI_SUB_MBUF = 0x50000000, /* mbufs*/
115  SI_SUB_CLIST = 0x58000000, /* clists*/
116  SI_SUB_SYSV_SHM = 0x64000000, /* System V shared memory*/
117  SI_SUB_SYSV_SEM = 0x68000000, /* System V semaphores*/
118  SI_SUB_SYSV_MSG = 0x6C000000, /* System V message queues*/
119  SI_SUB_PSEUDO = 0x70000000, /* pseudo devices*/
120  SI_SUB_PROTO_BEGIN = 0x80000000, /* XXX: set splimp (kludge)*/
121  SI_SUB_PROTO_IF = 0x84000000, /* interfaces*/
122  SI_SUB_PROTO_DOMAIN = 0x88000000, /* domains (address families?)*/
123  SI_SUB_PROTO_END = 0x8fffffff, /* XXX: set splx (kludge)*/
124  SI_SUB_KPROF = 0x90000000, /* kernel profiling*/
125  SI_SUB_KICK_SCHEDULER = 0xa0000000, /* start the timeout events*/
126  SI_SUB_ROOT = 0xb0000000, /* root mount*/
127  SI_SUB_ROOT_FDTAB = 0xb8000000, /* root vnode in fd table...*/
128  SI_SUB_SWAP = 0xc0000000, /* swap*/
129  SI_SUB_INTRINSIC_POST = 0xd0000000, /* proc 0 cleanup*/
130  SI_SUB_KTHREAD_INIT = 0xe0000000, /* init process*/
131  SI_SUB_KTHREAD_PAGE = 0xe4000000, /* pageout daemon*/
132  SI_SUB_KTHREAD_VM = 0xe8000000, /* vm daemon*/
133  SI_SUB_KTHREAD_UPDATE = 0xec000000, /* update daemon*/
134  SI_SUB_RUN_SCHEDULER = 0xffffffff /* scheduler: no return*/
135 };
136 
137 
138 /*
139  * Some enumerated orders; "ANY" sorts last.
140  */
141 enum sysinit_elem_order {
142  SI_ORDER_FIRST = 0x00000000, /* first*/
143  SI_ORDER_SECOND = 0x00000001, /* second*/
144  SI_ORDER_THIRD = 0x00000002, /* third*/
145  SI_ORDER_MIDDLE = 0x10000000, /* somewhere in the middle */
146  SI_ORDER_ANY = 0xffffffff /* last*/
147 };
148 
149 
150 /*
151  * A system initialization call instance
152  *
153  * The subsystem
154  */
155 struct sysinit {
156  unsigned int subsystem; /* subsystem identifier*/
157  unsigned int order; /* init order within subsystem*/
158  void (*func)(void *); /* init function*/
159  void *udata; /* multiplexer/argument */
160 };
161 
162 
163 /*
164  * Default: no special processing
165  */
166 #define SYSINIT(uniquifier, subsystem, order, func, ident)
167 
168 /*
169  * Call 'fork()' before calling '(*func)(ident)';
170  * for making a kernel 'thread' (or builtin process.)
171  */
172 #define SYSINIT_KT(uniquifier, subsystem, order, func, ident)
173 
174 
175 /*
176  * A kernel process descriptor; used to start "internal" daemons
177  *
178  * Note: global_procpp may be NULL for no global save area
179  */
180 struct kproc_desc {
181  char *arg0; /* arg 0 (for 'ps' listing)*/
182  void (*func)(void); /* "main" for kernel process*/
183  struct proc **global_procpp; /* ptr to proc ptr save area*/
184 };
185 
186 void kproc_start(void *udata);
187 
188 #endif /* !_SYS_KERNEL_H_*/
Definition: kernel.h:181
Definition: proc.h:5
Definition: kernel.h:156