~kris/9p

9hist

37cdcabe2f146e37ea4af57ade588674bccefa80 — David du Colombier 32 years ago b77fab2
Plan 9 from Bell Labs 1994-02-25
6 files changed, 128 insertions(+), 41 deletions(-)

M carrera/devrtc.c
M carrera/io.h
M carrera/main.c
M carrera/trap.c
M port/portdat.h
M port/portfns.h
M carrera/devrtc.c => carrera/devrtc.c +1 -5
@@ 116,13 116,11 @@ static uchar
bcd2binary(int reg)
{
	uchar x;
/*

	x = (*(uchar*)Rtcindex)&~0x7f;
	*(uchar*)Rtcindex = x|reg;
	x = *(uchar*)Rtcdata;
	return (x&0xf) + 10*(x>>4);
/**/
	return 0;
}

long	 


@@ 191,11 189,9 @@ static void
binary2bcd(int reg, uchar val)
{
	uchar x;
/*
	x = (*(uchar*)Rtcindex)&~0x7f;
	*(uchar*)Rtcindex = x|reg;
	*(uchar*)Rtcdata = (val % 10) | (((val / 10) % 10)<<4);
/**/
}



M carrera/io.h => carrera/io.h +35 -0
@@ 69,6 69,11 @@ enum
	Ntranslation	= 4096,		/* Number of translation registers */
};

enum
{
	SB16pcm		= 100,
};

typedef struct Tte Tte;
struct Tte
{


@@ 86,3 91,33 @@ struct Tte
#define EISAINW(port)		(*(ushort*)((EisaControl+(port))^6))
#define EISAOUTB(port, v)	EISAINB(port) = v
#define EISAOUTW(port, v)	EISAINW(port) = v

/*
 *  8259 interrupt controllers
 */
enum
{
	Int0vec=	0,		/* first 8259 */
	 Clockvec=	Int0vec+0,	/*  clock interrupts */
	 Kbdvec=	Int0vec+1,	/*  keyboard interrupts */
	 Uart1vec=	Int0vec+3,	/*  modem line */
	 Uart0vec=	Int0vec+4,	/*  serial line */
	 PCMCIAvec=	Int0vec+5,	/*  PCMCIA card change */
	 Floppyvec=	Int0vec+6,	/*  floppy interrupts */
	 Parallelvec=	Int0vec+7,	/*  parallel port interrupts */
	Int1vec=	Int0vec+8,	/* second 8259 */
	 Ethervec=	Int0vec+10,	/*  ethernet interrupt */
	 Mousevec=	Int0vec+12,	/*  mouse interrupt */
	 Matherr2vec=	Int0vec+13,	/*  math coprocessor */
	 Hardvec=	Int0vec+14,	/*  hard disk */

	Int0ctl=	0x20,		/* control port (ICW1, OCW2, OCW3) */
	Int0aux=	0x21,		/* everything else (ICW2, ICW3, ICW4, OCW1) */
	Int1ctl=	0xA0,		/* control port */
	Int1aux=	0xA1,		/* everything else (ICW2, ICW3, ICW4, OCW1) */

	EOI=		0x20,		/* non-specific end of interrupt */
};

extern int	int0mask;	/* interrupts enabled for first 8259 */
extern int	int1mask;	/* interrupts enabled for second 8259 */

M carrera/main.c => carrera/main.c +40 -0
@@ 31,6 31,9 @@ Softtlb stlb[MAXMACH][STLBSIZE];
Conf	conf;
FPsave	initfp;

int	int0mask = 0xff;	/* interrupts enabled for first 8259 */
int	int1mask = 0xff;	/* interrupts enabled for second 8259 */

extern	uchar rdbgcode[];
extern	ulong	rdbglen;



@@ 217,6 220,43 @@ ioinit(int mapeisa)
	ptec = PPN(VideoCTL)|PTEGLOBL|PTEVALID|PTEWRITE|PTEUNCACHED;
	ptes = PPN(VideoMEM)|PTEGLOBL|PTEVALID|PTEWRITE|PTEUNCACHED;
	puttlbx(4, Screenvirt, ptes, ptec, PGSZ4M);

	/* for PC weenies */
	/*
	 *  Set up the first 8259 interrupt processor.
	 *  Make 8259 interrupts start at CPU vector Int0vec.
	 *  Set the 8259 as master with edge triggered
	 *  input with fully nested interrupts.
	 */
	EISAOUTB(Int0ctl, 0x11);		/* ICW1 - edge triggered, master,
						   ICW4 will be sent */
	EISAOUTB(Int0aux, Int0vec);		/* ICW2 - interrupt vector offset */
	EISAOUTB(Int0aux, 0x04);		/* ICW3 - have slave on level 2 */
	EISAOUTB(Int0aux, 0x01);		/* ICW4 - 8086 mode, not buffered */

	/*
	 *  Set up the second 8259 interrupt processor.
	 *  Make 8259 interrupts start at CPU vector Int0vec.
	 *  Set the 8259 as master with edge triggered
	 *  input with fully nested interrupts.
	 */
	EISAOUTB(Int1ctl, 0x11);		/* ICW1 - edge triggered, master,
						   ICW4 will be sent */
	EISAOUTB(Int1aux, Int1vec);		/* ICW2 - interrupt vector offset */
	EISAOUTB(Int1aux, 0x02);		/* ICW3 - I am a slave on level 2 */
	EISAOUTB(Int1aux, 0x01);		/* ICW4 - 8086 mode, not buffered */

	/*
	 *  pass #2 8259 interrupts to #1
	 */
	int0mask &= ~0x04;
	EISAOUTB(Int0aux, int0mask);

	/* enable all PC interrupts except the clock */
	int0mask |= 1<<(Clockvec&7);
	EISAOUTB(Int0aux, int0mask);
	int1mask = 0;
	EISAOUTB(Int1aux, int1mask);
}

/*

M carrera/trap.c => carrera/trap.c +19 -3
@@ 289,7 289,7 @@ intr(Ureg *ur)
{
	static uchar devint;
	ulong cause = ur->cause;
	ulong isr;
	ulong isr, vec;

	m->intr++;
	cause &= INTR7|INTR6|INTR5|INTR4|INTR3|INTR2|INTR1|INTR0;


@@ 319,8 319,9 @@ intr(Ureg *ur)
	}
	if(cause & INTR2) {
		isr = IO(ulong, R4030Isr);

		if(isr & (1<<5)) {
			audiointr();
			audiodmaintr();
			isr &= ~(1<<5);
		}
		if(isr) {


@@ 334,7 335,22 @@ intr(Ureg *ur)
	}
	if(cause & INTR4) {
		devint = IO(uchar, I386ack);
		iprint("i386ACK #%lux\n", devint);
		vec = devint&~0x7;

		/* reenable the 8259 interrupt */
		if(vec == Int0vec || vec == Int1vec){
			EISAOUTB(Int0ctl, EOI);
			if(vec == Int1vec)
				EISAOUTB(Int1ctl, EOI);
		}
		switch(devint) {
		default:
			iprint("i386ACK #%lux\n", devint);
			break;
		case 5:
			audiosbintr();
			break;
		}
		cause &= ~INTR4;
	}
	if(cause & INTR7) {

M port/portdat.h => port/portdat.h +23 -23
@@ 112,17 112,17 @@ enum
struct Path
{
	Ref;
	Path	*hash;
	Path	*parent;
	Pthash	*pthash;
	Path*	hash;
	Path*	parent;
	Pthash*	pthash;
	char	elem[NAMELEN];
};

struct Chan
{
	Ref;
	Chan	*next;			/* allocation */
	Chan	*link;
	Chan*	next;			/* allocation */
	Chan*	link;
	ulong	offset;			/* in file */
	ushort	type;
	ushort	dev;


@@ 130,20 130,20 @@ struct Chan
	ushort	flag;
	Qid	qid;
	int	fid;			/* for devmnt */
	Path	*path;
	Mount	*mnt;			/* mount point that derived Chan */
	Mount	*xmnt;			/* Last mount point crossed */
	Path*	path;
	Mount*	mnt;			/* mount point that derived Chan */
	Mount*	xmnt;			/* Last mount point crossed */
	ulong	mountid;
	Mntcache *mcp;			/* Mount cache pointer */
	union {
		void	*aux;
		void*	aux;
		Qid	pgrpid;		/* for #p/notepg */
		Mnt	*mntptr;	/* for devmnt */
		Mnt*	mntptr;		/* for devmnt */
		ulong	mid;		/* for ns in devproc */
	};
	Chan	*mchan;			/* channel to mounted server */
	Chan*	mchan;			/* channel to mounted server */
	Qid	mqid;			/* qid of root of mount point */
	Session *session;
	Session*session;
};

struct Dev


@@ 182,32 182,32 @@ struct Pthash
{
	QLock;
	int	npt;
	Path	*root;
	Path	*hash[NSCACHE];
	Path*	root;
	Path*	hash[NSCACHE];
};

struct Mntwalk
struct Mntwalk				/* state for /proc/#/ns */
{
	ulong	id;
	Mhead	*mh;
	Mount	*cm;
	Mhead*	mh;
	Mount*	cm;
};

struct Mount
{
	ulong	mountid;
	Mount	*next;
	Mhead	*head;
	Chan	*to;			/* channel replacing channel */
	Mount*	next;
	Mhead*	head;
	Chan*	to;			/* channel replacing channel */
	int	flag;
	char	spec[NAMELEN];
};

struct Mhead
{
	Chan	*from;			/* channel mounted upon */
	Mount	*mount;			/* what's mounted upon it */
	Mhead	*hash;			/* Hash chain */
	Chan*	from;			/* channel mounted upon */
	Mount*	mount;			/* what's mounted upon it */
	Mhead*	hash;			/* Hash chain */
};

struct Mnt

M port/portfns.h => port/portfns.h +10 -10
@@ 24,6 24,7 @@ void		chandevreset(void);
void		chanfree(Chan*);
void		chanrec(Mnt*);
void		checkalarms(void);
void		cinit(void);
Chan*		clone(Chan*, Chan*);
void		close(Chan*);
void		closeegrp(Egrp*);


@@ 35,9 36,13 @@ void		confinit(void);
void		confinit1(int);
int		consactive(void);
void		consdebug(void);
void		copen(Chan*);
void		copypage(Page*, Page*);
int		cread(Chan*, uchar*, int, ulong);
void		cupdate(Chan*, uchar*, int, ulong);
void		cursoroff(int);
void		cursoron(int);
void		cwrite(Chan*, uchar*, int, ulong);
int		decref(Ref*);
int		decrypt(void*, void*, int);
void		delay(int);


@@ 84,8 89,8 @@ void		gotolabel(Label*);
int		haswaitq(void*);
long		hostdomainwrite(char*, int);
long		hostownerwrite(char*, int);
void		hwcursset(ulong*, ulong*, int, int);
void		hwcursmove(int, int);
void		hwcursset(ulong*, ulong*, int, int);
void		iallocinit(void);
long		ibrk(ulong, int);
int		incref(Ref*);


@@ 124,14 129,14 @@ void		mmurelease(Proc*);
void		mmuswitch(Proc*);
void		mntdump(void);
void		mntrepl(char*);
int		mouseputc(int);
void		mousetrack(int, int, int);
int		mount(Chan*, Chan*, int, char*);
void		mountfree(Mount*);
void		mousebuttons(int);
void		mouseclock(void);
void		mousectl(char*);
int		mouseputc(int);
void		mousescreenupdate(void);
void		mousetrack(int, int, int);
int		msize(void*);
Chan*		namec(char*, int, int, ulong);
void		nameok(char*);


@@ 215,6 220,7 @@ int		screenbits(void);
void		screenupdate(void);
int		scsiexec(Target*, int, uchar*, int, void*, int);
int		scsiinv(int, int, Target**, uchar**, char*);
Target*		scsiunit(int, int);
long		seconds(void);
ulong		segattach(Proc*, ulong, char *, ulong, ulong);
void		segpage(Segment*, Page*);


@@ 249,6 255,7 @@ Chan*		walk(Chan*, char*, int);
void		wlock(RWlock*);
void		wunlock(RWlock*);
void*		xalloc(ulong);
void*		xallocz(ulong, int);
void		xfree(void*);
void		xhole(ulong, ulong);
void		xinit(void);


@@ 258,10 265,3 @@ Segment*	data2txt(Segment*);
Segment*	dupseg(Segment**, int, int);
Segment*	newseg(int, ulong, ulong);
Segment*	seg(Proc*, ulong, int);


int		cread(Chan*, uchar*, int, ulong);
void		cupdate(Chan*, uchar*, int, ulong);
void		cwrite(Chan*, uchar*, int, ulong);
void		copen(Chan*);
void		cinit(void);