From 745f9ebb3ea466890fce627617f9ba1b942105ae Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Tue, 29 Sep 1992 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1992-09-29 --- pc/fns.h | 2 ++ pc/io.h | 1 + pc/mmu.c | 35 ++++++++++++++++++++++++++++++++++- 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/pc/fns.h b/pc/fns.h index ebe7b22b03d579eaca9e3a1a25d10893bffbb647..6a3aa9a5005eee71af83a80daa6505df3d639971 100644 --- a/pc/fns.h +++ b/pc/fns.h @@ -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*); diff --git a/pc/io.h b/pc/io.h index d653db0721f9134902e604d072e26f9d71cd7390..426e0b2e3fc0a0d9ed837a4ffd96908d1f992270 100644 --- a/pc/io.h +++ b/pc/io.h @@ -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, diff --git a/pc/mmu.c b/pc/mmu.c index 0ac9ad0e8b17f27a9a8d6e6052d67288df58c000..f189bb48cac352aa77f9d93b53e363a5987f7771 100644 --- a/pc/mmu.c +++ b/pc/mmu.c @@ -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; +}