~kris/9p

9hist

745f9ebb3ea466890fce627617f9ba1b942105ae — David du Colombier 33 years ago 918a1df
Plan 9 from Bell Labs 1992-09-29
3 files changed, 37 insertions(+), 1 deletions(-)

M pc/fns.h
M pc/io.h
M pc/mmu.c
M pc/fns.h => pc/fns.h +2 -0
@@ 32,6 32,7 @@ int	inb(int);
ushort	ins(int);
void	inss(int, void*, int);
void	insl(int, void*, int);
ulong	isamem(int);
void	kbdinit(void);
void	mathinit(void);
void	mmuinit(void);


@@ 45,6 46,7 @@ void	outb(int, int);
void	outs(int, ushort);
void	outss(int, void*, int);
void	outsl(int, void*, int);
void	pcicreset(void);
void	prhex(ulong);
void	procrestore(Proc*);
void	procsave(Proc*);

M pc/io.h => pc/io.h +1 -0
@@ 14,6 14,7 @@ enum
	 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,

M pc/mmu.c => pc/mmu.c +34 -1
@@ 89,6 89,11 @@ static ulong	*upt;		/* 2nd level page table for struct User */
#define MAXUMEG 64	/* maximum memory per user process in megabytes */
#define ONEMEG (1024*1024)

struct
{
	ulong addr; 	/* next available address for isa bus memory */
	ulong end;	/* one past available isa bus memory */
} isamemalloc;

/*
 *  Create a prototype page map that maps all of memory into


@@ 125,8 130,16 @@ mmuinit(void)
	ktoppg.va = (ulong)top;
	ktoppg.pa = ktoppg.va & ~KZERO;

	/*  map all memory to KZERO */
	/*  map all memory to KZERO (plus 1 meg for PCMCIA window) */
	npage = conf.topofmem/BY2PG;
	if(conf.topofmem < 64*MB){
		/* for ISA bus memory */
		isamemalloc.addr = conf.topofmem;
		isamemalloc.end = conf.topofmem + 2*MB;
		if(isamemalloc.end > 64*MB)
			isamemalloc.end = 64*MB;
		npage += (isamemalloc.end - isamemalloc.addr)/BY2PG;
	}
	nbytes = PGROUND(npage*BY2WD);		/* words of page map */
	nkpt = nbytes/BY2PG;			/* pages of page map */
	kpt = xspanalloc(nbytes, BY2PG, 0);


@@ 321,3 334,23 @@ invalidateu(void)
	/* flush cached mmu entries */
	putcr3(ktoppg.pa);
}

/*
 *  allocate some address space (already mapped into the kernel)
 *  for ISA bus memory.
 */
ulong
isamem(int len)
{
	ulong a, x;

	lock(&isamemalloc);
	len = PGROUND(len);
	x = isamemalloc.addr + len;
	if(x > isamemalloc.end)
		panic("isamem");
	a = isamemalloc.addr;
	isamemalloc.addr = x;
	unlock(&isamemalloc);
	return a;
}