OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [libnetworking/] [sys/] [kernel.h] - Blame information for rev 773

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*-
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
 * $Id: kernel.h,v 1.2 2001-09-27 12:02:00 chris Exp $
43
 */
44
 
45
#ifndef _SYS_KERNEL_H_
46
#define _SYS_KERNEL_H_
47
 
48
/* Global variables for the kernel. */
49
 
50
/* 1.1 */
51
extern long hostid;
52
extern char hostname[MAXHOSTNAMELEN];
53
extern int hostnamelen;
54
extern char domainname[MAXHOSTNAMELEN];
55
extern int domainnamelen;
56
extern char kernelname[MAXPATHLEN];
57
 
58
/* 1.2 */
59
extern volatile struct timeval mono_time;
60
extern struct timeval boottime;
61
extern struct timeval runtime;
62
/* extern volatile struct timeval time; */
63
extern struct timezone tz;                      /* XXX */
64
 
65
extern int tick;                        /* usec per tick (1000000 / hz) */
66
extern int hz;                          /* system clock's frequency */
67
extern int psratio;                     /* ratio: prof / stat */
68
extern int stathz;                      /* statistics clock's frequency */
69
extern int profhz;                      /* profiling clock's frequency */
70
extern int ticks;
71
extern int lbolt;                       /* once a second sleep address */
72
extern int tickdelta;
73
extern long timedelta;
74
 
75
/*
76
 * The following macros are used to declare global sets of objects, which
77
 * are collected by the linker into a `struct linker_set' as defined below.
78
 *
79
 * NB: the constants defined below must match those defined in
80
 * ld/ld.h.  Since their calculation requires arithmetic, we
81
 * can't name them symbolically (e.g., 23 is N_SETT | N_EXT).
82
 */
83
#define MAKE_SET(set, sym, type)
84
#define TEXT_SET(set, sym) MAKE_SET(set, sym, 23)
85
#define DATA_SET(set, sym) MAKE_SET(set, sym, 25)
86
#define BSS_SET(set, sym)  MAKE_SET(set, sym, 27)
87
#define ABS_SET(set, sym)  MAKE_SET(set, sym, 21)
88
 
89
 
90
/*
91
 * Enumerated types for known system startup interfaces.
92
 *
93
 * Startup occurs in ascending numeric order; the list entries are
94
 * sorted prior to attempting startup to guarantee order.  Items
95
 * of the same level are arbitrated for order based on the 'order'
96
 * element.
97
 *
98
 * These numbers are arbitrary and are chosen ONLY for ordering; the
99
 * enumeration values are explicit rather than implicit to provide
100
 * for binary compatibility with inserted elements.
101
 *
102
 * The SI_SUB_RUN_SCHEDULER value must have the highest lexical value.
103
 *
104
 * The SI_SUB_CONSOLE and SI_SUB_SWAP values represent values used by
105
 * the BSD 4.4Lite but not by FreeBSD; they are maintained in dependent
106
 * order to support porting.
107
 *
108
 * The SI_SUB_PROTO_BEGIN and SI_SUB_PROTO_END bracket a range of
109
 * initializations to take place at splimp().  This is a historical
110
 * wart that should be removed -- probably running everything at
111
 * splimp() until the first init that doesn't want it is the correct
112
 * fix.  They are currently present to ensure historical behavior.
113
 */
114
enum sysinit_sub_id {
115
        SI_SUB_DUMMY            = 0x00000000,   /* not executed; for linker*/
116
        SI_SUB_CONSOLE          = 0x08000000,   /* console*/
117
        SI_SUB_COPYRIGHT        = 0x08000001,   /* first use of console*/
118
        SI_SUB_VM               = 0x10000000,   /* virtual memory system init*/
119
        SI_SUB_KMEM             = 0x18000000,   /* kernel memory*/
120
        SI_SUB_CPU              = 0x20000000,   /* CPU resource(s)*/
121
        SI_SUB_DEVFS            = 0x22000000,   /* get DEVFS ready */
122
        SI_SUB_DRIVERS          = 0x23000000,   /* Let Drivers initialize */
123
        SI_SUB_CONFIGURE        = 0x24000000,   /* Configure devices */
124
        SI_SUB_INTRINSIC        = 0x28000000,   /* proc 0*/
125
        SI_SUB_RUN_QUEUE        = 0x30000000,   /* the run queue*/
126
        SI_SUB_VM_CONF          = 0x38000000,   /* config VM, set limits*/
127
        SI_SUB_VFS              = 0x40000000,   /* virtual file system*/
128
        SI_SUB_CLOCKS           = 0x48000000,   /* real time and stat clocks*/
129
        SI_SUB_MBUF             = 0x50000000,   /* mbufs*/
130
        SI_SUB_CLIST            = 0x58000000,   /* clists*/
131
        SI_SUB_SYSV_SHM         = 0x64000000,   /* System V shared memory*/
132
        SI_SUB_SYSV_SEM         = 0x68000000,   /* System V semaphores*/
133
        SI_SUB_SYSV_MSG         = 0x6C000000,   /* System V message queues*/
134
        SI_SUB_PSEUDO           = 0x70000000,   /* pseudo devices*/
135
        SI_SUB_PROTO_BEGIN      = 0x80000000,   /* XXX: set splimp (kludge)*/
136
        SI_SUB_PROTO_IF         = 0x84000000,   /* interfaces*/
137
        SI_SUB_PROTO_DOMAIN     = 0x88000000,   /* domains (address families?)*/
138
        SI_SUB_PROTO_END        = 0x8fffffff,   /* XXX: set splx (kludge)*/
139
        SI_SUB_KPROF            = 0x90000000,   /* kernel profiling*/
140
        SI_SUB_KICK_SCHEDULER   = 0xa0000000,   /* start the timeout events*/
141
        SI_SUB_ROOT             = 0xb0000000,   /* root mount*/
142
        SI_SUB_ROOT_FDTAB       = 0xb8000000,   /* root vnode in fd table...*/
143
        SI_SUB_SWAP             = 0xc0000000,   /* swap*/
144
        SI_SUB_INTRINSIC_POST   = 0xd0000000,   /* proc 0 cleanup*/
145
        SI_SUB_KTHREAD_INIT     = 0xe0000000,   /* init process*/
146
        SI_SUB_KTHREAD_PAGE     = 0xe4000000,   /* pageout daemon*/
147
        SI_SUB_KTHREAD_VM       = 0xe8000000,   /* vm daemon*/
148
        SI_SUB_KTHREAD_UPDATE   = 0xec000000,   /* update daemon*/
149
        SI_SUB_RUN_SCHEDULER    = 0xffffffff    /* scheduler: no return*/
150
};
151
 
152
 
153
/*
154
 * Some enumerated orders; "ANY" sorts last.
155
 */
156
enum sysinit_elem_order {
157
        SI_ORDER_FIRST          = 0x00000000,   /* first*/
158
        SI_ORDER_SECOND         = 0x00000001,   /* second*/
159
        SI_ORDER_THIRD          = 0x00000002,   /* third*/
160
        SI_ORDER_MIDDLE         = 0x10000000,   /* somewhere in the middle */
161
        SI_ORDER_ANY            = 0xffffffff    /* last*/
162
};
163
 
164
 
165
/*
166
 * System initialization call types; currently two are supported... one
167
 * to do a simple function call and one to cause a process to be started
168
 * by the kernel on the callers behalf.
169
 */
170
typedef enum sysinit_elem_type {
171
        SI_TYPE_DEFAULT         = 0x00000000,   /* No special processing*/
172
        SI_TYPE_KTHREAD         = 0x00000001    /* start kernel thread*/
173
} si_elem_t;
174
 
175
 
176
/*
177
 * A system initialization call instance
178
 *
179
 * The subsystem
180
 */
181
struct sysinit {
182
        unsigned int    subsystem;              /* subsystem identifier*/
183
        unsigned int    order;                  /* init order within subsystem*/
184
        void            (*func) __P((void *));  /* init function*/
185
        void            *udata;                 /* multiplexer/argument */
186
        si_elem_t       type;                   /* sysinit_elem_type*/
187
};
188
 
189
 
190
/*
191
 * Default: no special processing
192
 */
193
#define SYSINIT(uniquifier, subsystem, order, func, ident)      
194
 
195
/*
196
 * Call 'fork()' before calling '(*func)(ident)';
197
 * for making a kernel 'thread' (or builtin process.)
198
 */
199
#define SYSINIT_KT(uniquifier, subsystem, order, func, ident)
200
 
201
 
202
/*
203
 * A kernel process descriptor; used to start "internal" daemons
204
 *
205
 * Note: global_procpp may be NULL for no global save area
206
 */
207
struct kproc_desc {
208
        char            *arg0;                  /* arg 0 (for 'ps' listing)*/
209
        void            (*func) __P((void));    /* "main" for kernel process*/
210
        struct proc     **global_procpp;        /* ptr to proc ptr save area*/
211
};
212
 
213
void    kproc_start __P((void *udata));
214
 
215
#ifdef PSEUDO_LKM
216
#include <sys/conf.h>
217
#include <sys/exec.h>
218
#include <sys/sysent.h>
219
#include <sys/lkm.h>
220
 
221
#define PSEUDO_SET(init, name) \
222
        extern struct linker_set MODVNOPS; \
223
        MOD_MISC(name); \
224
        static int \
225
        name ## _load(struct lkm_table *lkmtp, int cmd) \
226
                { init((void *)NULL /* XXX unused (?) */); return 0; } \
227
        static int \
228
        name ## _unload(struct lkm_table *lkmtp, int cmd) \
229
                { return EINVAL; } \
230
        int \
231
        name ## _mod(struct lkm_table *lkmtp, int cmd, int ver) { \
232
                DISPATCH(lkmtp, cmd, ver, name ## _load, name ## _unload, \
233
                         lkm_nullcmd); }
234
#else /* PSEUDO_LKM */
235
 
236
/*
237
 * Compatibility.  To be deprecated after LKM is updated.
238
 */
239
#define PSEUDO_SET(sym, name)   SYSINIT(ps, SI_SUB_PSEUDO, SI_ORDER_ANY, sym, 0)
240
 
241
#endif /* PSEUDO_LKM */
242
 
243
struct linker_set {
244
        int             ls_length;
245
        const void      *ls_items[1];           /* really ls_length of them,
246
                                                 * trailing NULL */
247
};
248
 
249
extern struct linker_set execsw_set;
250
 
251
#endif /* !_SYS_KERNEL_H_*/

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.