Sources of kernel config utility imported from LiteBSD.
This commit is contained in:
12
tools/kconfig/Makefile
Normal file
12
tools/kconfig/Makefile
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# @(#)Makefile 8.1 (Berkeley) 6/6/93
|
||||||
|
|
||||||
|
PROG= config
|
||||||
|
CFLAGS+=-I. -I${.CURDIR}
|
||||||
|
SRCS= config.c main.c lang.c mkioconf.c mkmakefile.c mkglue.c mkheaders.c \
|
||||||
|
mkswapconf.c
|
||||||
|
MAN8= config.0
|
||||||
|
DPADD= ${LIBL}
|
||||||
|
LDADD= -ll
|
||||||
|
CLEANFILES+=y.tab.h lang.c config.c y.tab.c config.0
|
||||||
|
|
||||||
|
.include <local.prog.mk>
|
||||||
174
tools/kconfig/config.8
Normal file
174
tools/kconfig/config.8
Normal file
@@ -0,0 +1,174 @@
|
|||||||
|
.\" Copyright (c) 1980, 1991, 1993
|
||||||
|
.\" The Regents of the University of California. All rights reserved.
|
||||||
|
.\"
|
||||||
|
.\" Redistribution and use in source and binary forms, with or without
|
||||||
|
.\" modification, are permitted provided that the following conditions
|
||||||
|
.\" are met:
|
||||||
|
.\" 1. Redistributions of source code must retain the above copyright
|
||||||
|
.\" notice, this list of conditions and the following disclaimer.
|
||||||
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
.\" notice, this list of conditions and the following disclaimer in the
|
||||||
|
.\" documentation and/or other materials provided with the distribution.
|
||||||
|
.\" 3. All advertising materials mentioning features or use of this software
|
||||||
|
.\" must display the following acknowledgement:
|
||||||
|
.\" This product includes software developed by the University of
|
||||||
|
.\" California, Berkeley and its contributors.
|
||||||
|
.\" 4. Neither the name of the University nor the names of its contributors
|
||||||
|
.\" may be used to endorse or promote products derived from this software
|
||||||
|
.\" without specific prior written permission.
|
||||||
|
.\"
|
||||||
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||||
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
.\" SUCH DAMAGE.
|
||||||
|
.\"
|
||||||
|
.\" @(#)config.8 8.2 (Berkeley) 4/19/94
|
||||||
|
.\"
|
||||||
|
.Dd April 19, 1994
|
||||||
|
.Dt CONFIG 8
|
||||||
|
.Os BSD 4
|
||||||
|
.Sh NAME
|
||||||
|
.Nm config
|
||||||
|
.Nd build system configuration files
|
||||||
|
.Sh SYNOPSIS
|
||||||
|
.Nm config
|
||||||
|
.Op Fl p
|
||||||
|
.Ar system_name
|
||||||
|
.Sh DESCRIPTION
|
||||||
|
.Pp
|
||||||
|
This is the old version of the
|
||||||
|
.Nm config
|
||||||
|
program.
|
||||||
|
It understands the old autoconfiguration scheme
|
||||||
|
used on the HP300, DECstation, and derivative platforms.
|
||||||
|
The new version of config is used with the
|
||||||
|
SPARC and i386 platforms.
|
||||||
|
Only the version of
|
||||||
|
.Nm config
|
||||||
|
applicable to the architecture that you are running
|
||||||
|
will be installed on your machine.
|
||||||
|
.Pp
|
||||||
|
.Nm Config
|
||||||
|
builds a set of system configuration files from the file
|
||||||
|
.Ar SYSTEM_NAME
|
||||||
|
which describes
|
||||||
|
the system to configure.
|
||||||
|
A second file
|
||||||
|
tells
|
||||||
|
.Nm config
|
||||||
|
what files are needed to generate a system and
|
||||||
|
can be augmented by configuration specific set of files
|
||||||
|
that give alternate files for a specific machine.
|
||||||
|
(see the
|
||||||
|
.Sx FILES
|
||||||
|
section below)
|
||||||
|
.Pp
|
||||||
|
Available option and operand:
|
||||||
|
.Pp
|
||||||
|
.Bl -tag -width SYSTEM_NAME
|
||||||
|
.It Fl p
|
||||||
|
If the
|
||||||
|
.Fl p
|
||||||
|
option is supplied,
|
||||||
|
.Nm config
|
||||||
|
will configure a system for profiling; for example,
|
||||||
|
.Xr kgmon 8
|
||||||
|
and
|
||||||
|
.Xr gprof 1 .
|
||||||
|
.It Ar SYSTEM_NAME
|
||||||
|
specifies the name of the system configuration file
|
||||||
|
containing device specifications, configuration options
|
||||||
|
and other system parameters for one system configuration.
|
||||||
|
.El
|
||||||
|
.Pp
|
||||||
|
.Nm Config
|
||||||
|
should be run from the
|
||||||
|
.Pa conf
|
||||||
|
subdirectory of the system source (usually
|
||||||
|
.Pa /sys/conf ) .
|
||||||
|
.Nm Config
|
||||||
|
assumes the directory
|
||||||
|
.Pa ../SYSTEM_NAME
|
||||||
|
exists and places all output files there.
|
||||||
|
The output of
|
||||||
|
.Nm config
|
||||||
|
consists of a number of files; for the
|
||||||
|
.Tn VAX ,
|
||||||
|
they are:
|
||||||
|
.Pa ioconf.c ,
|
||||||
|
a description
|
||||||
|
of what I/O devices are attached to the system;
|
||||||
|
.Pa ubglue.s ,
|
||||||
|
a set of interrupt service routines for devices
|
||||||
|
attached to the
|
||||||
|
.Tn UNIBUS ;
|
||||||
|
.Pa ubvec.s ,
|
||||||
|
offsets into a structure used for counting per-device interrupts;
|
||||||
|
.Pa Makefile ,
|
||||||
|
used by
|
||||||
|
.Xr make 1
|
||||||
|
in building the system;
|
||||||
|
header files,
|
||||||
|
definitions of
|
||||||
|
the number of various devices that will be compiled into the system;
|
||||||
|
swap configuration files,
|
||||||
|
definitions for
|
||||||
|
the disk areas to be used for swapping, the root file system,
|
||||||
|
argument processing, and system dumps.
|
||||||
|
.Pp
|
||||||
|
After running
|
||||||
|
.Nm config ,
|
||||||
|
it is necessary to run
|
||||||
|
.Dq Li make depend
|
||||||
|
in the directory where the new makefile
|
||||||
|
was created.
|
||||||
|
.Nm Config
|
||||||
|
prints a reminder of this when it completes.
|
||||||
|
.Pp
|
||||||
|
If any other error messages are produced by
|
||||||
|
.Nm config ,
|
||||||
|
the problems in the configuration file should be corrected and
|
||||||
|
.Nm config
|
||||||
|
should be run again.
|
||||||
|
Attempts to compile a system that had configuration errors
|
||||||
|
are likely to fail.
|
||||||
|
.Sh FILES
|
||||||
|
.Bl -tag -width /sys/conf/Makefile.vax -compact
|
||||||
|
.It Pa /sys/conf/Makefile.vax
|
||||||
|
generic makefile for the
|
||||||
|
.Tn VAX
|
||||||
|
.It Pa /sys/conf/files
|
||||||
|
list of common files system is built from
|
||||||
|
.It Pa /sys/conf/files.vax
|
||||||
|
list of
|
||||||
|
.Tn VAX
|
||||||
|
specific files
|
||||||
|
.It Pa /sys/conf/devices.vax
|
||||||
|
name to major device mapping file for the
|
||||||
|
.Tn VAX
|
||||||
|
.It Pa /sys/conf/files. Ns Em ERNIE
|
||||||
|
list of files specific to
|
||||||
|
.Em ERNIE
|
||||||
|
system
|
||||||
|
.El
|
||||||
|
.Sh SEE ALSO
|
||||||
|
The SYNOPSIS portion of each device in section 4.
|
||||||
|
.Rs
|
||||||
|
.%T "Building 4.3 BSD UNIX System with Config"
|
||||||
|
.Re
|
||||||
|
.sp
|
||||||
|
.Xr config.new 8
|
||||||
|
.Sh BUGS
|
||||||
|
The line numbers reported in error messages are usually off by one.
|
||||||
|
.Sh HISTORY
|
||||||
|
The
|
||||||
|
.Nm
|
||||||
|
command appeared in
|
||||||
|
.Bx 4.1 .
|
||||||
231
tools/kconfig/config.h
Normal file
231
tools/kconfig/config.h
Normal file
@@ -0,0 +1,231 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 1980, 1993
|
||||||
|
* The Regents of the University of California. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
|
* must display the following acknowledgement:
|
||||||
|
* This product includes software developed by the University of
|
||||||
|
* California, Berkeley and its contributors.
|
||||||
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* @(#)config.h 8.1 (Berkeley) 6/6/93
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Config.
|
||||||
|
*/
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#define NODEV ((dev_t)-1)
|
||||||
|
|
||||||
|
struct file_list {
|
||||||
|
struct file_list *f_next;
|
||||||
|
char *f_fn; /* the name */
|
||||||
|
u_char f_type; /* see below */
|
||||||
|
u_char f_flags; /* see below */
|
||||||
|
char *f_special; /* special make rule if present */
|
||||||
|
char *f_needs;
|
||||||
|
/*
|
||||||
|
* Random values:
|
||||||
|
* swap space parameters for swap areas
|
||||||
|
* root device, etc. for system specifications
|
||||||
|
*/
|
||||||
|
union {
|
||||||
|
struct { /* when swap specification */
|
||||||
|
dev_t fuw_swapdev;
|
||||||
|
int fuw_swapsize;
|
||||||
|
int fuw_swapflag;
|
||||||
|
} fuw;
|
||||||
|
struct { /* when system specification */
|
||||||
|
dev_t fus_rootdev;
|
||||||
|
dev_t fus_dumpdev;
|
||||||
|
} fus;
|
||||||
|
struct { /* when component dev specification */
|
||||||
|
dev_t fup_compdev;
|
||||||
|
int fup_compinfo;
|
||||||
|
} fup;
|
||||||
|
} fun;
|
||||||
|
#define f_swapdev fun.fuw.fuw_swapdev
|
||||||
|
#define f_swapsize fun.fuw.fuw_swapsize
|
||||||
|
#define f_swapflag fun.fuw.fuw_swapflag
|
||||||
|
#define f_rootdev fun.fus.fus_rootdev
|
||||||
|
#define f_dumpdev fun.fus.fus_dumpdev
|
||||||
|
#define f_compdev fun.fup.fup_compdev
|
||||||
|
#define f_compinfo fun.fup.fup_compinfo
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Types.
|
||||||
|
*/
|
||||||
|
#define DRIVER 1
|
||||||
|
#define NORMAL 2
|
||||||
|
#define INVISIBLE 3
|
||||||
|
#define PROFILING 4
|
||||||
|
#define SYSTEMSPEC 5
|
||||||
|
#define SWAPSPEC 6
|
||||||
|
#define COMPDEVICE 7
|
||||||
|
#define COMPSPEC 8
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Attributes (flags).
|
||||||
|
*/
|
||||||
|
#define CONFIGDEP 1
|
||||||
|
|
||||||
|
struct idlst {
|
||||||
|
char *id;
|
||||||
|
struct idlst *id_next;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct device {
|
||||||
|
int d_type; /* CONTROLLER, DEVICE, bus adaptor */
|
||||||
|
struct device *d_conn; /* what it is connected to */
|
||||||
|
char *d_name; /* name of device (e.g. rk11) */
|
||||||
|
struct idlst *d_vec; /* interrupt vectors */
|
||||||
|
int d_pri; /* interrupt priority */
|
||||||
|
int d_addr; /* address of csr */
|
||||||
|
int d_unit; /* unit number */
|
||||||
|
int d_drive; /* drive number */
|
||||||
|
int d_slave; /* slave number */
|
||||||
|
#define QUES -1 /* -1 means '?' */
|
||||||
|
#define UNKNOWN -2 /* -2 means not set yet */
|
||||||
|
int d_dk; /* if init 1 set to number for iostat */
|
||||||
|
int d_flags; /* flags for device init */
|
||||||
|
char *d_port; /* io port base manifest constant */
|
||||||
|
int d_portn; /* io port base (if number not manifest) */
|
||||||
|
char *d_mask; /* interrupt mask */
|
||||||
|
int d_maddr; /* io memory base */
|
||||||
|
int d_msize; /* io memory size */
|
||||||
|
int d_drq; /* DMA request */
|
||||||
|
int d_irq; /* interrupt request */
|
||||||
|
struct device *d_next; /* Next one in list */
|
||||||
|
};
|
||||||
|
#define TO_NEXUS (struct device *)-1
|
||||||
|
#define TO_VBA (struct device *)-2
|
||||||
|
|
||||||
|
struct config {
|
||||||
|
char *c_dev;
|
||||||
|
char *s_sysname;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Config has a global notion of which machine type is
|
||||||
|
* being used. It uses the name of the machine in choosing
|
||||||
|
* files and directories. Thus if the name of the machine is ``vax'',
|
||||||
|
* it will build from ``Makefile.vax'' and use ``../vax/inline''
|
||||||
|
* in the makerules, etc.
|
||||||
|
*/
|
||||||
|
int machine;
|
||||||
|
char *machinename;
|
||||||
|
#define MACHINE_VAX 1
|
||||||
|
#define MACHINE_TAHOE 2
|
||||||
|
#define MACHINE_HP300 3
|
||||||
|
#define MACHINE_I386 4
|
||||||
|
#define MACHINE_MIPS 5
|
||||||
|
#define MACHINE_PMAX 6
|
||||||
|
#define MACHINE_LUNA68K 7
|
||||||
|
#define MACHINE_NEWS3400 8
|
||||||
|
#define MACHINE_PIC32 9
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For each machine, a set of CPU's may be specified as supported.
|
||||||
|
* These and the options (below) are put in the C flags in the makefile.
|
||||||
|
*/
|
||||||
|
struct cputype {
|
||||||
|
char *cpu_name;
|
||||||
|
struct cputype *cpu_next;
|
||||||
|
} *cputype;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A set of options may also be specified which are like CPU types,
|
||||||
|
* but which may also specify values for the options.
|
||||||
|
* A separate set of options may be defined for make-style options.
|
||||||
|
*/
|
||||||
|
struct opt {
|
||||||
|
char *op_name;
|
||||||
|
char *op_value;
|
||||||
|
struct opt *op_next;
|
||||||
|
} *opt, *mkopt;
|
||||||
|
|
||||||
|
char *ident;
|
||||||
|
char *ldscript;
|
||||||
|
char *ns();
|
||||||
|
char *tc();
|
||||||
|
char *qu();
|
||||||
|
char *get_word();
|
||||||
|
char *get_quoted_word();
|
||||||
|
char *path();
|
||||||
|
char *raise();
|
||||||
|
|
||||||
|
int do_trace;
|
||||||
|
|
||||||
|
#if MACHINE_VAX
|
||||||
|
int seen_mba, seen_uba;
|
||||||
|
#endif
|
||||||
|
#if MACHINE_TAHOE
|
||||||
|
int seen_vba;
|
||||||
|
#endif
|
||||||
|
#if MACHINE_I386
|
||||||
|
int seen_isa;
|
||||||
|
#endif
|
||||||
|
int seen_cd;
|
||||||
|
|
||||||
|
struct device *connect();
|
||||||
|
struct device *dtab;
|
||||||
|
dev_t nametodev();
|
||||||
|
char *devtoname();
|
||||||
|
|
||||||
|
char errbuf[80];
|
||||||
|
int yyline;
|
||||||
|
|
||||||
|
struct file_list *ftab, *conf_list, **confp, *comp_list, **compp;
|
||||||
|
|
||||||
|
int zone, hadtz;
|
||||||
|
int dst;
|
||||||
|
int hz;
|
||||||
|
int profiling;
|
||||||
|
int debugging;
|
||||||
|
|
||||||
|
int maxusers;
|
||||||
|
|
||||||
|
#define eq(a,b) (!strcmp(a,b))
|
||||||
|
|
||||||
|
void init_dev(register struct device *dp);
|
||||||
|
int yyparse(void);
|
||||||
|
void vax_ioconf(void);
|
||||||
|
void tahoe_ioconf(void);
|
||||||
|
void hp300_ioconf(void);
|
||||||
|
void i386_ioconf(void);
|
||||||
|
void pmax_ioconf(void);
|
||||||
|
void pic32_ioconf(void);
|
||||||
|
void news_ioconf(void);
|
||||||
|
void ubglue(void);
|
||||||
|
void vbglue(void);
|
||||||
|
void hpglue(void);
|
||||||
|
void vector(void);
|
||||||
|
void makefile(void);
|
||||||
|
void headers(void);
|
||||||
|
void swapconf(void);
|
||||||
1121
tools/kconfig/config.y
Normal file
1121
tools/kconfig/config.y
Normal file
File diff suppressed because it is too large
Load Diff
221
tools/kconfig/lang.l
Normal file
221
tools/kconfig/lang.l
Normal file
@@ -0,0 +1,221 @@
|
|||||||
|
%{
|
||||||
|
/*-
|
||||||
|
* Copyright (c) 1980, 1993
|
||||||
|
* The Regents of the University of California. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
|
* must display the following acknowledgement:
|
||||||
|
* This product includes software developed by the University of
|
||||||
|
* California, Berkeley and its contributors.
|
||||||
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* @(#)lang.l 8.1 (Berkeley) 6/6/93
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
#include "y.tab.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#define tprintf if (do_trace) printf
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Key word table
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct kt {
|
||||||
|
char *kt_name;
|
||||||
|
int kt_val;
|
||||||
|
} key_words[] = {
|
||||||
|
{ "and", AND },
|
||||||
|
{ "args", ARGS },
|
||||||
|
{ "at", AT },
|
||||||
|
#if MACHINE_I386
|
||||||
|
{ "bio", BIO },
|
||||||
|
#endif
|
||||||
|
{ "config", CONFIG },
|
||||||
|
{ "controller", CONTROLLER },
|
||||||
|
{ "cpu", CPU },
|
||||||
|
{ "csr", CSR },
|
||||||
|
{ "device", DEVICE },
|
||||||
|
{ "disk", DISK },
|
||||||
|
{ "drive", DRIVE },
|
||||||
|
#if MACHINE_I386
|
||||||
|
{ "drq", DRQ },
|
||||||
|
#endif
|
||||||
|
{ "dst", DST },
|
||||||
|
{ "dumps", DUMPS },
|
||||||
|
{ "flags", FLAGS },
|
||||||
|
{ "hz", HZ },
|
||||||
|
{ "ident", IDENT },
|
||||||
|
{ "interleave", INTERLEAVE },
|
||||||
|
#if MACHINE_I386
|
||||||
|
{ "iomem", IOMEM },
|
||||||
|
{ "iosiz", IOSIZ },
|
||||||
|
{ "irq", IRQ },
|
||||||
|
#endif
|
||||||
|
{ "ldscript", LDSCRIPT },
|
||||||
|
{ "machine", MACHINE },
|
||||||
|
{ "major", MAJOR },
|
||||||
|
{ "makeoptions", MAKEOPTIONS },
|
||||||
|
{ "master", MASTER },
|
||||||
|
{ "maxusers", MAXUSERS },
|
||||||
|
{ "minor", MINOR },
|
||||||
|
#if MACHINE_I386
|
||||||
|
{ "net", NET },
|
||||||
|
#endif
|
||||||
|
{ "nexus", NEXUS },
|
||||||
|
{ "on", ON },
|
||||||
|
{ "options", OPTIONS },
|
||||||
|
#if MACHINE_I386
|
||||||
|
{ "port", PORT },
|
||||||
|
#endif
|
||||||
|
{ "priority", PRIORITY },
|
||||||
|
{ "pseudo-device",PSEUDO_DEVICE },
|
||||||
|
{ "root", ROOT },
|
||||||
|
#if MACHINE_HP300 || MACHINE_LUNA68K
|
||||||
|
{ "scode", NEXUS },
|
||||||
|
#endif
|
||||||
|
{ "sequential", SEQUENTIAL },
|
||||||
|
{ "size", SIZE },
|
||||||
|
{ "slave", SLAVE },
|
||||||
|
{ "swap", SWAP },
|
||||||
|
{ "tape", DEVICE },
|
||||||
|
#if MACHINE_I386
|
||||||
|
{ "tty", TTY },
|
||||||
|
#endif
|
||||||
|
{ "timezone", TIMEZONE },
|
||||||
|
{ "trace", TRACE },
|
||||||
|
{ "vector", VECTOR },
|
||||||
|
{ 0, 0 },
|
||||||
|
};
|
||||||
|
|
||||||
|
int kw_lookup(char *word);
|
||||||
|
int octal(char *str);
|
||||||
|
int hex(char *str);
|
||||||
|
%}
|
||||||
|
WORD [A-Za-z_][-A-Za-z_]*
|
||||||
|
%%
|
||||||
|
{WORD} {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if ((i = kw_lookup(yytext)) == -1)
|
||||||
|
{
|
||||||
|
yylval.str = yytext;
|
||||||
|
tprintf("id(%s) ", yytext);
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
tprintf("(%s) ", yytext);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
\"[^"]+\" {
|
||||||
|
yytext[strlen(yytext)-1] = '\0';
|
||||||
|
yylval.str = yytext + 1;
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
0[0-7]* {
|
||||||
|
yylval.val = octal(yytext);
|
||||||
|
tprintf("#O:%o ", yylval.val);
|
||||||
|
return NUMBER;
|
||||||
|
}
|
||||||
|
0x[0-9a-fA-F]+ {
|
||||||
|
yylval.val = hex(yytext);
|
||||||
|
tprintf("#X:%x ", yylval.val);
|
||||||
|
return NUMBER;
|
||||||
|
}
|
||||||
|
[1-9][0-9]* {
|
||||||
|
yylval.val = atoi(yytext);
|
||||||
|
tprintf("#D:%d ", yylval.val);
|
||||||
|
return NUMBER;
|
||||||
|
}
|
||||||
|
[0-9]"."[0-9]* {
|
||||||
|
double atof();
|
||||||
|
yylval.val = (int) (60 * atof(yytext) + 0.5);
|
||||||
|
return FPNUMBER;
|
||||||
|
}
|
||||||
|
"-" {
|
||||||
|
return MINUS;
|
||||||
|
}
|
||||||
|
"?" {
|
||||||
|
yylval.val = -1;
|
||||||
|
tprintf("? ");
|
||||||
|
return NUMBER;
|
||||||
|
}
|
||||||
|
\n/[ \t] {
|
||||||
|
yyline++;
|
||||||
|
tprintf("\n... ");
|
||||||
|
}
|
||||||
|
\n {
|
||||||
|
yyline++;
|
||||||
|
tprintf("\n");
|
||||||
|
return SEMICOLON;
|
||||||
|
}
|
||||||
|
#.* { /* Ignored (comment) */; }
|
||||||
|
[ \t]* { /* Ignored (white space) */; }
|
||||||
|
";" { return SEMICOLON; }
|
||||||
|
"," { return COMMA; }
|
||||||
|
"=" { return EQUALS; }
|
||||||
|
"@" { return AT; }
|
||||||
|
. { return yytext[0]; }
|
||||||
|
|
||||||
|
%%
|
||||||
|
/*
|
||||||
|
* kw_lookup
|
||||||
|
* Look up a string in the keyword table. Returns a -1 if the
|
||||||
|
* string is not a keyword otherwise it returns the keyword number
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
kw_lookup(word)
|
||||||
|
register char *word;
|
||||||
|
{
|
||||||
|
register struct kt *kp;
|
||||||
|
|
||||||
|
for (kp = key_words; kp->kt_name != 0; kp++)
|
||||||
|
if (eq(word, kp->kt_name))
|
||||||
|
return kp->kt_val;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Number conversion routines
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
octal(str)
|
||||||
|
char *str;
|
||||||
|
{
|
||||||
|
int num;
|
||||||
|
|
||||||
|
(void) sscanf(str, "%o", &num);
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
hex(str)
|
||||||
|
char *str;
|
||||||
|
{
|
||||||
|
int num;
|
||||||
|
|
||||||
|
(void) sscanf(str+2, "%x", &num);
|
||||||
|
return num;
|
||||||
|
}
|
||||||
265
tools/kconfig/main.c
Normal file
265
tools/kconfig/main.c
Normal file
@@ -0,0 +1,265 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 1980, 1993
|
||||||
|
* The Regents of the University of California. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
|
* must display the following acknowledgement:
|
||||||
|
* This product includes software developed by the University of
|
||||||
|
* California, Berkeley and its contributors.
|
||||||
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef lint
|
||||||
|
static char copyright[] =
|
||||||
|
"@(#) Copyright (c) 1980, 1993\n\
|
||||||
|
The Regents of the University of California. All rights reserved.\n";
|
||||||
|
#endif /* not lint */
|
||||||
|
|
||||||
|
#ifndef lint
|
||||||
|
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
|
||||||
|
#endif /* not lint */
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/file.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include "y.tab.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
static char *PREFIX;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Config builds a set of files for building a UNIX
|
||||||
|
* system given a description of the desired system.
|
||||||
|
*/
|
||||||
|
int main(argc, argv)
|
||||||
|
int argc;
|
||||||
|
char **argv;
|
||||||
|
{
|
||||||
|
|
||||||
|
extern char *optarg;
|
||||||
|
extern int optind;
|
||||||
|
struct stat buf;
|
||||||
|
int ch;
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
while ((ch = getopt(argc, argv, "gp")) != EOF)
|
||||||
|
switch (ch) {
|
||||||
|
case 'g':
|
||||||
|
debugging++;
|
||||||
|
break;
|
||||||
|
case 'p':
|
||||||
|
profiling++;
|
||||||
|
break;
|
||||||
|
case '?':
|
||||||
|
default:
|
||||||
|
goto usage;
|
||||||
|
}
|
||||||
|
argc -= optind;
|
||||||
|
argv += optind;
|
||||||
|
|
||||||
|
if (argc != 1) {
|
||||||
|
usage: fputs("usage: config [-gp] sysname\n", stderr);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (freopen(PREFIX = *argv, "r", stdin) == NULL) {
|
||||||
|
fprintf(stderr, "--- PREFIX\n");
|
||||||
|
perror(PREFIX);
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
mkdir("../../compile", 0777);
|
||||||
|
if (stat(p = path((char *)NULL), &buf)) {
|
||||||
|
if (mkdir(p, 0777)) {
|
||||||
|
fprintf(stderr, "--- mkdir path\n");
|
||||||
|
perror(p);
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ((buf.st_mode & S_IFMT) != S_IFDIR) {
|
||||||
|
fprintf(stderr, "config: %s isn't a directory.\n", p);
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
dtab = NULL;
|
||||||
|
confp = &conf_list;
|
||||||
|
compp = &comp_list;
|
||||||
|
if (yyparse())
|
||||||
|
exit(3);
|
||||||
|
switch (machine) {
|
||||||
|
|
||||||
|
case MACHINE_VAX:
|
||||||
|
vax_ioconf(); /* Print ioconf.c */
|
||||||
|
ubglue(); /* Create ubglue.s */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MACHINE_TAHOE:
|
||||||
|
tahoe_ioconf();
|
||||||
|
vbglue();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MACHINE_HP300:
|
||||||
|
case MACHINE_LUNA68K:
|
||||||
|
hp300_ioconf();
|
||||||
|
hpglue();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MACHINE_I386:
|
||||||
|
i386_ioconf(); /* Print ioconf.c */
|
||||||
|
vector(); /* Create vector.s */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MACHINE_MIPS:
|
||||||
|
case MACHINE_PMAX:
|
||||||
|
pmax_ioconf();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MACHINE_PIC32:
|
||||||
|
pic32_ioconf();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MACHINE_NEWS3400:
|
||||||
|
news_ioconf();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
printf("Specify machine type, e.g. ``machine vax''\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
makefile(); /* build Makefile */
|
||||||
|
headers(); /* make a lot of .h files */
|
||||||
|
swapconf(); /* swap config files */
|
||||||
|
printf("Don't forget to run \"make depend\"\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* get_word
|
||||||
|
* returns EOF on end of file
|
||||||
|
* NULL on end of line
|
||||||
|
* pointer to the word otherwise
|
||||||
|
*/
|
||||||
|
char *
|
||||||
|
get_word(fp)
|
||||||
|
register FILE *fp;
|
||||||
|
{
|
||||||
|
static char line[80];
|
||||||
|
register int ch;
|
||||||
|
register char *cp;
|
||||||
|
|
||||||
|
while ((ch = getc(fp)) != EOF)
|
||||||
|
if (ch != ' ' && ch != '\t')
|
||||||
|
break;
|
||||||
|
if (ch == EOF)
|
||||||
|
return ((char *)EOF);
|
||||||
|
if (ch == '\n')
|
||||||
|
return (NULL);
|
||||||
|
cp = line;
|
||||||
|
*cp++ = ch;
|
||||||
|
while ((ch = getc(fp)) != EOF) {
|
||||||
|
if (isspace(ch))
|
||||||
|
break;
|
||||||
|
*cp++ = ch;
|
||||||
|
}
|
||||||
|
*cp = 0;
|
||||||
|
if (ch == EOF)
|
||||||
|
return ((char *)EOF);
|
||||||
|
(void) ungetc(ch, fp);
|
||||||
|
return (line);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* get_quoted_word
|
||||||
|
* like get_word but will accept something in double or single quotes
|
||||||
|
* (to allow embedded spaces).
|
||||||
|
*/
|
||||||
|
char *
|
||||||
|
get_quoted_word(fp)
|
||||||
|
register FILE *fp;
|
||||||
|
{
|
||||||
|
static char line[256];
|
||||||
|
register int ch;
|
||||||
|
register char *cp;
|
||||||
|
|
||||||
|
while ((ch = getc(fp)) != EOF)
|
||||||
|
if (ch != ' ' && ch != '\t')
|
||||||
|
break;
|
||||||
|
if (ch == EOF)
|
||||||
|
return ((char *)EOF);
|
||||||
|
if (ch == '\n')
|
||||||
|
return (NULL);
|
||||||
|
cp = line;
|
||||||
|
if (ch == '"' || ch == '\'') {
|
||||||
|
register int quote = ch;
|
||||||
|
|
||||||
|
while ((ch = getc(fp)) != EOF) {
|
||||||
|
if (ch == quote)
|
||||||
|
break;
|
||||||
|
if (ch == '\n') {
|
||||||
|
*cp = 0;
|
||||||
|
printf("config: missing quote reading `%s'\n",
|
||||||
|
line);
|
||||||
|
exit(2);
|
||||||
|
}
|
||||||
|
*cp++ = ch;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
*cp++ = ch;
|
||||||
|
while ((ch = getc(fp)) != EOF) {
|
||||||
|
if (isspace(ch))
|
||||||
|
break;
|
||||||
|
*cp++ = ch;
|
||||||
|
}
|
||||||
|
if (ch != EOF)
|
||||||
|
(void) ungetc(ch, fp);
|
||||||
|
}
|
||||||
|
*cp = 0;
|
||||||
|
if (ch == EOF)
|
||||||
|
return ((char *)EOF);
|
||||||
|
return (line);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* prepend the path to a filename
|
||||||
|
*/
|
||||||
|
char *
|
||||||
|
path(file)
|
||||||
|
char *file;
|
||||||
|
{
|
||||||
|
register char *cp;
|
||||||
|
|
||||||
|
#define CDIR "../../compile/"
|
||||||
|
cp = malloc((unsigned int)(sizeof(CDIR) + strlen(PREFIX) +
|
||||||
|
(file ? strlen(file) : 0) + 2));
|
||||||
|
(void) strcpy(cp, CDIR);
|
||||||
|
(void) strcat(cp, PREFIX);
|
||||||
|
if (file) {
|
||||||
|
(void) strcat(cp, "/");
|
||||||
|
(void) strcat(cp, file);
|
||||||
|
}
|
||||||
|
return (cp);
|
||||||
|
}
|
||||||
403
tools/kconfig/mkglue.c
Normal file
403
tools/kconfig/mkglue.c
Normal file
@@ -0,0 +1,403 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 1980, 1993
|
||||||
|
* The Regents of the University of California. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
|
* must display the following acknowledgement:
|
||||||
|
* This product includes software developed by the University of
|
||||||
|
* California, Berkeley and its contributors.
|
||||||
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef lint
|
||||||
|
static char sccsid[] = "@(#)mkglue.c 8.1 (Berkeley) 6/6/93";
|
||||||
|
#endif /* not lint */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Make the bus adaptor interrupt glue files.
|
||||||
|
*/
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "config.h"
|
||||||
|
#include "y.tab.h"
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
static int cntcnt = 0; /* number of interrupt counters allocated */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Print a UNIBUS interrupt vector.
|
||||||
|
*/
|
||||||
|
void dump_ubavec(fp, vector, number)
|
||||||
|
register FILE *fp;
|
||||||
|
char *vector;
|
||||||
|
int number;
|
||||||
|
{
|
||||||
|
char nbuf[80];
|
||||||
|
register char *v = nbuf;
|
||||||
|
|
||||||
|
(void) sprintf(v, "%s%d", vector, number);
|
||||||
|
fprintf(fp, "\t.globl\t_X%s\n\t.align\t2\n_X%s:\n\tpushr\t$0x3f\n",
|
||||||
|
v, v);
|
||||||
|
fprintf(fp, "\tincl\t_fltintrcnt+(4*%d)\n", cntcnt++);
|
||||||
|
if (strncmp(vector, "dzx", 3) == 0)
|
||||||
|
fprintf(fp, "\tmovl\t$%d,r0\n\tjmp\tdzdma\n\n", number);
|
||||||
|
else if (strncmp(vector, "dpx", 3) == 0)
|
||||||
|
fprintf(fp, "\tmovl\t$%d,r0\n\tjmp\tdpxdma\n\n", number);
|
||||||
|
else if (strncmp(vector, "dpr", 3) == 0)
|
||||||
|
fprintf(fp, "\tmovl\t$%d,r0\n\tjmp\tdprdma\n\n", number);
|
||||||
|
else {
|
||||||
|
if (strncmp(vector, "uur", 3) == 0) {
|
||||||
|
fprintf(fp, "#ifdef UUDMA\n");
|
||||||
|
fprintf(fp, "\tmovl\t$%d,r0\n\tjsb\tuudma\n", number);
|
||||||
|
fprintf(fp, "#endif\n");
|
||||||
|
}
|
||||||
|
fprintf(fp, "\tpushl\t$%d\n", number);
|
||||||
|
fprintf(fp, "\tcalls\t$1,_%s\n\tpopr\t$0x3f\n", vector);
|
||||||
|
fprintf(fp, "\tincl\t_cnt+V_INTR\n\trei\n\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static char *vaxinames[] = {
|
||||||
|
"clock", "cnr", "cnx", "tur", "tux",
|
||||||
|
"mba0", "mba1", "mba2", "mba3",
|
||||||
|
"uba0", "uba1", "uba2", "uba3"
|
||||||
|
};
|
||||||
|
|
||||||
|
static char *tahoeinames[] = {
|
||||||
|
"clock", "cnr", "cnx", "rmtr", "rmtx", "buserr",
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct stdintrs {
|
||||||
|
char **si_names; /* list of standard interrupt names */
|
||||||
|
int si_n; /* number of such names */
|
||||||
|
} stdintrs[] = {
|
||||||
|
{ vaxinames, sizeof (vaxinames) / sizeof (vaxinames[0]) },
|
||||||
|
{ tahoeinames, (sizeof (tahoeinames) / sizeof (tahoeinames[0])) }
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Start the interrupt name table with the names
|
||||||
|
* of the standard vectors not directly associated
|
||||||
|
* with a bus. Also, dump the defines needed to
|
||||||
|
* reference the associated counters into a separate
|
||||||
|
* file which is prepended to locore.s.
|
||||||
|
*/
|
||||||
|
void dump_std(fp, gp)
|
||||||
|
register FILE *fp, *gp;
|
||||||
|
{
|
||||||
|
register struct stdintrs *si = &stdintrs[machine-1];
|
||||||
|
register char **cpp;
|
||||||
|
register int i;
|
||||||
|
|
||||||
|
fprintf(fp, "\n\t.globl\t_intrnames\n");
|
||||||
|
fprintf(fp, "\n\t.globl\t_eintrnames\n");
|
||||||
|
fprintf(fp, "\t.data\n");
|
||||||
|
fprintf(fp, "_intrnames:\n");
|
||||||
|
cpp = si->si_names;
|
||||||
|
for (i = 0; i < si->si_n; i++) {
|
||||||
|
register char *cp, *tp;
|
||||||
|
char buf[80];
|
||||||
|
|
||||||
|
cp = *cpp;
|
||||||
|
if (cp[0] == 'i' && cp[1] == 'n' && cp[2] == 't') {
|
||||||
|
cp += 3;
|
||||||
|
if (*cp == 'r')
|
||||||
|
cp++;
|
||||||
|
}
|
||||||
|
for (tp = buf; *cp; cp++)
|
||||||
|
if (islower(*cp))
|
||||||
|
*tp++ = toupper(*cp);
|
||||||
|
else
|
||||||
|
*tp++ = *cp;
|
||||||
|
*tp = '\0';
|
||||||
|
fprintf(gp, "#define\tI_%s\t%d\n", buf, i * (int)sizeof (long));
|
||||||
|
fprintf(fp, "\t.asciz\t\"%s\"\n", *cpp);
|
||||||
|
cpp++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void dump_intname(fp, vector, number)
|
||||||
|
register FILE *fp;
|
||||||
|
char *vector;
|
||||||
|
int number;
|
||||||
|
{
|
||||||
|
register char *cp = vector;
|
||||||
|
|
||||||
|
fprintf(fp, "\t.asciz\t\"");
|
||||||
|
/*
|
||||||
|
* Skip any "int" or "intr" in the name.
|
||||||
|
*/
|
||||||
|
while (*cp)
|
||||||
|
if (cp[0] == 'i' && cp[1] == 'n' && cp[2] == 't') {
|
||||||
|
cp += 3;
|
||||||
|
if (*cp == 'r')
|
||||||
|
cp++;
|
||||||
|
} else {
|
||||||
|
putc(*cp, fp);
|
||||||
|
cp++;
|
||||||
|
}
|
||||||
|
fprintf(fp, "%d\"\n", number);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Reserve space for the interrupt counters.
|
||||||
|
*/
|
||||||
|
void dump_ctrs(fp)
|
||||||
|
register FILE *fp;
|
||||||
|
{
|
||||||
|
struct stdintrs *si = &stdintrs[machine-1];
|
||||||
|
|
||||||
|
fprintf(fp, "_eintrnames:\n");
|
||||||
|
fprintf(fp, "\n\t.globl\t_intrcnt\n");
|
||||||
|
fprintf(fp, "\n\t.globl\t_eintrcnt\n");
|
||||||
|
fprintf(fp, "\t.align 2\n");
|
||||||
|
fprintf(fp, "_intrcnt:\n");
|
||||||
|
fprintf(fp, "\t.space\t4 * %d\n", si->si_n);
|
||||||
|
fprintf(fp, "_fltintrcnt:\n");
|
||||||
|
fprintf(fp, "\t.space\t4 * %d\n", cntcnt);
|
||||||
|
fprintf(fp, "_eintrcnt:\n\n");
|
||||||
|
fprintf(fp, "\t.text\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create the UNIBUS interrupt vector glue file.
|
||||||
|
*/
|
||||||
|
void ubglue()
|
||||||
|
{
|
||||||
|
register FILE *fp, *gp;
|
||||||
|
register struct device *dp, *mp;
|
||||||
|
|
||||||
|
fp = fopen(path("ubglue.s"), "w");
|
||||||
|
if (fp == 0) {
|
||||||
|
perror(path("ubglue.s"));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
gp = fopen(path("ubvec.s"), "w");
|
||||||
|
if (gp == 0) {
|
||||||
|
perror(path("ubvec.s"));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
for (dp = dtab; dp != 0; dp = dp->d_next) {
|
||||||
|
mp = dp->d_conn;
|
||||||
|
if (mp != 0 && mp != (struct device *)-1 &&
|
||||||
|
!eq(mp->d_name, "mba")) {
|
||||||
|
struct idlst *id, *id2;
|
||||||
|
|
||||||
|
for (id = dp->d_vec; id; id = id->id_next) {
|
||||||
|
for (id2 = dp->d_vec; id2; id2 = id2->id_next) {
|
||||||
|
if (id2 == id) {
|
||||||
|
dump_ubavec(fp, id->id,
|
||||||
|
dp->d_unit);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!strcmp(id->id, id2->id))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dump_std(fp, gp);
|
||||||
|
for (dp = dtab; dp != 0; dp = dp->d_next) {
|
||||||
|
mp = dp->d_conn;
|
||||||
|
if (mp != 0 && mp != (struct device *)-1 &&
|
||||||
|
!eq(mp->d_name, "mba")) {
|
||||||
|
struct idlst *id, *id2;
|
||||||
|
|
||||||
|
for (id = dp->d_vec; id; id = id->id_next) {
|
||||||
|
for (id2 = dp->d_vec; id2; id2 = id2->id_next) {
|
||||||
|
if (id2 == id) {
|
||||||
|
dump_intname(fp, id->id,
|
||||||
|
dp->d_unit);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!strcmp(id->id, id2->id))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dump_ctrs(fp);
|
||||||
|
(void) fclose(fp);
|
||||||
|
(void) fclose(gp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Print a VERSAbus interrupt vector
|
||||||
|
*/
|
||||||
|
void dump_vbavec(fp, vector, number)
|
||||||
|
register FILE *fp;
|
||||||
|
char *vector;
|
||||||
|
int number;
|
||||||
|
{
|
||||||
|
char nbuf[80];
|
||||||
|
register char *v = nbuf;
|
||||||
|
|
||||||
|
(void) sprintf(v, "%s%d", vector, number);
|
||||||
|
fprintf(fp, "SCBVEC(%s):\n", v);
|
||||||
|
fprintf(fp, "\tCHECK_SFE(4)\n");
|
||||||
|
fprintf(fp, "\tSAVE_FPSTAT(4)\n");
|
||||||
|
fprintf(fp, "\tPUSHR\n");
|
||||||
|
fprintf(fp, "\tincl\t_fltintrcnt+(4*%d)\n", cntcnt++);
|
||||||
|
fprintf(fp, "\tpushl\t$%d\n", number);
|
||||||
|
fprintf(fp, "\tcallf\t$8,_%s\n", vector);
|
||||||
|
fprintf(fp, "\tincl\t_cnt+V_INTR\n");
|
||||||
|
fprintf(fp, "\tPOPR\n");
|
||||||
|
fprintf(fp, "\tREST_FPSTAT\n");
|
||||||
|
fprintf(fp, "\trei\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create the VERSAbus interrupt vector glue file.
|
||||||
|
*/
|
||||||
|
void vbglue()
|
||||||
|
{
|
||||||
|
register FILE *fp, *gp;
|
||||||
|
register struct device *dp, *mp;
|
||||||
|
|
||||||
|
fp = fopen(path("vbglue.s"), "w");
|
||||||
|
if (fp == 0) {
|
||||||
|
perror(path("vbglue.s"));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
gp = fopen(path("vbvec.s"), "w");
|
||||||
|
if (gp == 0) {
|
||||||
|
perror(path("vbvec.s"));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
for (dp = dtab; dp != 0; dp = dp->d_next) {
|
||||||
|
struct idlst *id, *id2;
|
||||||
|
|
||||||
|
mp = dp->d_conn;
|
||||||
|
if (mp == 0 || mp == (struct device *)-1 ||
|
||||||
|
eq(mp->d_name, "mba"))
|
||||||
|
continue;
|
||||||
|
for (id = dp->d_vec; id; id = id->id_next)
|
||||||
|
for (id2 = dp->d_vec; id2; id2 = id2->id_next) {
|
||||||
|
if (id == id2) {
|
||||||
|
dump_vbavec(fp, id->id, dp->d_unit);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (eq(id->id, id2->id))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dump_std(fp, gp);
|
||||||
|
for (dp = dtab; dp != 0; dp = dp->d_next) {
|
||||||
|
mp = dp->d_conn;
|
||||||
|
if (mp != 0 && mp != (struct device *)-1 &&
|
||||||
|
!eq(mp->d_name, "mba")) {
|
||||||
|
struct idlst *id, *id2;
|
||||||
|
|
||||||
|
for (id = dp->d_vec; id; id = id->id_next) {
|
||||||
|
for (id2 = dp->d_vec; id2; id2 = id2->id_next) {
|
||||||
|
if (id2 == id) {
|
||||||
|
dump_intname(fp, id->id,
|
||||||
|
dp->d_unit);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (eq(id->id, id2->id))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dump_ctrs(fp);
|
||||||
|
(void) fclose(fp);
|
||||||
|
(void) fclose(gp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* HP9000/300 interrupts are auto-vectored.
|
||||||
|
* Code is hardwired in locore.s
|
||||||
|
*/
|
||||||
|
void hpglue() {}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create the ISA interrupt vector glue file.
|
||||||
|
*/
|
||||||
|
void vector() {
|
||||||
|
register FILE *fp, *gp;
|
||||||
|
register struct device *dp, *mp;
|
||||||
|
int count;
|
||||||
|
|
||||||
|
fp = fopen(path("vector.s"), "w");
|
||||||
|
if (fp == 0) {
|
||||||
|
perror(path("vector.s"));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
fprintf(fp,"\
|
||||||
|
/*\n\
|
||||||
|
* AT/386\n\
|
||||||
|
* Interrupt vector routines\n\
|
||||||
|
* Generated by config program\n\
|
||||||
|
*/ \n\
|
||||||
|
\n\
|
||||||
|
#include \"i386/isa/isa.h\"\n\
|
||||||
|
#include \"i386/isa/icu.h\"\n\
|
||||||
|
\n\
|
||||||
|
#define VEC(name) .align 4; .globl _V/**/name; _V/**/name:\n\n");
|
||||||
|
|
||||||
|
fprintf(fp,"\
|
||||||
|
.globl _hardclock\n\
|
||||||
|
VEC(clk)\n\
|
||||||
|
INTR1(0, _highmask, 0)\n\
|
||||||
|
call _hardclock \n\
|
||||||
|
INTREXIT1\n\n\n");
|
||||||
|
|
||||||
|
count=0;
|
||||||
|
for (dp = dtab; dp != 0; dp = dp->d_next) {
|
||||||
|
mp = dp->d_conn;
|
||||||
|
if (mp != 0 && /* mp != (struct device *)-1 &&*/
|
||||||
|
eq(mp->d_name, "isa")) {
|
||||||
|
struct idlst *id, *id2;
|
||||||
|
|
||||||
|
for (id = dp->d_vec; id; id = id->id_next) {
|
||||||
|
for (id2 = dp->d_vec; id2; id2 = id2->id_next) {
|
||||||
|
if (id2 == id) {
|
||||||
|
if(dp->d_irq == -1) continue;
|
||||||
|
fprintf(fp,"\t.globl _%s, _%s%dmask\n\t.data\n",
|
||||||
|
id->id, dp->d_name, dp->d_unit);
|
||||||
|
fprintf(fp,"_%s%dmask:\t.long 0\n\t.text\n",
|
||||||
|
dp->d_name, dp->d_unit);
|
||||||
|
fprintf(fp,"VEC(%s%d)\n\tINTR%d(%d, ",
|
||||||
|
dp->d_name, dp->d_unit,
|
||||||
|
dp->d_irq / 8 + 1, dp->d_unit);
|
||||||
|
if(eq(dp->d_mask,"null"))
|
||||||
|
fprintf(fp,"_%s%dmask, ",
|
||||||
|
dp->d_name, dp->d_unit);
|
||||||
|
else
|
||||||
|
fprintf(fp,"_%smask, ",
|
||||||
|
dp->d_mask);
|
||||||
|
fprintf(fp,"%d)\n\tcall\t_%s\n\tINTREXIT%d\n\n\n",
|
||||||
|
++count, id->id, (dp->d_irq > 7)?2:1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!strcmp(id->id, id2->id))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
(void) fclose(fp);
|
||||||
|
}
|
||||||
207
tools/kconfig/mkheaders.c
Normal file
207
tools/kconfig/mkheaders.c
Normal file
@@ -0,0 +1,207 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 1980, 1993
|
||||||
|
* The Regents of the University of California. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
|
* must display the following acknowledgement:
|
||||||
|
* This product includes software developed by the University of
|
||||||
|
* California, Berkeley and its contributors.
|
||||||
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef lint
|
||||||
|
static char sccsid[] = "@(#)mkheaders.c 8.1 (Berkeley) 6/6/93";
|
||||||
|
#endif /* not lint */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Make all the .h files for the optional entries
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include "config.h"
|
||||||
|
#include "y.tab.h"
|
||||||
|
|
||||||
|
void do_header(dev, hname, count)
|
||||||
|
char *dev, *hname;
|
||||||
|
int count;
|
||||||
|
{
|
||||||
|
char *file, *name, *inw, *toheader(), *tomacro();
|
||||||
|
struct file_list *fl, *fl_head, *tflp;
|
||||||
|
FILE *inf, *outf;
|
||||||
|
int inc, oldcount;
|
||||||
|
|
||||||
|
file = toheader(hname);
|
||||||
|
name = tomacro(dev);
|
||||||
|
inf = fopen(file, "r");
|
||||||
|
oldcount = -1;
|
||||||
|
if (inf == 0) {
|
||||||
|
outf = fopen(file, "w");
|
||||||
|
if (outf == 0) {
|
||||||
|
perror(file);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
fprintf(outf, "#define %s %d\n", name, count);
|
||||||
|
(void) fclose(outf);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
fl_head = NULL;
|
||||||
|
for (;;) {
|
||||||
|
char *cp;
|
||||||
|
if ((inw = get_word(inf)) == 0 || inw == (char *)EOF)
|
||||||
|
break;
|
||||||
|
if ((inw = get_word(inf)) == 0 || inw == (char *)EOF)
|
||||||
|
break;
|
||||||
|
inw = ns(inw);
|
||||||
|
cp = get_word(inf);
|
||||||
|
if (cp == 0 || cp == (char *)EOF)
|
||||||
|
break;
|
||||||
|
inc = atoi(cp);
|
||||||
|
if (eq(inw, name)) {
|
||||||
|
oldcount = inc;
|
||||||
|
inc = count;
|
||||||
|
}
|
||||||
|
cp = get_word(inf);
|
||||||
|
if (cp == (char *)EOF)
|
||||||
|
break;
|
||||||
|
fl = (struct file_list *) malloc(sizeof *fl);
|
||||||
|
bzero(fl, sizeof(*fl));
|
||||||
|
fl->f_fn = inw;
|
||||||
|
fl->f_type = inc;
|
||||||
|
fl->f_next = fl_head;
|
||||||
|
fl_head = fl;
|
||||||
|
}
|
||||||
|
(void) fclose(inf);
|
||||||
|
if (count == oldcount) {
|
||||||
|
for (fl = fl_head; fl != NULL; fl = tflp) {
|
||||||
|
tflp = fl->f_next;
|
||||||
|
free(fl);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (oldcount == -1) {
|
||||||
|
fl = (struct file_list *) malloc(sizeof *fl);
|
||||||
|
bzero(fl, sizeof(*fl));
|
||||||
|
fl->f_fn = name;
|
||||||
|
fl->f_type = count;
|
||||||
|
fl->f_next = fl_head;
|
||||||
|
fl_head = fl;
|
||||||
|
}
|
||||||
|
outf = fopen(file, "w");
|
||||||
|
if (outf == 0) {
|
||||||
|
perror(file);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
for (fl = fl_head; fl != NULL; fl = tflp) {
|
||||||
|
fprintf(outf,
|
||||||
|
"#define %s %u\n", fl->f_fn, count ? fl->f_type : 0);
|
||||||
|
tflp = fl->f_next;
|
||||||
|
free(fl);
|
||||||
|
}
|
||||||
|
(void) fclose(outf);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* count all the devices of a certain type and recurse to count
|
||||||
|
* whatever the device is connected to
|
||||||
|
*/
|
||||||
|
void do_count(dev, hname, search)
|
||||||
|
register char *dev, *hname;
|
||||||
|
int search;
|
||||||
|
{
|
||||||
|
register struct device *dp, *mp;
|
||||||
|
register int count, hicount;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* After this loop, "count" will be the actual number of units,
|
||||||
|
* and "hicount" will be the highest unit declared. do_header()
|
||||||
|
* must use this higher of these values.
|
||||||
|
*/
|
||||||
|
for (hicount = count = 0, dp = dtab; dp != 0; dp = dp->d_next)
|
||||||
|
if (dp->d_unit != -1 && eq(dp->d_name, dev)) {
|
||||||
|
if (dp->d_type == PSEUDO_DEVICE) {
|
||||||
|
count =
|
||||||
|
dp->d_slave != UNKNOWN ? dp->d_slave : 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
count++;
|
||||||
|
/*
|
||||||
|
* Allow holes in unit numbering,
|
||||||
|
* assumption is unit numbering starts
|
||||||
|
* at zero.
|
||||||
|
*/
|
||||||
|
if (dp->d_unit + 1 > hicount)
|
||||||
|
hicount = dp->d_unit + 1;
|
||||||
|
if (search) {
|
||||||
|
mp = dp->d_conn;
|
||||||
|
if (mp != 0 && mp != TO_NEXUS &&
|
||||||
|
mp->d_conn != 0 && mp->d_conn != TO_NEXUS) {
|
||||||
|
do_count(mp->d_name, hname, 0);
|
||||||
|
search = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
do_header(dev, hname, count > hicount ? count : hicount);
|
||||||
|
}
|
||||||
|
|
||||||
|
void headers()
|
||||||
|
{
|
||||||
|
register struct file_list *fl;
|
||||||
|
|
||||||
|
for (fl = ftab; fl != 0; fl = fl->f_next)
|
||||||
|
if (fl->f_needs != 0)
|
||||||
|
do_count(fl->f_needs, fl->f_needs, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* convert a dev name to a .h file name
|
||||||
|
*/
|
||||||
|
char *
|
||||||
|
toheader(dev)
|
||||||
|
char *dev;
|
||||||
|
{
|
||||||
|
static char hbuf[80];
|
||||||
|
|
||||||
|
(void) strcpy(hbuf, path(dev));
|
||||||
|
(void) strcat(hbuf, ".h");
|
||||||
|
return (hbuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* convert a dev name to a macro name
|
||||||
|
*/
|
||||||
|
char *tomacro(dev)
|
||||||
|
register char *dev;
|
||||||
|
{
|
||||||
|
static char mbuf[20];
|
||||||
|
register char *cp;
|
||||||
|
|
||||||
|
cp = mbuf;
|
||||||
|
*cp++ = 'N';
|
||||||
|
while (*dev)
|
||||||
|
*cp++ = islower(*dev) ? toupper(*dev++) : *dev++;
|
||||||
|
*cp++ = 0;
|
||||||
|
return (mbuf);
|
||||||
|
}
|
||||||
1154
tools/kconfig/mkioconf.c
Normal file
1154
tools/kconfig/mkioconf.c
Normal file
File diff suppressed because it is too large
Load Diff
628
tools/kconfig/mkmakefile.c
Normal file
628
tools/kconfig/mkmakefile.c
Normal file
@@ -0,0 +1,628 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 1993, 19801990
|
||||||
|
* The Regents of the University of California. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
|
* must display the following acknowledgement:
|
||||||
|
* This product includes software developed by the University of
|
||||||
|
* California, Berkeley and its contributors.
|
||||||
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef lint
|
||||||
|
static char sccsid[] = "@(#)mkmakefile.c 8.1 (Berkeley) 6/6/93";
|
||||||
|
#endif /* not lint */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Build the makefile for the system, from
|
||||||
|
* the information in the files files and the
|
||||||
|
* additional files for the machine being compiled to.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include "y.tab.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#define next_word(fp, wd) \
|
||||||
|
{ register char *word = get_word(fp); \
|
||||||
|
if (word == (char *)EOF) \
|
||||||
|
return; \
|
||||||
|
else \
|
||||||
|
wd = word; \
|
||||||
|
}
|
||||||
|
#define next_quoted_word(fp, wd) \
|
||||||
|
{ register char *word = get_quoted_word(fp); \
|
||||||
|
if (word == (char *)EOF) \
|
||||||
|
return; \
|
||||||
|
else \
|
||||||
|
wd = word; \
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct file_list *fcur;
|
||||||
|
char *tail();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Lookup a file, by name.
|
||||||
|
*/
|
||||||
|
struct file_list *
|
||||||
|
fl_lookup(file)
|
||||||
|
register char *file;
|
||||||
|
{
|
||||||
|
register struct file_list *fp;
|
||||||
|
|
||||||
|
for (fp = ftab ; fp != 0; fp = fp->f_next) {
|
||||||
|
if (eq(fp->f_fn, file))
|
||||||
|
return (fp);
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Lookup a file, by final component name.
|
||||||
|
*/
|
||||||
|
struct file_list *
|
||||||
|
fltail_lookup(file)
|
||||||
|
register char *file;
|
||||||
|
{
|
||||||
|
register struct file_list *fp;
|
||||||
|
|
||||||
|
for (fp = ftab ; fp != 0; fp = fp->f_next) {
|
||||||
|
if (eq(tail(fp->f_fn), tail(file)))
|
||||||
|
return (fp);
|
||||||
|
}
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Make a new file list entry
|
||||||
|
*/
|
||||||
|
struct file_list *
|
||||||
|
new_fent()
|
||||||
|
{
|
||||||
|
register struct file_list *fp;
|
||||||
|
|
||||||
|
fp = (struct file_list *) malloc(sizeof *fp);
|
||||||
|
bzero(fp, sizeof *fp);
|
||||||
|
if (fcur == 0)
|
||||||
|
fcur = ftab = fp;
|
||||||
|
else
|
||||||
|
fcur->f_next = fp;
|
||||||
|
fcur = fp;
|
||||||
|
return (fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct users {
|
||||||
|
int u_default;
|
||||||
|
int u_min;
|
||||||
|
int u_max;
|
||||||
|
} users[] = {
|
||||||
|
{ 24, 8, 1024 }, /* MACHINE_VAX */
|
||||||
|
{ 4, 2, 128 }, /* MACHINE_TAHOE */
|
||||||
|
{ 8, 2, 64 }, /* MACHINE_HP300 */
|
||||||
|
{ 8, 2, 64 }, /* MACHINE_I386 */
|
||||||
|
{ 8, 2, 64 }, /* MACHINE_MIPS */
|
||||||
|
{ 8, 2, 64 }, /* MACHINE_PMAX */
|
||||||
|
{ 8, 2, 64 }, /* MACHINE_LUNA68K */
|
||||||
|
{ 8, 2, 64 }, /* MACHINE_NEWS3400 */
|
||||||
|
{ 2, 1, 16 }, /* MACHINE_PIC32 */
|
||||||
|
};
|
||||||
|
#define NUSERS (sizeof (users) / sizeof (users[0]))
|
||||||
|
|
||||||
|
int opteq(cp, dp)
|
||||||
|
char *cp, *dp;
|
||||||
|
{
|
||||||
|
char c, d;
|
||||||
|
|
||||||
|
for (; ; cp++, dp++) {
|
||||||
|
if (*cp != *dp) {
|
||||||
|
c = isupper(*cp) ? tolower(*cp) : *cp;
|
||||||
|
d = isupper(*dp) ? tolower(*dp) : *dp;
|
||||||
|
if (c != d)
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
if (*cp == 0)
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read in the information about files used in making the system.
|
||||||
|
* Store it in the ftab linked list.
|
||||||
|
*/
|
||||||
|
void read_files()
|
||||||
|
{
|
||||||
|
FILE *fp;
|
||||||
|
register struct file_list *tp, *pf;
|
||||||
|
register struct device *dp;
|
||||||
|
struct device *save_dp;
|
||||||
|
register struct opt *op;
|
||||||
|
char *wd, *this, *needs, *special;
|
||||||
|
char fname[32];
|
||||||
|
int nreqs, first = 1, configdep, isdup, std, filetype;
|
||||||
|
|
||||||
|
ftab = 0;
|
||||||
|
(void) strcpy(fname, "../../conf/files");
|
||||||
|
openit:
|
||||||
|
fp = fopen(fname, "r");
|
||||||
|
if (fp == 0) {
|
||||||
|
perror(fname);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
next:
|
||||||
|
/*
|
||||||
|
* filename [ standard | optional ] [ config-dependent ]
|
||||||
|
* [ dev* | profiling-routine ] [ device-driver]
|
||||||
|
* [ compile-with "compile rule" ]
|
||||||
|
*/
|
||||||
|
wd = get_word(fp);
|
||||||
|
if (wd == (char *)EOF) {
|
||||||
|
(void) fclose(fp);
|
||||||
|
if (first == 1) {
|
||||||
|
(void) sprintf(fname, "files.%s", machinename);
|
||||||
|
first++;
|
||||||
|
goto openit;
|
||||||
|
}
|
||||||
|
if (first == 2) {
|
||||||
|
(void) sprintf(fname, "files.%s", raise(ident));
|
||||||
|
first++;
|
||||||
|
fp = fopen(fname, "r");
|
||||||
|
if (fp != 0)
|
||||||
|
goto next;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (wd == 0)
|
||||||
|
goto next;
|
||||||
|
this = ns(wd);
|
||||||
|
next_word(fp, wd);
|
||||||
|
if (wd == 0) {
|
||||||
|
printf("%s: No type for %s.\n",
|
||||||
|
fname, this);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if ((pf = fl_lookup(this)) && (pf->f_type != INVISIBLE || pf->f_flags))
|
||||||
|
isdup = 1;
|
||||||
|
else
|
||||||
|
isdup = 0;
|
||||||
|
tp = 0;
|
||||||
|
if (first == 3 && (tp = fltail_lookup(this)) != 0)
|
||||||
|
printf("%s: Local file %s overrides %s.\n",
|
||||||
|
fname, this, tp->f_fn);
|
||||||
|
nreqs = 0;
|
||||||
|
special = 0;
|
||||||
|
configdep = 0;
|
||||||
|
needs = 0;
|
||||||
|
std = 0;
|
||||||
|
filetype = NORMAL;
|
||||||
|
if (eq(wd, "standard"))
|
||||||
|
std = 1;
|
||||||
|
else if (!eq(wd, "optional")) {
|
||||||
|
printf("%s: %s must be optional or standard\n", fname, this);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
nextparam:
|
||||||
|
next_word(fp, wd);
|
||||||
|
if (wd == 0)
|
||||||
|
goto doneparam;
|
||||||
|
if (eq(wd, "config-dependent")) {
|
||||||
|
configdep++;
|
||||||
|
goto nextparam;
|
||||||
|
}
|
||||||
|
if (eq(wd, "compile-with")) {
|
||||||
|
next_quoted_word(fp, wd);
|
||||||
|
if (wd == 0) {
|
||||||
|
printf("%s: missing compile command string.\n",
|
||||||
|
fname);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
special = ns(wd);
|
||||||
|
goto nextparam;
|
||||||
|
}
|
||||||
|
nreqs++;
|
||||||
|
if (eq(wd, "device-driver")) {
|
||||||
|
filetype = DRIVER;
|
||||||
|
goto nextparam;
|
||||||
|
}
|
||||||
|
if (eq(wd, "profiling-routine")) {
|
||||||
|
filetype = PROFILING;
|
||||||
|
goto nextparam;
|
||||||
|
}
|
||||||
|
if (needs == 0 && nreqs == 1)
|
||||||
|
needs = ns(wd);
|
||||||
|
if (isdup)
|
||||||
|
goto invis;
|
||||||
|
for (dp = dtab; dp != 0; save_dp = dp, dp = dp->d_next)
|
||||||
|
if (eq(dp->d_name, wd)) {
|
||||||
|
if (std && dp->d_type == PSEUDO_DEVICE &&
|
||||||
|
dp->d_slave <= 0)
|
||||||
|
dp->d_slave = 1;
|
||||||
|
goto nextparam;
|
||||||
|
}
|
||||||
|
if (std) {
|
||||||
|
dp = (struct device *) malloc(sizeof *dp);
|
||||||
|
init_dev(dp);
|
||||||
|
dp->d_name = ns(wd);
|
||||||
|
dp->d_type = PSEUDO_DEVICE;
|
||||||
|
dp->d_slave = 1;
|
||||||
|
save_dp->d_next = dp;
|
||||||
|
goto nextparam;
|
||||||
|
}
|
||||||
|
for (op = opt; op != 0; op = op->op_next)
|
||||||
|
if (op->op_value == 0 && opteq(op->op_name, wd)) {
|
||||||
|
if (nreqs == 1) {
|
||||||
|
free(needs);
|
||||||
|
needs = 0;
|
||||||
|
}
|
||||||
|
goto nextparam;
|
||||||
|
}
|
||||||
|
invis:
|
||||||
|
while ((wd = get_word(fp)) != 0)
|
||||||
|
;
|
||||||
|
if (tp == 0)
|
||||||
|
tp = new_fent();
|
||||||
|
tp->f_fn = this;
|
||||||
|
tp->f_type = INVISIBLE;
|
||||||
|
tp->f_needs = needs;
|
||||||
|
tp->f_flags = isdup;
|
||||||
|
tp->f_special = special;
|
||||||
|
goto next;
|
||||||
|
|
||||||
|
doneparam:
|
||||||
|
if (std == 0 && nreqs == 0) {
|
||||||
|
printf("%s: what is %s optional on?\n",
|
||||||
|
fname, this);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
save:
|
||||||
|
if (wd) {
|
||||||
|
printf("%s: syntax error describing %s\n",
|
||||||
|
fname, this);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
if (filetype == PROFILING && profiling == 0)
|
||||||
|
goto next;
|
||||||
|
if (tp == 0)
|
||||||
|
tp = new_fent();
|
||||||
|
tp->f_fn = this;
|
||||||
|
tp->f_type = filetype;
|
||||||
|
tp->f_flags = 0;
|
||||||
|
if (configdep)
|
||||||
|
tp->f_flags |= CONFIGDEP;
|
||||||
|
tp->f_needs = needs;
|
||||||
|
tp->f_special = special;
|
||||||
|
if (pf && pf->f_type == INVISIBLE)
|
||||||
|
pf->f_flags = 1; /* mark as duplicate */
|
||||||
|
goto next;
|
||||||
|
}
|
||||||
|
|
||||||
|
void do_objs(fp)
|
||||||
|
FILE *fp;
|
||||||
|
{
|
||||||
|
register struct file_list *tp, *fl;
|
||||||
|
register int lpos, len;
|
||||||
|
register char *cp, och, *sp;
|
||||||
|
char swapname[32];
|
||||||
|
|
||||||
|
fprintf(fp, "OBJS=");
|
||||||
|
lpos = 6;
|
||||||
|
for (tp = ftab; tp != 0; tp = tp->f_next) {
|
||||||
|
if (tp->f_type == INVISIBLE)
|
||||||
|
continue;
|
||||||
|
sp = tail(tp->f_fn);
|
||||||
|
for (fl = conf_list; fl; fl = fl->f_next) {
|
||||||
|
if (fl->f_type != SWAPSPEC)
|
||||||
|
continue;
|
||||||
|
(void) sprintf(swapname, "swap%s.c", fl->f_fn);
|
||||||
|
if (eq(sp, swapname))
|
||||||
|
goto cont;
|
||||||
|
}
|
||||||
|
cp = sp + (len = strlen(sp)) - 1;
|
||||||
|
och = *cp;
|
||||||
|
*cp = 'o';
|
||||||
|
if (len + lpos > 72) {
|
||||||
|
lpos = 8;
|
||||||
|
fprintf(fp, "\\\n\t");
|
||||||
|
}
|
||||||
|
fprintf(fp, "%s ", sp);
|
||||||
|
lpos += len + 1;
|
||||||
|
*cp = och;
|
||||||
|
cont:
|
||||||
|
;
|
||||||
|
}
|
||||||
|
if (lpos != 8)
|
||||||
|
putc('\n', fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void do_cfiles(fp)
|
||||||
|
FILE *fp;
|
||||||
|
{
|
||||||
|
register struct file_list *tp, *fl;
|
||||||
|
register int lpos, len;
|
||||||
|
char swapname[32];
|
||||||
|
|
||||||
|
fputs("CFILES=", fp);
|
||||||
|
lpos = 8;
|
||||||
|
for (tp = ftab; tp; tp = tp->f_next)
|
||||||
|
if (tp->f_type != INVISIBLE) {
|
||||||
|
len = strlen(tp->f_fn);
|
||||||
|
if (tp->f_fn[len - 1] != 'c')
|
||||||
|
continue;
|
||||||
|
if ((len = 3 + len) + lpos > 72) {
|
||||||
|
lpos = 8;
|
||||||
|
fputs("\\\n\t", fp);
|
||||||
|
}
|
||||||
|
fprintf(fp, "$S/%s ", tp->f_fn);
|
||||||
|
lpos += len + 1;
|
||||||
|
}
|
||||||
|
for (fl = conf_list; fl; fl = fl->f_next)
|
||||||
|
if (fl->f_type == SYSTEMSPEC) {
|
||||||
|
(void) sprintf(swapname, "swap%s.c", fl->f_fn);
|
||||||
|
if ((len = 3 + strlen(swapname)) + lpos > 72) {
|
||||||
|
lpos = 8;
|
||||||
|
fputs("\\\n\t", fp);
|
||||||
|
}
|
||||||
|
if (eq(fl->f_fn, "generic"))
|
||||||
|
fprintf(fp, "$A/%s/%s ",
|
||||||
|
machinename, swapname);
|
||||||
|
else
|
||||||
|
fprintf(fp, "%s ", swapname);
|
||||||
|
lpos += len + 1;
|
||||||
|
}
|
||||||
|
if (lpos != 8)
|
||||||
|
putc('\n', fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create the makerules for each file
|
||||||
|
* which is part of the system.
|
||||||
|
* Devices are processed with the special c2 option -i
|
||||||
|
* which avoids any problem areas with i/o addressing
|
||||||
|
* (e.g. for the VAX); assembler files are processed by as.
|
||||||
|
*/
|
||||||
|
void do_rules(f)
|
||||||
|
FILE *f;
|
||||||
|
{
|
||||||
|
register char *cp, *np, och, *tp;
|
||||||
|
register struct file_list *ftp;
|
||||||
|
char *special;
|
||||||
|
|
||||||
|
for (ftp = ftab; ftp != 0; ftp = ftp->f_next) {
|
||||||
|
if (ftp->f_type == INVISIBLE)
|
||||||
|
continue;
|
||||||
|
cp = (np = ftp->f_fn) + strlen(ftp->f_fn) - 1;
|
||||||
|
och = *cp;
|
||||||
|
*cp = '\0';
|
||||||
|
if (och == 'o') {
|
||||||
|
fprintf(f, "%so:\n\t-cp $S/%so .\n\n", tail(np), np);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
fprintf(f, "%so: $S/%s%c\n", tail(np), np, och);
|
||||||
|
tp = tail(np);
|
||||||
|
special = ftp->f_special;
|
||||||
|
if (special == 0) {
|
||||||
|
char *ftype;
|
||||||
|
static char cmd[128];
|
||||||
|
|
||||||
|
switch (ftp->f_type) {
|
||||||
|
|
||||||
|
case NORMAL:
|
||||||
|
ftype = "NORMAL";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DRIVER:
|
||||||
|
ftype = "DRIVER";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PROFILING:
|
||||||
|
if (!profiling)
|
||||||
|
continue;
|
||||||
|
ftype = "PROFILE";
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
printf("config: don't know rules for %s\n", np);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
(void)sprintf(cmd, "${%s_%c%s}", ftype, toupper(och),
|
||||||
|
ftp->f_flags & CONFIGDEP? "_C" : "");
|
||||||
|
special = cmd;
|
||||||
|
}
|
||||||
|
*cp = och;
|
||||||
|
fprintf(f, "\t%s\n\n", special);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create the load strings
|
||||||
|
*/
|
||||||
|
void do_load(f)
|
||||||
|
register FILE *f;
|
||||||
|
{
|
||||||
|
register struct file_list *fl;
|
||||||
|
register int first;
|
||||||
|
struct file_list *do_systemspec();
|
||||||
|
|
||||||
|
for (first = 1, fl = conf_list; fl; first = 0)
|
||||||
|
fl = fl->f_type == SYSTEMSPEC ?
|
||||||
|
do_systemspec(f, fl, first) : fl->f_next;
|
||||||
|
fputs("all:", f);
|
||||||
|
for (fl = conf_list; fl; fl = fl->f_next)
|
||||||
|
if (fl->f_type == SYSTEMSPEC)
|
||||||
|
fprintf(f, " %s.elf", fl->f_needs);
|
||||||
|
putc('\n', f);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Build the makefile from the skeleton
|
||||||
|
*/
|
||||||
|
void makefile()
|
||||||
|
{
|
||||||
|
FILE *ifp, *ofp;
|
||||||
|
char line[BUFSIZ];
|
||||||
|
struct opt *op;
|
||||||
|
struct users *up;
|
||||||
|
|
||||||
|
read_files();
|
||||||
|
strcpy(line, "Makefile.");
|
||||||
|
(void) strcat(line, machinename);
|
||||||
|
ifp = fopen(line, "r");
|
||||||
|
if (ifp == 0) {
|
||||||
|
perror(line);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
ofp = fopen(path("Makefile"), "w");
|
||||||
|
if (ofp == 0) {
|
||||||
|
perror(path("Makefile"));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
fprintf(ofp, "IDENT=-D%s", raise(ident));
|
||||||
|
if (profiling)
|
||||||
|
fprintf(ofp, " -DGPROF");
|
||||||
|
if (cputype == 0) {
|
||||||
|
printf("cpu type must be specified\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
{ struct cputype *cp;
|
||||||
|
for (cp = cputype; cp; cp = cp->cpu_next)
|
||||||
|
fprintf(ofp, " -D%s", cp->cpu_name);
|
||||||
|
}
|
||||||
|
for (op = opt; op; op = op->op_next)
|
||||||
|
if (op->op_value)
|
||||||
|
fprintf(ofp, " -D%s=\"%s\"", op->op_name, op->op_value);
|
||||||
|
else
|
||||||
|
fprintf(ofp, " -D%s", op->op_name);
|
||||||
|
fprintf(ofp, "\n");
|
||||||
|
if (ldscript)
|
||||||
|
fprintf(ofp, "LDSCRIPT=\"%s\"\n", ldscript);
|
||||||
|
if (hadtz == 0)
|
||||||
|
printf("timezone not specified; gmt assumed\n");
|
||||||
|
if ((unsigned)machine > NUSERS) {
|
||||||
|
printf("maxusers config info isn't present, using vax\n");
|
||||||
|
up = &users[MACHINE_VAX-1];
|
||||||
|
} else
|
||||||
|
up = &users[machine-1];
|
||||||
|
if (maxusers == 0) {
|
||||||
|
printf("maxusers not specified; %d assumed\n", up->u_default);
|
||||||
|
maxusers = up->u_default;
|
||||||
|
} else if (maxusers < up->u_min) {
|
||||||
|
printf("minimum of %d maxusers assumed\n", up->u_min);
|
||||||
|
maxusers = up->u_min;
|
||||||
|
} else if (maxusers > up->u_max)
|
||||||
|
printf("warning: maxusers > %d (%d)\n", up->u_max, maxusers);
|
||||||
|
fprintf(ofp, "PARAM=-DTIMEZONE=%d -DDST=%d -DMAXUSERS=%d",
|
||||||
|
zone, dst, maxusers);
|
||||||
|
if (hz > 0)
|
||||||
|
fprintf(ofp, " -DHZ=%d", hz);
|
||||||
|
fprintf(ofp, "\n");
|
||||||
|
for (op = mkopt; op; op = op->op_next)
|
||||||
|
fprintf(ofp, "%s=%s\n", op->op_name, op->op_value);
|
||||||
|
if (debugging)
|
||||||
|
fprintf(ofp, "DEBUG=-g\n");
|
||||||
|
if (profiling)
|
||||||
|
fprintf(ofp, "PROF=-pg\n");
|
||||||
|
while (fgets(line, BUFSIZ, ifp) != 0) {
|
||||||
|
if (*line != '%') {
|
||||||
|
fprintf(ofp, "%s", line);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (eq(line, "%OBJS\n"))
|
||||||
|
do_objs(ofp);
|
||||||
|
else if (eq(line, "%CFILES\n"))
|
||||||
|
do_cfiles(ofp);
|
||||||
|
else if (eq(line, "%RULES\n"))
|
||||||
|
do_rules(ofp);
|
||||||
|
else if (eq(line, "%LOAD\n"))
|
||||||
|
do_load(ofp);
|
||||||
|
else
|
||||||
|
fprintf(stderr,
|
||||||
|
"Unknown %% construct in generic makefile: %s",
|
||||||
|
line);
|
||||||
|
}
|
||||||
|
(void) fclose(ifp);
|
||||||
|
(void) fclose(ofp);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
tail(fn)
|
||||||
|
char *fn;
|
||||||
|
{
|
||||||
|
register char *cp;
|
||||||
|
|
||||||
|
cp = rindex(fn, '/');
|
||||||
|
if (cp == 0)
|
||||||
|
return (fn);
|
||||||
|
return (cp+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void do_swapspec(f, name)
|
||||||
|
FILE *f;
|
||||||
|
register char *name;
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!eq(name, "generic"))
|
||||||
|
fprintf(f, "swap%s.o: swap%s.c\n", name, name);
|
||||||
|
else
|
||||||
|
fprintf(f, "swapgeneric.o: $A/%s/swapgeneric.c\n",
|
||||||
|
machinename);
|
||||||
|
fprintf(f, "\t${NORMAL_C}\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
struct file_list *
|
||||||
|
do_systemspec(f, fl, first)
|
||||||
|
FILE *f;
|
||||||
|
register struct file_list *fl;
|
||||||
|
int first;
|
||||||
|
{
|
||||||
|
|
||||||
|
fprintf(f, "%s.elf: ${SYSTEM_DEP} swap%s.o", fl->f_needs, fl->f_fn);
|
||||||
|
// Don't use newvers target.
|
||||||
|
// A preferred way is to run newvers.sh from SYSTEM_LD_HEAD macro.
|
||||||
|
//if (first)
|
||||||
|
// fprintf(f, " newvers");
|
||||||
|
fprintf(f, "\n\t${SYSTEM_LD_HEAD}\n");
|
||||||
|
fprintf(f, "\t${SYSTEM_LD} swap%s.o\n", fl->f_fn);
|
||||||
|
fprintf(f, "\t${SYSTEM_LD_TAIL}\n\n");
|
||||||
|
do_swapspec(f, fl->f_fn);
|
||||||
|
for (fl = fl->f_next; fl; fl = fl->f_next)
|
||||||
|
if (fl->f_type != SWAPSPEC)
|
||||||
|
break;
|
||||||
|
return (fl);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
raise(str)
|
||||||
|
register char *str;
|
||||||
|
{
|
||||||
|
register char *cp = str;
|
||||||
|
|
||||||
|
while (*str) {
|
||||||
|
if (islower(*str))
|
||||||
|
*str = toupper(*str);
|
||||||
|
str++;
|
||||||
|
}
|
||||||
|
return (cp);
|
||||||
|
}
|
||||||
217
tools/kconfig/mkswapconf.c
Normal file
217
tools/kconfig/mkswapconf.c
Normal file
@@ -0,0 +1,217 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 1980, 1993
|
||||||
|
* The Regents of the University of California. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
|
* must display the following acknowledgement:
|
||||||
|
* This product includes software developed by the University of
|
||||||
|
* California, Berkeley and its contributors.
|
||||||
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef lint
|
||||||
|
static char sccsid[] = "@(#)mkswapconf.c 8.1 (Berkeley) 6/6/93";
|
||||||
|
#endif /* not lint */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Build a swap configuration file.
|
||||||
|
*/
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
|
void swapconf()
|
||||||
|
{
|
||||||
|
register struct file_list *fl;
|
||||||
|
struct file_list *do_swap();
|
||||||
|
|
||||||
|
fl = conf_list;
|
||||||
|
while (fl) {
|
||||||
|
if (fl->f_type != SYSTEMSPEC) {
|
||||||
|
fl = fl->f_next;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
fl = do_swap(fl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
struct file_list *
|
||||||
|
do_swap(fl)
|
||||||
|
register struct file_list *fl;
|
||||||
|
{
|
||||||
|
FILE *fp;
|
||||||
|
char swapname[80];
|
||||||
|
register struct file_list *swap;
|
||||||
|
dev_t dev;
|
||||||
|
|
||||||
|
if (eq(fl->f_fn, "generic")) {
|
||||||
|
fl = fl->f_next;
|
||||||
|
return (fl->f_next);
|
||||||
|
}
|
||||||
|
(void) sprintf(swapname, "swap%s.c", fl->f_fn);
|
||||||
|
fp = fopen(path(swapname), "w");
|
||||||
|
if (fp == 0) {
|
||||||
|
perror(path(swapname));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
fprintf(fp, "#include \"sys/param.h\"\n");
|
||||||
|
fprintf(fp, "#include \"sys/conf.h\"\n");
|
||||||
|
fprintf(fp, "\n");
|
||||||
|
/*
|
||||||
|
* If there aren't any swap devices
|
||||||
|
* specified, just return, the error
|
||||||
|
* has already been noted.
|
||||||
|
*/
|
||||||
|
swap = fl->f_next;
|
||||||
|
if (swap == 0 || swap->f_type != SWAPSPEC) {
|
||||||
|
(void) unlink(path(swapname));
|
||||||
|
fclose(fp);
|
||||||
|
return (swap);
|
||||||
|
}
|
||||||
|
fprintf(fp, "dev_t\trootdev = makedev(%d, %d);\n",
|
||||||
|
major(fl->f_rootdev), minor(fl->f_rootdev));
|
||||||
|
fprintf(fp, "dev_t\tdumpdev = makedev(%d, %d);\n",
|
||||||
|
major(fl->f_dumpdev), minor(fl->f_dumpdev));
|
||||||
|
fprintf(fp, "\n");
|
||||||
|
fprintf(fp, "struct\tswdevt swdevt[] = {\n");
|
||||||
|
do {
|
||||||
|
dev = swap->f_swapdev;
|
||||||
|
fprintf(fp, "\t{ makedev(%d, %d),\t%d,\t%d },\t/* %s */\n",
|
||||||
|
major(dev), minor(dev), swap->f_swapflag,
|
||||||
|
swap->f_swapsize, swap->f_fn);
|
||||||
|
swap = swap->f_next;
|
||||||
|
} while (swap && swap->f_type == SWAPSPEC);
|
||||||
|
fprintf(fp, "\t{ NODEV, 0, 0 }\n");
|
||||||
|
fprintf(fp, "};\n");
|
||||||
|
fclose(fp);
|
||||||
|
return (swap);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int devtablenotread = 1;
|
||||||
|
static struct devdescription {
|
||||||
|
char *dev_name;
|
||||||
|
int dev_major;
|
||||||
|
struct devdescription *dev_next;
|
||||||
|
} *devtable;
|
||||||
|
|
||||||
|
void initdevtable()
|
||||||
|
{
|
||||||
|
char buf[BUFSIZ];
|
||||||
|
int maj;
|
||||||
|
register struct devdescription **dp = &devtable;
|
||||||
|
FILE *fp;
|
||||||
|
|
||||||
|
(void) sprintf(buf, "../conf/devices.%s", machinename);
|
||||||
|
fp = fopen(buf, "r");
|
||||||
|
if (fp == NULL) {
|
||||||
|
fprintf(stderr, "config: can't open %s\n", buf);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
while (fscanf(fp, "%s\t%d\n", buf, &maj) == 2) {
|
||||||
|
*dp = (struct devdescription *)malloc(sizeof (**dp));
|
||||||
|
(*dp)->dev_name = ns(buf);
|
||||||
|
(*dp)->dev_major = maj;
|
||||||
|
dp = &(*dp)->dev_next;
|
||||||
|
}
|
||||||
|
*dp = 0;
|
||||||
|
fclose(fp);
|
||||||
|
devtablenotread = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Given a device name specification figure out:
|
||||||
|
* major device number
|
||||||
|
* partition
|
||||||
|
* device name
|
||||||
|
* unit number
|
||||||
|
* This is a hack, but the system still thinks in
|
||||||
|
* terms of major/minor instead of string names.
|
||||||
|
*/
|
||||||
|
dev_t
|
||||||
|
nametodev(name, defunit, defpartition)
|
||||||
|
char *name;
|
||||||
|
int defunit;
|
||||||
|
char defpartition;
|
||||||
|
{
|
||||||
|
char *cp, partition;
|
||||||
|
int unit;
|
||||||
|
register struct devdescription *dp;
|
||||||
|
|
||||||
|
cp = name;
|
||||||
|
if (cp == 0) {
|
||||||
|
fprintf(stderr, "config: internal error, nametodev\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
while (*cp && !isdigit(*cp))
|
||||||
|
cp++;
|
||||||
|
unit = *cp ? atoi(cp) : defunit;
|
||||||
|
if (unit < 0 || unit > 31) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"config: %s: invalid device specification, unit out of range\n", name);
|
||||||
|
unit = defunit; /* carry on more checking */
|
||||||
|
}
|
||||||
|
if (*cp) {
|
||||||
|
*cp++ = '\0';
|
||||||
|
while (*cp && isdigit(*cp))
|
||||||
|
cp++;
|
||||||
|
}
|
||||||
|
partition = *cp ? *cp : defpartition;
|
||||||
|
if (partition < 'a' || partition > 'h') {
|
||||||
|
fprintf(stderr,
|
||||||
|
"config: %c: invalid device specification, bad partition\n", *cp);
|
||||||
|
partition = defpartition; /* carry on */
|
||||||
|
}
|
||||||
|
if (devtablenotread)
|
||||||
|
initdevtable();
|
||||||
|
for (dp = devtable; dp; dp = dp->dev_next)
|
||||||
|
if (eq(name, dp->dev_name))
|
||||||
|
break;
|
||||||
|
if (dp == 0) {
|
||||||
|
fprintf(stderr, "config: %s: unknown device\n", name);
|
||||||
|
return (NODEV);
|
||||||
|
}
|
||||||
|
return (makedev(dp->dev_major, (unit << 3) + (partition - 'a')));
|
||||||
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
devtoname(dev)
|
||||||
|
dev_t dev;
|
||||||
|
{
|
||||||
|
char buf[80];
|
||||||
|
register struct devdescription *dp;
|
||||||
|
|
||||||
|
if (devtablenotread)
|
||||||
|
initdevtable();
|
||||||
|
for (dp = devtable; dp; dp = dp->dev_next)
|
||||||
|
if (major(dev) == dp->dev_major)
|
||||||
|
break;
|
||||||
|
if (dp == 0)
|
||||||
|
dp = devtable;
|
||||||
|
(void) sprintf(buf, "%s%d%c", dp->dev_name,
|
||||||
|
minor(dev) >> 3, (minor(dev) & 07) + 'a');
|
||||||
|
return (ns(buf));
|
||||||
|
}
|
||||||
196
tools/kconfig/mkubglue.c
Normal file
196
tools/kconfig/mkubglue.c
Normal file
@@ -0,0 +1,196 @@
|
|||||||
|
/*-
|
||||||
|
* Copyright (c) 1980, 1993
|
||||||
|
* The Regents of the University of California. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
|
* must display the following acknowledgement:
|
||||||
|
* This product includes software developed by the University of
|
||||||
|
* California, Berkeley and its contributors.
|
||||||
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef lint
|
||||||
|
static char sccsid[] = "@(#)mkubglue.c 8.1 (Berkeley) 6/6/93";
|
||||||
|
#endif /* not lint */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Make the uba interrupt file ubglue.s
|
||||||
|
*/
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "config.h"
|
||||||
|
#include "y.tab.h"
|
||||||
|
|
||||||
|
ubglue()
|
||||||
|
{
|
||||||
|
register FILE *fp;
|
||||||
|
register struct device *dp, *mp;
|
||||||
|
|
||||||
|
fp = fopen(path("ubglue.s"), "w");
|
||||||
|
if (fp == 0) {
|
||||||
|
perror(path("ubglue.s"));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
for (dp = dtab; dp != 0; dp = dp->d_next) {
|
||||||
|
mp = dp->d_conn;
|
||||||
|
if (mp != 0 && mp != (struct device *)-1 &&
|
||||||
|
!eq(mp->d_name, "mba")) {
|
||||||
|
struct idlst *id, *id2;
|
||||||
|
|
||||||
|
for (id = dp->d_vec; id; id = id->id_next) {
|
||||||
|
for (id2 = dp->d_vec; id2; id2 = id2->id_next) {
|
||||||
|
if (id2 == id) {
|
||||||
|
dump_vec(fp, id->id, dp->d_unit);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!strcmp(id->id, id2->id))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dump_std(fp);
|
||||||
|
for (dp = dtab; dp != 0; dp = dp->d_next) {
|
||||||
|
mp = dp->d_conn;
|
||||||
|
if (mp != 0 && mp != (struct device *)-1 &&
|
||||||
|
!eq(mp->d_name, "mba")) {
|
||||||
|
struct idlst *id, *id2;
|
||||||
|
|
||||||
|
for (id = dp->d_vec; id; id = id->id_next) {
|
||||||
|
for (id2 = dp->d_vec; id2; id2 = id2->id_next) {
|
||||||
|
if (id2 == id) {
|
||||||
|
dump_intname(fp, id->id,
|
||||||
|
dp->d_unit);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!strcmp(id->id, id2->id))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dump_ctrs(fp);
|
||||||
|
(void) fclose(fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int cntcnt = 0; /* number of interrupt counters allocated */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* print an interrupt vector
|
||||||
|
*/
|
||||||
|
dump_vec(fp, vector, number)
|
||||||
|
register FILE *fp;
|
||||||
|
char *vector;
|
||||||
|
int number;
|
||||||
|
{
|
||||||
|
char nbuf[80];
|
||||||
|
register char *v = nbuf;
|
||||||
|
|
||||||
|
(void) sprintf(v, "%s%d", vector, number);
|
||||||
|
fprintf(fp, "\t.globl\t_X%s\n\t.align\t2\n_X%s:\n\tpushr\t$0x3f\n",
|
||||||
|
v, v);
|
||||||
|
fprintf(fp, "\tincl\t_fltintrcnt+(4*%d)\n", cntcnt++);
|
||||||
|
if (strncmp(vector, "dzx", 3) == 0)
|
||||||
|
fprintf(fp, "\tmovl\t$%d,r0\n\tjmp\tdzdma\n\n", number);
|
||||||
|
else if (strncmp(vector, "dpx", 3) == 0)
|
||||||
|
fprintf(fp, "\tmovl\t$%d,r0\n\tjmp\tdpxdma\n\n", number);
|
||||||
|
else if (strncmp(vector, "dpr", 3) == 0)
|
||||||
|
fprintf(fp, "\tmovl\t$%d,r0\n\tjmp\tdprdma\n\n", number);
|
||||||
|
else {
|
||||||
|
if (strncmp(vector, "uur", 3) == 0) {
|
||||||
|
fprintf(fp, "#ifdef UUDMA\n");
|
||||||
|
fprintf(fp, "\tmovl\t$%d,r0\n\tjsb\tuudma\n", number);
|
||||||
|
fprintf(fp, "#endif\n");
|
||||||
|
}
|
||||||
|
fprintf(fp, "\tpushl\t$%d\n", number);
|
||||||
|
fprintf(fp, "\tcalls\t$1,_%s\n\tpopr\t$0x3f\n", vector);
|
||||||
|
fprintf(fp, "\tincl\t_cnt+V_INTR\n\trei\n\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Start the interrupt name table with the names
|
||||||
|
* of the standard vectors not on the unibus.
|
||||||
|
* The number and order of these names should correspond
|
||||||
|
* with the definitions in scb.s.
|
||||||
|
*/
|
||||||
|
dump_std(fp)
|
||||||
|
register FILE *fp;
|
||||||
|
{
|
||||||
|
fprintf(fp, "\n\t.globl\t_intrnames\n");
|
||||||
|
fprintf(fp, "\n\t.globl\t_eintrnames\n");
|
||||||
|
fprintf(fp, "\t.data\n");
|
||||||
|
fprintf(fp, "_intrnames:\n");
|
||||||
|
fprintf(fp, "\t.asciz\t\"clock\"\n");
|
||||||
|
fprintf(fp, "\t.asciz\t\"cnr\"\n");
|
||||||
|
fprintf(fp, "\t.asciz\t\"cnx\"\n");
|
||||||
|
fprintf(fp, "\t.asciz\t\"tur\"\n");
|
||||||
|
fprintf(fp, "\t.asciz\t\"tux\"\n");
|
||||||
|
fprintf(fp, "\t.asciz\t\"mba0\"\n");
|
||||||
|
fprintf(fp, "\t.asciz\t\"mba1\"\n");
|
||||||
|
fprintf(fp, "\t.asciz\t\"mba2\"\n");
|
||||||
|
fprintf(fp, "\t.asciz\t\"mba3\"\n");
|
||||||
|
fprintf(fp, "\t.asciz\t\"uba0\"\n");
|
||||||
|
fprintf(fp, "\t.asciz\t\"uba1\"\n");
|
||||||
|
fprintf(fp, "\t.asciz\t\"uba2\"\n");
|
||||||
|
fprintf(fp, "\t.asciz\t\"uba3\"\n");
|
||||||
|
#define I_FIXED 13 /* number of names above */
|
||||||
|
}
|
||||||
|
|
||||||
|
dump_intname(fp, vector, number)
|
||||||
|
register FILE *fp;
|
||||||
|
char *vector;
|
||||||
|
int number;
|
||||||
|
{
|
||||||
|
register char *cp = vector;
|
||||||
|
|
||||||
|
fprintf(fp, "\t.asciz\t\"");
|
||||||
|
/*
|
||||||
|
* Skip any "int" or "intr" in the name.
|
||||||
|
*/
|
||||||
|
while (*cp)
|
||||||
|
if (cp[0] == 'i' && cp[1] == 'n' && cp[2] == 't') {
|
||||||
|
cp += 3;
|
||||||
|
if (*cp == 'r')
|
||||||
|
cp++;
|
||||||
|
} else {
|
||||||
|
putc(*cp, fp);
|
||||||
|
cp++;
|
||||||
|
}
|
||||||
|
fprintf(fp, "%d\"\n", number);
|
||||||
|
}
|
||||||
|
|
||||||
|
dump_ctrs(fp)
|
||||||
|
register FILE *fp;
|
||||||
|
{
|
||||||
|
fprintf(fp, "_eintrnames:\n");
|
||||||
|
fprintf(fp, "\n\t.globl\t_intrcnt\n");
|
||||||
|
fprintf(fp, "\n\t.globl\t_eintrcnt\n");
|
||||||
|
fprintf(fp, "_intrcnt:\n", I_FIXED);
|
||||||
|
fprintf(fp, "\t.space\t4 * %d\n", I_FIXED);
|
||||||
|
fprintf(fp, "_fltintrcnt:\n", cntcnt);
|
||||||
|
fprintf(fp, "\t.space\t4 * %d\n", cntcnt);
|
||||||
|
fprintf(fp, "_eintrcnt:\n\n");
|
||||||
|
fprintf(fp, "\t.text\n");
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user