File:  [Power 6/32 Unix Tahoe 4.2BSD] / cci / usr / src / etc / config / mkvbglue.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Sun Jul 28 12:24:19 2019 UTC (7 years ago) by root
Branches: bsd, MAIN
CVS tags: v12b, v121, HEAD
Power 6/32 Unix version 1.2b

#ifndef lint
static char sccsid[] = "@(#)mkubglue.c	1.11 (Berkeley) 8/11/83";
#endif

/*
 * Make the uba interrupt file ubglue.s
 */
#include <stdio.h>
#include "config.h"
#include "y.tab.h"
#include "maxconf.h"

ubglue()
{
	register FILE *fp;
	register struct device *dp, *mp;
	int i,j;

	fp = fopen(path("ubglue.s"), "w");
	if (fp == 0) {
		perror(path("ubglue.s"));
		exit(1);
	}
	for (dp = dtab; dp != 0; dp = dp->d_next) {
	/*
		printdp(dp);
	*/
		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);
						/* increment counter for each 
						/* vector which is dumped.
						*/
						for(i=0;i<=maxvects;i++)
						if(!strcmp(id->id,max_conf[i].mc_intname))
							max_conf[i].mc_count++;
						break;
					}
					if (!strcmp(id->id, id2->id))
						break;
				}
			}
		}
	}
	for(i=0 ; i<=maxvects ; i++)
		for(j=max_conf[i].mc_count;j < max_conf[i].mc_max;j++)
			dump_dummy(fp,max_conf[i].mc_intname,j);
	(void) fclose(fp);
}

printdp(dp)
	register struct device *dp;
{
struct idlst *id;
	printf("dp=%x, Type=%d, connected to %x, name:%s\n",
		dp,dp->d_type,dp->d_conn,dp->d_name);
	printf("vectors:");
	for (id = dp->d_vec; id; id = id->id_next) 
		printf(" %s, ",id->id);
	printf("\n pri=%d, addr=%d, unit=%d, drive=%d, slave=%d \n",
		dp->d_pri,dp->d_addr,dp->d_unit,dp->d_drive,dp->d_slave);
	printf("Next one in list: %x\n",dp->d_next);
}



/*
 * 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, "SCBVEC(%s):\n", v);
	fprintf(fp, "\tCHECK_SFE(4)\n");
	fprintf(fp, "\tSAVE_FPSTAT(4)\n");
	fprintf(fp, "\tPUSHR\n");
	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");
/*  We will have to change some of the names of the driver routines... */


}
/*
 * print an unimplemented (in the present configuration)interrupt vector
 */
dump_dummy(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, "\tSAVE_FPSTAT(4);\n");
	fprintf(fp, "\tPUSHR;\n");
	fprintf(fp, "\tPRINTF(0,\"******* Unimplemented interrupt ");
	fprintf(fp, "(%s) ********\\n\");\n", v);
	fprintf(fp, "\tPOPR;\n\trei\n\n");
	fprintf(fp, "\tREST_FPSTAT;\n\trei\n\n");


}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.