Index: atari/atari_init.c =================================================================== RCS file: /cvsroot/src/sys/arch/atari/atari/atari_init.c,v retrieving revision 1.68 diff -u -r1.68 atari_init.c --- atari/atari_init.c 15 Nov 2008 21:30:50 -0000 1.68 +++ atari/atari_init.c 31 Dec 2008 12:15:03 -0000 @@ -80,16 +80,16 @@ void start_c __P((int, u_int, u_int, u_int, char *)); static void atari_hwinit __P((void)); -static void cpu_init_kcorehdr __P((u_long)); +static void cpu_init_kcorehdr __P((paddr_t, paddr_t)); static void initcpu __P((void)); -static void mmu030_setup __P((st_entry_t *, u_int, pt_entry_t *, u_int, - pt_entry_t *, u_int, u_int)); -static void map_io_areas __P((pt_entry_t *, u_int, u_int)); +static void mmu030_setup __P((paddr_t, u_int, paddr_t, psize_t, paddr_t, + paddr_t)); +static void map_io_areas __P((paddr_t, psize_t, u_int)); static void set_machtype __P((void)); #if defined(M68040) || defined(M68060) -static void mmu040_setup __P((st_entry_t *, u_int, pt_entry_t *, u_int, - pt_entry_t *, u_int, u_int)); +static void mmu040_setup __P((paddr_t, u_int, paddr_t, psize_t, paddr_t, + paddr_t)); #endif /* @@ -118,13 +118,11 @@ static cpu_kcore_hdr_t cpu_kcore_hdr; extern u_int lowram; -extern u_int Sysptsize, Sysseg_pa, proc0paddr; +extern u_int Sysptsize, proc0paddr; extern pt_entry_t *Sysptmap; extern st_entry_t *Sysseg; -u_int *Sysmap; int machineid, mmutype, cputype, astpending; char *vmmap; -pv_entry_t pv_table; #if defined(M68040) || defined(M68060) extern int protostfree; #endif @@ -190,17 +188,21 @@ extern char end[]; extern void etext __P((void)); extern u_long protorp[2]; - u_int pstart; /* Next available physical address*/ - u_int vstart; /* Next available virtual address */ - u_int avail; - pt_entry_t *pt; - u_int ptsize, ptextra; + paddr_t pstart; /* Next available physical address */ + vaddr_t vstart; /* Next available virtual address */ + vsize_t avail; + paddr_t ptpa; + psize_t ptsize; + u_int ptextra; + vaddr_t kva; u_int tc, i; - u_int *pg; - u_int pg_proto; - u_int end_loaded; - u_long kbase; + pt_entry_t *pg, *epg; + pt_entry_t pg_proto; + vaddr_t end_loaded; + paddr_t kbase; u_int kstsize; + paddr_t Sysseg_pa; + paddr_t Sysptmap_pa; #if defined(_MILANHW_) /* XXX @@ -237,8 +239,9 @@ * the kernel ends at end() or esym. */ if(esym == NULL) - end_loaded = (u_int)end; - else end_loaded = (u_int)esym; + end_loaded = (vaddr_t) &end; + else + end_loaded = (vaddr_t) esym; /* * If we have enough fast-memory to put the kernel in and the @@ -246,7 +249,8 @@ */ if((reloc_kernel != 0) && (ttphysize >= end_loaded)) kbase = ttphystart; - else kbase = 0; + else + kbase = 0; /* * Determine the type of machine we are running on. This needs @@ -265,10 +269,19 @@ * pstart: start of usable ST memory * avail : size of ST memory available. */ - pstart = (u_int)end_loaded; - pstart = m68k_round_page(pstart); + vstart = (vaddr_t)end_loaded; + vstart = m68k_round_page(vstart); + pstart = (paddr_t)vstart; /* pre-reloc PA == kernel VA here */ avail = stphysize - pstart; - + + /* + * Save KVA of proc0 user-area and allocate it + */ + proc0paddr = vstart; + pstart += USPACE; + vstart += USPACE; + avail -= USPACE; + /* * Calculate the number of pages needed for Sysseg. * For the 68030, we need 256 descriptors (segment-table-entries). @@ -286,11 +299,21 @@ /* * allocate the kernel segment table */ - Sysseg = (st_entry_t *)pstart; - Sysseg_pa = (u_int)Sysseg + kbase; + Sysseg_pa = pstart; /* pre-reloc PA to init STEs */ + Sysseg = (st_entry_t *)vstart; pstart += kstsize * PAGE_SIZE; + vstart += kstsize * PAGE_SIZE; avail -= kstsize * PAGE_SIZE; - + + /* + * allocate kernel page table map + */ + Sysptmap_pa = pstart; /* pre-reloc PA to init PTEs */ + Sysptmap = (pt_entry_t *)vstart; + pstart += PAGE_SIZE; + vstart += PAGE_SIZE; + avail -= PAGE_SIZE; + /* * Determine the number of pte's we need for extra's like * ST I/O map's. @@ -311,48 +334,29 @@ * the I/O areas. The various I/O areas are mapped (virtually) at * the top of the address space mapped by 'pt' (ie. just below Sysmap). */ - pt = (pt_entry_t *)pstart; + ptpa = pstart; /* pre-reloc PA to init PTEs */ ptsize = (Sysptsize + howmany(ptextra, NPTEPG)) << PGSHIFT; pstart += ptsize; + vstart += ptsize; avail -= ptsize; - - /* - * allocate kernel page table map - */ - Sysptmap = (pt_entry_t *)pstart; - pstart += PAGE_SIZE; - avail -= PAGE_SIZE; - /* - * Set Sysmap; mapped after page table pages. Because I too (LWP) - * didn't understand the reason for this, I borrowed the following - * (sligthly modified) comment from mac68k/locore.s: - * LAK: There seems to be some confusion here about the next line, - * so I'll explain. The kernel needs some way of dynamically modifying - * the page tables for its own virtual memory. What it does is that it - * has a page table map. This page table map is mapped right after the - * kernel itself (in our implementation; in HP's it was after the I/O - * space). Therefore, the first three (or so) entries in the segment - * table point to the first three pages of the page tables (which - * point to the kernel) and the next entry in the segment table points - * to the page table map (this is done later). Therefore, the value - * of the pointer "Sysmap" will be something like 16M*3 = 48M. When - * the kernel addresses this pointer (e.g., Sysmap[0]), it will get - * the first longword of the first page map (== pt[0]). Since the - * page map mirrors the segment table, addressing any index of Sysmap - * will give you a PTE of the page maps which map the kernel. + /* + * We want Sysmap to be the first address mapped by Sysptmap. + * Sysmap is now placed at the end of Supervisor virtual address space. */ - Sysmap = (u_int *)(ptsize << (SEGSHIFT - PGSHIFT)); + Sysmap = (pt_entry_t *)-(NPTEPG * PAGE_SIZE); /* * Initialize segment tables */ #if defined(M68040) || defined(M68060) if (mmutype == MMU_68040) - mmu040_setup(Sysseg, kstsize, pt, ptsize, Sysptmap, 1, kbase); + mmu040_setup(Sysseg_pa, kstsize, ptpa, ptsize, Sysptmap_pa, + kbase); else #endif /* defined(M68040) || defined(M68060) */ - mmu030_setup(Sysseg, kstsize, pt, ptsize, Sysptmap, 1, kbase); + mmu030_setup(Sysseg_pa, kstsize, ptpa, ptsize, Sysptmap_pa, + kbase); /* * initialize kernel page table page(s). @@ -360,12 +364,15 @@ * - Text pages are RO * - Page zero is invalid */ - pg_proto = (0 + kbase) | PG_RO | PG_V; - pg = pt; - *pg++ = PG_NV; pg_proto += PAGE_SIZE; - for(i = PAGE_SIZE; i < (u_int)etext; - i += PAGE_SIZE, pg_proto += PAGE_SIZE) + pg_proto = (0 + kbase) /* relocated PA */ | PG_RO | PG_V; + pg = (pt_entry_t *)ptpa; + *pg++ = PG_NV; + + pg_proto += PAGE_SIZE; + for (kva = PAGE_SIZE; kva < (vaddr_t)etext; kva += PAGE_SIZE) { *pg++ = pg_proto; + pg_proto += PAGE_SIZE; + } /* * data, bss and dynamic tables are read/write @@ -380,18 +387,23 @@ */ if (mmutype == MMU_68040) { - if (kernel_copyback) - pg_proto |= PG_CCB; + if (kernel_copyback) + pg_proto |= PG_CCB; - for (; i < (u_int)Sysseg; i += PAGE_SIZE, pg_proto += PAGE_SIZE) - *pg++ = pg_proto; + for (; kva < (vaddr_t)Sysseg; kva += PAGE_SIZE) { + *pg++ = pg_proto; + pg_proto += PAGE_SIZE; + } - pg_proto = (pg_proto & ~PG_CCB) | PG_CI; - for (; i < pstart; i += PAGE_SIZE, pg_proto += PAGE_SIZE) - *pg++ = pg_proto; - pg_proto = (pg_proto & ~PG_CI); - if (kernel_copyback) - pg_proto |= PG_CCB; + pg_proto = (pg_proto & ~PG_CCB) | PG_CI; + for (; kva < (vaddr_t)Sysptmap; kva += PAGE_SIZE) { + *pg++ = pg_proto; + pg_proto += PAGE_SIZE; + } + + pg_proto = (pg_proto & ~PG_CI); + if (kernel_copyback) + pg_proto |= PG_CCB; } #endif /* defined(M68040) || defined(M68060) */ @@ -399,31 +411,23 @@ * go till end of data allocated so far * plus proc0 u-area (to be allocated) */ - for(; i < pstart + USPACE; i += PAGE_SIZE, pg_proto += PAGE_SIZE) + for (; kva < vstart; kva += PAGE_SIZE) { *pg++ = pg_proto; + pg_proto += PAGE_SIZE; + } /* * invalidate remainder of kernel PT */ - while(pg < &pt[ptsize/sizeof(pt_entry_t)]) + epg = (pt_entry_t *)ptpa; + epg = &epg[ptsize / sizeof(pt_entry_t)]; + while (pg < epg) *pg++ = PG_NV; /* * Map various I/O areas */ - map_io_areas(pt, ptsize, ptextra); - - /* - * Save KVA of proc0 user-area and allocate it - */ - proc0paddr = pstart; - pstart += USPACE; - avail -= USPACE; - - /* - * At this point, virtual and physical allocation starts to divert. - */ - vstart = pstart; + map_io_areas(ptpa, ptsize, ptextra); /* * Map the allocated space in ST-ram now. In the contig-case, there @@ -432,7 +436,8 @@ * Physcal space is already reserved! */ st_pool_virt = vstart; - pg = &pt[vstart / PAGE_SIZE]; + pg = (pt_entry_t *)ptpa; + pg = &pg[vstart / PAGE_SIZE]; pg_proto = st_pool_phys | PG_RW | PG_CI | PG_V; vstart += st_pool_size; while(pg_proto < (st_pool_phys + st_pool_size)) { @@ -447,12 +452,22 @@ * copying there....). */ page_zero = vstart; - pg = &pt[vstart / PAGE_SIZE]; + pg = (pt_entry_t *)ptpa; + pg = &pg[vstart / PAGE_SIZE]; *pg++ = PG_RW | PG_CI | PG_V; vstart += PAGE_SIZE; *pg = PG_RW | PG_CI | PG_V | PAGE_SIZE; vstart += PAGE_SIZE; + /* + * All necessary STEs and PTEs have been initialized. + * Update Sysseg_pa and Sysptmap_pa to point relocated PA. + */ + if (kbase) { + Sysseg_pa += kbase; + Sysptmap_pa += kbase; + } + lowram = 0 >> PGSHIFT; /* XXX */ /* @@ -475,7 +490,8 @@ usable_segs[0].start = PAGE_SIZE; usable_segs[1].start += pstart; } - else usable_segs[0].start += pstart; + else + usable_segs[0].start += pstart; /* * As all segment sizes are now valid, calculate page indexes and @@ -490,21 +506,20 @@ for (i = 0, physmem = 0; usable_segs[i].start; i++) physmem += usable_segs[i].end - usable_segs[i].start; physmem >>= PGSHIFT; - + /* * get the pmap module in sync with reality. */ - pmap_bootstrap(vstart, stio_addr); + pmap_bootstrap(vstart, Sysseg_pa); /* * Prepare to enable the MMU. * Setup and load SRP nolimit, share global, 4 byte PTE's */ protorp[0] = 0x80000202; - protorp[1] = (u_int)Sysseg + kbase; /* + segtable address */ - Sysseg_pa = (u_int)Sysseg + kbase; + protorp[1] = Sysseg_pa; /* + segtable address */ - cpu_init_kcorehdr(kbase); + cpu_init_kcorehdr(kbase, Sysseg_pa); /* * copy over the kernel (and all now initialized variables) @@ -552,7 +567,7 @@ tc = 0x82d08b00; __asm volatile ("pmove %0@,%%tc" : : "a" (&tc)); } - + /* Is this to fool the optimizer?? */ i = *(int *)proc0paddr; *(volatile int *)proc0paddr = i; @@ -709,17 +724,18 @@ * All I/O areas are virtually mapped at the end of the pt-table. */ static void -map_io_areas(pt, ptsize, ptextra) -pt_entry_t *pt; -u_int ptsize; /* Size of 'pt' in bytes */ -u_int ptextra; /* #of additional I/O pte's */ +map_io_areas(ptpa, ptsize, ptextra) + paddr_t ptpa; + psize_t ptsize; /* Size of 'pt' in bytes */ + u_int ptextra; /* #of additional I/O pte's */ { extern void bootm_init __P((vaddr_t, pt_entry_t *, u_long)); vaddr_t ioaddr; - pt_entry_t *pg, *epg; + pt_entry_t *pt, *pg, *epg; pt_entry_t pg_proto; u_long mask; + pt = (pt_entry_t *)ptpa; ioaddr = ((ptsize / sizeof(pt_entry_t)) - ptextra) * PAGE_SIZE; /* @@ -845,8 +861,9 @@ * Initialize the cpu_kcore_header. */ static void -cpu_init_kcorehdr(kbase) -u_long kbase; +cpu_init_kcorehdr(kbase, sysseg_pa) + paddr_t kbase; + paddr_t sysseg_pa; { cpu_kcore_hdr_t *h = &cpu_kcore_hdr; struct m68k_kcore_hdr *m = &h->un._m68k; @@ -883,7 +900,7 @@ /* * Initialize pointer to kernel segment table. */ - m->sysseg_pa = (u_int)Sysseg + kbase; + m->sysseg_pa = sysseg_pa; /* PA after relocation */ /* * Initialize relocation value such that: @@ -895,7 +912,7 @@ /* * Define the end of the relocatable range. */ - m->relocend = (u_int32_t)end; + m->relocend = (vaddr_t)end; for (i = 0; i < NMEM_SEGS; i++) { m->ram_segs[i].start = boot_segs[i].start; @@ -905,30 +922,27 @@ } void -mmu030_setup(sysseg, kstsize, pt, ptsize, sysptmap, sysptsize, kbase) - st_entry_t *sysseg; /* System segment table */ +mmu030_setup(sysseg_pa, kstsize, ptpa, ptsize, sysptmap_pa, kbase) + paddr_t sysseg_pa; /* System segment table */ u_int kstsize; /* size of 'sysseg' in pages */ - pt_entry_t *pt; /* Kernel page table */ - u_int ptsize; /* size of 'pt' in bytes */ - pt_entry_t *sysptmap; /* System page table */ - u_int sysptsize; /* size of 'sysptmap' in pages */ - u_int kbase; + paddr_t ptpa; /* Kernel page table */ + psize_t ptsize; /* size of 'pt' in bytes */ + paddr_t sysptmap_pa; /* System page table */ + paddr_t kbase; { - st_entry_t sg_proto, *sg; + st_entry_t sg_proto, *sg, *esg; pt_entry_t pg_proto, *pg, *epg; - sg_proto = ((u_int)pt + kbase) | SG_RW | SG_V; - pg_proto = ((u_int)pt + kbase) | PG_RW | PG_CI | PG_V; - /* * Map the page table pages in both the HW segment table - * and the software Sysptmap. Note that Sysptmap is also - * considered a PT page, hence the +sysptsize. + * and the software Sysptmap. */ - sg = sysseg; - pg = sysptmap; - epg = &pg[(ptsize >> PGSHIFT) + sysptsize]; - while(pg < epg) { + sg = (st_entry_t *)sysseg_pa; + pg = (pt_entry_t *)sysptmap_pa; + epg = &pg[ptsize >> PGSHIFT]; + sg_proto = (ptpa + kbase) /* relocated PA */ | SG_RW | SG_V; + pg_proto = (ptpa + kbase) /* relocated PA */ | PG_RW | PG_CI | PG_V; + while (pg < epg) { *sg++ = sg_proto; *pg++ = pg_proto; sg_proto += PAGE_SIZE; @@ -936,52 +950,65 @@ } /* - * invalidate the remainder of the tables + * Invalidate the remainder of the tables. */ - epg = &sysptmap[sysptsize * NPTEPG]; - while(pg < epg) { + esg = (st_entry_t *)sysseg_pa; + esg = &esg[256]; /* XXX should be TIA_SIZE */ + while (sg < esg) *sg++ = SG_NV; + epg = (pt_entry_t *)sysptmap_pa; + epg = &epg[NPTEPG]; /* XXX should be TIB_SIZE */ + while (pg < epg) *pg++ = PG_NV; - } + + /* + * Initialize the PTE for the last one to point Sysptmap. + */ + sg = (st_entry_t *)sysseg_pa; + sg = &sg[256 - 1]; /* XXX should be TIA_SIZE */ + pg = (pt_entry_t *)sysptmap_pa; + pg = &pg[256 - 1]; /* XXX should be TIA_SIZE */ + *sg = (sysptmap_pa + kbase) /* relocated PA */ | SG_RW | SG_V; + *pg = (sysptmap_pa + kbase) /* relocated PA */ | PG_RW | PG_CI | PG_V; } #if defined(M68040) || defined(M68060) void -mmu040_setup(sysseg, kstsize, pt, ptsize, sysptmap, sysptsize, kbase) - st_entry_t *sysseg; /* System segment table */ +mmu040_setup(sysseg_pa, kstsize, ptpa, ptsize, sysptmap_pa, kbase) + paddr_t sysseg_pa; /* System segment table */ u_int kstsize; /* size of 'sysseg' in pages */ - pt_entry_t *pt; /* Kernel page table */ - u_int ptsize; /* size of 'pt' in bytes */ - pt_entry_t *sysptmap; /* System page table */ - u_int sysptsize; /* size of 'sysptmap' in pages */ - u_int kbase; + paddr_t ptpa; /* Kernel page table */ + psize_t ptsize; /* size of 'pt' in bytes */ + paddr_t sysptmap_pa; /* System page table */ + paddr_t kbase; { int i; st_entry_t sg_proto, *sg, *esg; - pt_entry_t pg_proto; + pt_entry_t pg_proto, *pg, *epg; /* * First invalidate the entire "segment table" pages * (levels 1 and 2 have the same "invalid" values). */ - sg = sysseg; + sg = (st_entry_t *)sysseg_pa; esg = &sg[kstsize * NPTEPG]; while (sg < esg) *sg++ = SG_NV; /* * Initialize level 2 descriptors (which immediately - * follow the level 1 table). These should map 'pt' + 'sysptmap'. + * follow the level 1 table). * We need: * NPTEPG / SG4_LEV3SIZE * level 2 descriptors to map each of the nptpages + 1 * pages of PTEs. Note that we set the "used" bit * now to save the HW the expense of doing it. */ - i = ((ptsize >> PGSHIFT) + sysptsize) * (NPTEPG / SG4_LEV3SIZE); - sg = &sysseg[SG4_LEV1SIZE]; + i = (ptsize >> PGSHIFT) * (NPTEPG / SG4_LEV3SIZE); + sg = (st_entry_t *)sysseg_pa; + sg = &sg[SG4_LEV1SIZE]; esg = &sg[i]; - sg_proto = ((u_int)pt + kbase) | SG_U | SG_RW | SG_V; + sg_proto = (ptpa + kbase) /* relocated PA */ | SG_U | SG_RW | SG_V; while (sg < esg) { *sg++ = sg_proto; sg_proto += (SG4_LEV3SIZE * sizeof (st_entry_t)); @@ -992,32 +1019,62 @@ * roundup(num, SG4_LEV2SIZE) / SG4_LEVEL2SIZE * level 1 descriptors to map the 'num' level 2's. */ - i = roundup(i, SG4_LEV2SIZE) / SG4_LEV2SIZE; - protostfree = (-1 << (i + 1)) /* & ~(-1 << MAXKL2SIZE) */; - sg = sysseg; + i = roundup(i, SG4_LEV2SIZE) / SG4_LEV2SIZE; + protostfree = (-1 << (i + 2)) /* & ~(-1 << MAXKL2SIZE) */; + sg = (st_entry_t *)sysseg_pa; esg = &sg[i]; - sg_proto = ((u_int)&sg[SG4_LEV1SIZE] + kbase) | SG_U | SG_RW |SG_V; + sg_proto = ((paddr_t)&sg[SG4_LEV1SIZE] + kbase) /* relocated PA */ + | SG_U | SG_RW | SG_V; while (sg < esg) { *sg++ = sg_proto; sg_proto += (SG4_LEV2SIZE * sizeof(st_entry_t)); } + /* Sysmap is last entry in level 1 */ + sg = (st_entry_t *)sysseg_pa; + sg = &sg[SG4_LEV1SIZE - 1]; + *sg = sg_proto; + /* - * Initialize sysptmap - */ - sg = sysptmap; - esg = &sg[(ptsize >> PGSHIFT) + sysptsize]; - pg_proto = ((u_int)pt + kbase) | PG_RW | PG_CI | PG_V; + * Kernel segment table at end of next level 2 table + */ + /* XXX fix calculations XXX */ + i = ((((ptsize >> PGSHIFT) + 3) & -2) - 1) * (NPTEPG / SG4_LEV3SIZE); + sg = (st_entry_t *)sysseg_pa; + sg = &sg[SG4_LEV1SIZE + i]; + esg = &sg[NPTEPG / SG4_LEV3SIZE]; + sg_proto = (sysptmap_pa + kbase) /* relocated PA */ + | SG_U | SG_RW | SG_V; while (sg < esg) { - *sg++ = pg_proto; + *sg++ = sg_proto; + sg_proto += (SG4_LEV3SIZE * sizeof (st_entry_t)); + } + + /* + * Initialize Sysptmap + */ + pg = (pt_entry_t *)sysptmap_pa; + epg = &pg[ptsize >> PGSHIFT]; + pg_proto = (ptpa + kbase) /* relocated PA */ | PG_RW | PG_CI | PG_V; + while (pg < epg) { + *pg++ = pg_proto; pg_proto += PAGE_SIZE; } + /* - * Invalidate rest of Sysptmap page + * Invalidate rest of Sysptmap page. */ - esg = &sysptmap[sysptsize * NPTEPG]; - while (sg < esg) - *sg++ = SG_NV; + epg = (pt_entry_t *)sysptmap_pa; + epg = &epg[NPTEPG]; /* XXX: should be TIB_SIZE */ + while (pg < epg) + *pg++ = PG_NV; + + /* + * Initialize the PTE for the last one to point Sysptmap. + */ + pg = (pt_entry_t *)sysptmap_pa; + pg = &pg[256 - 1]; /* XXX: should be TIA_SIZE */ + *pg = (sysptmap_pa + kbase) /* relocated PA */ | PG_RW | PG_CI | PG_V; } #endif /* M68040 */ @@ -1121,7 +1178,7 @@ s = stp; { - es = s + (ATARI_STSIZE >> 2); + es = s + (M68K_STSIZE >> 2); shift = SG_ISHIFT; } Index: atari/pmap.c =================================================================== RCS file: /cvsroot/src/sys/arch/atari/atari/pmap.c,v retrieving revision 1.109 diff -u -r1.109 pmap.c --- atari/pmap.c 19 Dec 2008 18:49:38 -0000 1.109 +++ atari/pmap.c 31 Dec 2008 12:15:03 -0000 @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -/* +/* * Copyright (c) 1991 Regents of the University of California. * All rights reserved. * @@ -110,13 +110,12 @@ #include -#include -#include - #include #include #include +#include + /* * Allocate various and sundry SYSMAPs used in the days of old VM * and not yet converted. XXX. @@ -177,8 +176,8 @@ #define PMAP_DPRINTF(l, x) if (pmapdebug & (l)) printf x -static void pmap_check_wiring __P((const char *, vaddr_t)); -static void pmap_pvdump __P((paddr_t)); +static void pmap_check_wiring(const char *, vaddr_t); +static void pmap_pvdump(paddr_t); #else #define PMAP_DPRINTF(l, x) #endif @@ -187,22 +186,26 @@ * Get STEs and PTEs for user/kernel address space */ #if defined(M68040) || defined(M68060) - -#define pmap_ste(m, v) (&((m)->pm_stab[(vaddr_t)(v) >> pmap_ishift])) +#if defined(M68020) || defined(M68030) +#define pmap_ste(m, v) (&((m)->pm_stab[(vaddr_t)(v) \ + >> (mmutype == MMU_68040 ? SG4_SHIFT1 : SG_ISHIFT)])) +#else +#define pmap_ste(m, v) (&((m)->pm_stab[(vaddr_t)(v) >> SG4_SHIFT1])) +#endif #define pmap_ste1(m, v) (&((m)->pm_stab[(vaddr_t)(v) >> SG4_SHIFT1])) /* XXX assumes physically contiguous ST pages (if more than one) */ #define pmap_ste2(m, v) \ - (&((m)->pm_stab[(u_int *)(*(u_int *)pmap_ste1(m,v) & SG4_ADDR1) \ + (&((m)->pm_stab[(st_entry_t *)(*(u_int *)pmap_ste1(m,v) & SG4_ADDR1) \ - (m)->pm_stpa + (((v) & SG4_MASK2) >> SG4_SHIFT2)])) #define pmap_ste_v(m, v) \ - (mmutype == MMU_68040 \ - ? ((*pmap_ste1(m, v) & SG_V) && \ + (mmutype == MMU_68040 \ + ? ((*pmap_ste1(m, v) & SG_V) && \ (*pmap_ste2(m, v) & SG_V)) \ : (*pmap_ste(m, v) & SG_V)) -#else /* defined(M68040) || defined(M68060) */ -#define pmap_ste(m, v) (&((m)->pm_stab[(vaddr_t)(v) >> SG_ISHIFT])) +#else /* defined(M68040) || defined(M68060) */ +#define pmap_ste(m, v) (&((m)->pm_stab[(vaddr_t)(v) >> SG_ISHIFT])) #define pmap_ste_v(m, v) (*pmap_ste(m, v) & SG_V) -#endif /* defined(M68040) || defined(M68060) */ +#endif /* defined(M68040) || defined(M68060) */ #define pmap_pte(m, v) (&((m)->pm_ptab[(vaddr_t)(v) >> PG_SHIFT])) @@ -264,18 +267,21 @@ * Segtabzero is an empty segment table which all processes share til they * reference something. */ -u_int *Sysseg, *Sysseg_pa; -u_int *Sysmap, *Sysptmap; -u_int *Segtabzero, *Segtabzeropa; +st_entry_t *Sysseg; +pt_entry_t *Sysmap, *Sysptmap; +st_entry_t *Segtabzero, *Segtabzeropa; vsize_t Sysptsize = VM_KERNEL_PT_PAGES; -static struct pmap kernel_pmap_store; -struct pmap *const kernel_pmap_ptr = &kernel_pmap_store; +struct pv_entry *pv_table; /* array of entries, one per page */ + +static struct pmap kernel_pmap_store; +struct pmap *const kernel_pmap_ptr = &kernel_pmap_store; struct vm_map *pt_map; struct vm_map_kernel pt_map_store; -vsize_t mem_size; /* memory size in bytes */ +paddr_t avail_start; /* PA of first available physical page */ paddr_t avail_end; /* PA of last available physical page */ +vsize_t mem_size; /* memory size in bytes */ vaddr_t virtual_avail; /* VA of first avail page (after kernel bss)*/ vaddr_t virtual_end; /* VA of last avail page (end of kernel AS) */ int page_cnt; /* number of pages managed by the VM system */ @@ -284,38 +290,39 @@ TAILQ_HEAD(pv_page_list, pv_page) pv_page_freelist; int pv_nfree; #if defined(M68040) || defined(M68060) -static int pmap_ishift; /* segment table index shift */ int protostfree; /* prototype (default) free ST map */ #endif -extern void * msgbufaddr; -extern vaddr_t msgbufpa; +pt_entry_t *caddr1_pte; /* PTE for CADDR1 */ +pt_entry_t *caddr2_pte; /* PTE for CADDR2 */ + +extern vaddr_t reserve_dumppages(vaddr_t); + +bool pmap_testbit(paddr_t, int); +int pmap_enter_ptpage(pmap_t, vaddr_t, bool); +static void pmap_ptpage_addref(vaddr_t); +static int pmap_ptpage_delref(vaddr_t); +static void pmap_changebit(vaddr_t, int, bool); +struct pv_entry * pmap_alloc_pv(void); +void pmap_free_pv(struct pv_entry *); +void pmap_pinit(pmap_t); +void pmap_release(pmap_t); +static void pmap_remove_mapping(pmap_t, vaddr_t, pt_entry_t *, int); -static bool pmap_testbit __P((paddr_t, int)); -static int pmap_enter_ptpage __P((pmap_t, vaddr_t, bool)); -static struct pv_entry* pmap_alloc_pv __P((void)); -static void pmap_free_pv __P((struct pv_entry *)); -static void pmap_pinit __P((pmap_t)); -static void pmap_ptpage_addref __P((vaddr_t)); -static int pmap_ptpage_delref __P((vaddr_t)); -static void pmap_release __P((pmap_t)); -static void pmap_remove_mapping __P((pmap_t, vaddr_t, pt_entry_t *, - int)); -static void atari_protection_init __P((void)); -static void pmap_collect1 __P((pmap_t, paddr_t, paddr_t)); +void pmap_collect1(pmap_t, paddr_t, paddr_t); /* pmap_remove_mapping flags */ -#define PRM_TFLUSH 0x01 -#define PRM_CFLUSH 0x02 -#define PRM_KEEPPTPAGE 0x04 +#define PRM_TFLUSH 0x01 +#define PRM_CFLUSH 0x02 +#define PRM_KEEPPTPAGE 0x04 /* * All those kernel PT submaps that BSD is so fond of */ -void *CADDR1, *CADDR2; -u_int *CMAP1, *CMAP2, *vmpte, *msgbufmap; +void *CADDR1, *CADDR2; +char *vmmap; -#define PAGE_IS_MANAGED(pa) (pmap_initialized \ +#define PAGE_IS_MANAGED(pa) (pmap_initialized \ && vm_physseg_find(atop((pa)), NULL) != -1) static inline struct pv_entry *pa_to_pvh(paddr_t pa); @@ -340,117 +347,11 @@ } /* - * The preallocated virtual memory range used by the I/O area. Their - * values are passed to pmap_bootstrap(). - */ -static u_int atarihwaddr; - -/* - * Bootstrap the system enough to run with virtual memory. - * Map the kernel's code and data, and allocate the system page table. - * - * On the HP this is called after mapping has already been enabled - * and just syncs the pmap module with what has already been done. - * [We can't call it easily with mapping off since the kernel is not - * mapped with PA == VA, hence we would have to relocate every address - * from the linked base (virtual) address 0 to the actual (physical) - * address of 0xFFxxxxxx.] + * Initialize the pmap module. + * Called by vm_init, to initialize any structures that the pmap + * system needs to map virtual memory. */ void -pmap_bootstrap(kernel_size, hw_addr) -psize_t kernel_size; -u_int hw_addr; -{ - vaddr_t va; - u_int *pte; - int i; - - /* - * Record start & size of I/O area for use by pmap_init() - */ - - atarihwaddr = hw_addr; - - /* - * Announce page-size to the VM-system - */ - uvmexp.pagesize = NBPG; - uvm_setpagesize(); - - /* - * Setup physical address ranges - */ - for (i = 0; usable_segs[i+1].start; i++) - ; - /* XXX: allow for msgbuf */ - usable_segs[i].end -= m68k_round_page(MSGBUFSIZE); - avail_end = msgbufpa = usable_segs[i].end; - - /* - * Count physical memory - */ - for (i = mem_size = 0; i < NMEM_SEGS; i++) { - if (boot_segs[i].start == boot_segs[i].end) - break; - mem_size += boot_segs[i].end - boot_segs[i].start; - } - - /* - * Announce available memory to the VM-system - */ - for (i = 0; usable_segs[i].start; i++) - uvm_page_physload(atop(usable_segs[i].start), - atop(usable_segs[i].end), - atop(usable_segs[i].start), - atop(usable_segs[i].end), - VM_FREELIST_DEFAULT); - - virtual_avail = VM_MIN_KERNEL_ADDRESS + kernel_size; - virtual_end = VM_MAX_KERNEL_ADDRESS; - - /* - * Initialize protection array. - */ - atari_protection_init(); - - /* - * Kernel page/segment table allocated in locore, - * just initialize pointers. - */ - pmap_kernel()->pm_stpa = Sysseg_pa; - pmap_kernel()->pm_stab = Sysseg; - pmap_kernel()->pm_ptab = Sysmap; -#if defined(M68040) || defined(M68060) - if (mmutype == MMU_68040) { - pmap_ishift = SG4_SHIFT1; - pmap_kernel()->pm_stfree = protostfree; - } - else pmap_ishift = SG_ISHIFT; -#endif - - simple_lock_init(&pmap_kernel()->pm_lock); - pmap_kernel()->pm_count = 1; - - /* - * Allocate all the submaps we need - */ -#define SYSMAP(c, p, v, n) \ - v = (c)va; va += ((n)*PAGE_SIZE); p = pte; pte += (n); - - va = virtual_avail; - pte = pmap_pte(pmap_kernel(), va); - - SYSMAP(void * ,CMAP1 ,CADDR1 ,1 ) - SYSMAP(void * ,CMAP2 ,CADDR2 ,1 ) - SYSMAP(void * ,vmpte ,vmmap ,1 ) - SYSMAP(void * ,msgbufmap ,msgbufaddr ,btoc(MSGBUFSIZE) ) - - DCIS(); - - virtual_avail = reserve_dumppages(va); -} - -void pmap_init() { vaddr_t addr, addr2; @@ -458,17 +359,30 @@ u_int npg; struct pv_entry *pv; char *attr; - int rv, bank; -#ifdef M68060 - struct kpt_page *kptp; + int rv, bank; +#if defined(M68060) + struct kpt_page *kptp; + paddr_t paddr; #endif #ifdef DEBUG - if (pmapdebug & PDB_FOLLOW) { + if (pmapdebug & PDB_FOLLOW) printf("pmap_init()\n"); +#endif + + /* + * Before we do anything else, initialize the PTE pointers + * used by pmap_zero_page() and pmap_copy_page(). + */ + caddr1_pte = pmap_pte(pmap_kernel(), CADDR1); + caddr2_pte = pmap_pte(pmap_kernel(), CADDR2); + +#ifdef DEBUG + if (pmapdebug & PDB_INIT) { printf("pmap_init: Sysseg %p, Sysmap %p, Sysptmap %p\n", - Sysseg, Sysmap, Sysptmap); - printf(" vstart %lx, vend %lx\n", virtual_avail, virtual_end); + Sysseg, Sysmap, Sysptmap); + printf(" pstart %lx, pend %lx, vstart %lx, vend %lx\n", + avail_start, avail_end, virtual_avail, virtual_end); } #endif @@ -484,18 +398,19 @@ vm_physmem[bank].end << PGSHIFT, page_cnt << PGSHIFT); #endif } - s = ATARI_STSIZE; /* Segtabzero */ - s += page_cnt * sizeof(struct pv_entry); /* pv table */ + s = M68K_STSIZE; /* Segtabzero */ + s += page_cnt * sizeof(struct pv_entry); /* pv table */ s += page_cnt * sizeof(char); /* attribute table */ s = round_page(s); addr = uvm_km_alloc(kernel_map, s, 0, UVM_KMF_WIRED | UVM_KMF_ZERO); if (addr == 0) panic("pmap_init: can't allocate data structures"); - Segtabzero = (u_int *) addr; + Segtabzero = (u_int *) addr; (void) pmap_extract(pmap_kernel(), addr, (paddr_t *)(void *)&Segtabzeropa); - addr += ATARI_STSIZE; - pv_table = (pv_entry_t) addr; + addr += M68K_STSIZE; + + pv_table = (struct pv_entry *) addr; addr += page_cnt * sizeof(struct pv_entry); pmap_attributes = (char *) addr; @@ -523,10 +438,10 @@ /* * Allocate physical memory for kernel PT pages and their management. - * we need enough pages to map the page tables for each process + * we need enough pages to map the page tables for each process * plus some slop. */ - npg = howmany(((maxproc + 16) * ATARI_UPTSIZE / NPTEPG), PAGE_SIZE); + npg = howmany(((maxproc + 16) * M68K_MAX_PTSIZE / NPTEPG), PAGE_SIZE); #ifdef NKPTADD npg += NKPTADD; #else @@ -568,40 +483,35 @@ kpt_pages->kpt_va = addr2; (void) pmap_extract(pmap_kernel(), addr2, (paddr_t *)&kpt_pages->kpt_pa); - } while (addr != addr2); + #ifdef DEBUG kpt_stats.kpttotal = atop(s); if (pmapdebug & PDB_INIT) printf("pmap_init: KPT: %ld pages from %lx to %lx\n", - atop(s), addr, addr + s); + atop(s), addr, addr + s); #endif /* - * Slightly modified version of kmem_suballoc() to get page table - * map where we want it. + * Allocate the segment table map and the page table map. */ - addr = ATARI_UPTBASE; - if (ATARI_UPTMAXSIZE / ATARI_UPTSIZE < maxproc) { - s = ATARI_UPTMAXSIZE; + addr = M68K_PTBASE; + if (M68K_PTMAXSIZE / M68K_MAX_PTSIZE < maxproc) { + s = M68K_PTMAXSIZE; /* * XXX We don't want to hang when we run out of page * tables, so we lower maxproc so that fork will fail - * instead. Note that root could still raise this + * instead. Note that root could still raise this * value through sysctl(3). */ - maxproc = ATARI_UPTMAXSIZE / ATARI_UPTSIZE; - } - else s = maxproc * ATARI_UPTSIZE; + maxproc = M68K_PTMAXSIZE / M68K_MAX_PTSIZE; + } else + s = maxproc * M68K_MAX_PTSIZE; pt_map = uvm_km_suballoc(kernel_map, &addr, &addr2, s, 0, true, &pt_map_store); -#ifdef DEBUG - if (pmapdebug & PDB_INIT) - printf("pmap_init: pt_map [%lx - %lx)\n", addr, addr2); -#endif #if defined(M68040) || defined(M68060) if (mmutype == MMU_68040) protostfree = ~1 & ~(-1 << MAXUL2SIZE); @@ -628,11 +538,11 @@ kptp = kptp->kpt_next; } - addr2 = (vaddr_t)Segtabzeropa; - while (addr2 < (vaddr_t)Segtabzeropa + ATARI_STSIZE) { - pmap_changebit(addr2, PG_CCB, 0); - pmap_changebit(addr2, PG_CI, 1); - addr2 += PAGE_SIZE; + paddr = (paddr_t)Segtabzeropa; + while (paddr < (paddr_t)Segtabzeropa + M68K_STSIZE) { + pmap_changebit(paddr, PG_CCB, 0); + pmap_changebit(paddr, PG_CI, 1); + paddr += PAGE_SIZE; } DCIS(); @@ -679,7 +589,7 @@ pmap_free_pv(pv) struct pv_entry *pv; { - register struct pv_page *pvp; + struct pv_page *pvp; pvp = (struct pv_page *) trunc_page((vaddr_t)pv); switch (++pvp->pvp_pgi.pgi_nfree) { @@ -698,6 +608,7 @@ } } + /* * Used to map a range of physical addresses into kernel * virtual address space. @@ -710,7 +621,7 @@ vaddr_t virt; paddr_t start; paddr_t end; - int prot; + int prot; { #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) @@ -740,7 +651,7 @@ pmap_t pmap_create() { - register pmap_t pmap; + pmap_t pmap; #ifdef DEBUG if (pmapdebug & (PDB_FOLLOW|PDB_CREATE)) @@ -756,9 +667,9 @@ * Initialize a preallocated and zeroed pmap structure, * such as one in a vmspace structure. */ -static void +void pmap_pinit(pmap) - register pmap_t pmap; + pmap_t pmap; { #ifdef DEBUG @@ -778,7 +689,6 @@ pmap->pm_stfree = protostfree; #endif pmap->pm_count = 1; - simple_lock_init(&pmap->pm_lock); } /* @@ -788,7 +698,7 @@ */ void pmap_destroy(pmap) - register pmap_t pmap; + pmap_t pmap; { int count; @@ -796,9 +706,7 @@ if (pmapdebug & PDB_FOLLOW) printf("pmap_destroy(%p)\n", pmap); #endif - simple_lock(&pmap->pm_lock); count = --pmap->pm_count; - simple_unlock(&pmap->pm_lock); if (count == 0) { pmap_release(pmap); free((void *)pmap, M_VMPMAP); @@ -810,9 +718,9 @@ * Called when a pmap initialized by pmap_pinit is being released. * Should only be called if the map contains no valid mappings. */ -static void +void pmap_release(pmap) - register pmap_t pmap; + pmap_t pmap; { #ifdef DEBUG @@ -821,17 +729,16 @@ #endif #ifdef notdef /* DIAGNOSTIC */ /* count would be 0 from pmap_destroy... */ - simple_lock(&pmap->pm_lock); if (pmap->pm_count != 1) panic("pmap_release count"); #endif if (pmap->pm_ptab) { pmap_remove(pmap_kernel(), (vaddr_t)pmap->pm_ptab, - (vaddr_t)pmap->pm_ptab + ATARI_UPTSIZE); + (vaddr_t)pmap->pm_ptab + M68K_MAX_PTSIZE); uvm_km_pgremove((vaddr_t)pmap->pm_ptab, - (vaddr_t)pmap->pm_ptab + ATARI_UPTSIZE); + (vaddr_t)pmap->pm_ptab + M68K_MAX_PTSIZE); uvm_km_free(pt_map, (vaddr_t)pmap->pm_ptab, - ATARI_UPTSIZE, UVM_KMF_VAONLY); + M68K_MAX_PTSIZE, UVM_KMF_VAONLY); } KASSERT(pmap->pm_stab == Segtabzero); } @@ -848,9 +755,7 @@ printf("pmap_reference(%p)\n", pmap); #endif if (pmap != NULL) { - simple_lock(&pmap->pm_lock); pmap->pm_count++; - simple_unlock(&pmap->pm_lock); } } @@ -862,12 +767,12 @@ */ void pmap_remove(pmap, sva, eva) - register pmap_t pmap; + pmap_t pmap; vaddr_t sva, eva; { - register paddr_t pa; - register vaddr_t va; - register u_int *pte; + paddr_t pa; + vaddr_t va; + u_int *pte; int flags; #ifdef DEBUG @@ -877,22 +782,22 @@ #endif flags = active_pmap(pmap) ? PRM_TFLUSH : 0; for (va = sva; va < eva; va += PAGE_SIZE) { - /* - * Weed out invalid mappings. - * Note: we assume that the segment table is always allocated. - */ - if (!pmap_ste_v(pmap, va)) { - /* XXX: avoid address wrap around */ - if (va >= m68k_trunc_seg((vaddr_t)-1)) - break; - va = m68k_round_seg(va + PAGE_SIZE) - PAGE_SIZE; - continue; - } - pte = pmap_pte(pmap, va); - pa = pmap_pte_pa(pte); - if (pa == 0) - continue; - pmap_remove_mapping(pmap, va, pte, flags); + /* + * Weed out invalid mappings. + * Note: we assume that the segment table is always allocated. + */ + if (!pmap_ste_v(pmap, va)) { + /* XXX: avoid address wrap around */ + if (va >= m68k_trunc_seg((vaddr_t)-1)) + break; + va = m68k_round_seg(va + PAGE_SIZE) - PAGE_SIZE; + continue; + } + pte = pmap_pte(pmap, va); + pa = pmap_pte_pa(pte); + if (pa == 0) + continue; + pmap_remove_mapping(pmap, va, pte, flags); } } @@ -906,9 +811,9 @@ struct vm_page *pg; vm_prot_t prot; { - paddr_t pa = VM_PAGE_TO_PHYS(pg); - register pv_entry_t pv; + struct pv_entry *pv; int s; + paddr_t pa = VM_PAGE_TO_PHYS(pg); #ifdef DEBUG if ((pmapdebug & (PDB_FOLLOW|PDB_PROTECT)) || @@ -928,22 +833,22 @@ pv = pa_to_pvh(pa); s = splvm(); while (pv->pv_pmap != NULL) { - pt_entry_t *pte; + pt_entry_t *pte; - pte = pmap_pte(pv->pv_pmap, pv->pv_va); + pte = pmap_pte(pv->pv_pmap, pv->pv_va); #ifdef DEBUG - if (!pmap_ste_v(pv->pv_pmap,pv->pv_va) || + if (!pmap_ste_v(pv->pv_pmap,pv->pv_va) || pmap_pte_pa(pte) != pa) { - printf ("pmap_page_protect: va %08lx, pmap_ste_v %d pmap_pte_pa %08x/%08lx\n", - pv->pv_va, pmap_ste_v(pv->pv_pmap,pv->pv_va), - pmap_pte_pa(pmap_pte(pv->pv_pmap,pv->pv_va)),pa); - printf (" pvh %p pv %p pv_next %p\n", pa_to_pvh(pa), pv, pv->pv_next); + printf ("pmap_page_protect: va %lx, pmap_ste_v %d pmap_pte_pa %08x/%lx\n", + pv->pv_va, pmap_ste_v(pv->pv_pmap,pv->pv_va), + pmap_pte_pa(pmap_pte(pv->pv_pmap,pv->pv_va)),pa); + printf (" pvh %p pv %p pv_next %p\n", pa_to_pvh(pa), pv, pv->pv_next); panic("pmap_page_protect: bad mapping"); } #endif - pmap_remove_mapping(pv->pv_pmap, pv->pv_va, - pte, PRM_TFLUSH|PRM_CFLUSH); + pmap_remove_mapping(pv->pv_pmap, pv->pv_va, + pte, PRM_TFLUSH|PRM_CFLUSH); } splx(s); break; @@ -956,12 +861,12 @@ */ void pmap_protect(pmap, sva, eva, prot) - register pmap_t pmap; - vaddr_t sva, eva; - vm_prot_t prot; + pmap_t pmap; + vaddr_t sva, eva; + vm_prot_t prot; { - register u_int *pte; - register vaddr_t va; + u_int *pte; + vaddr_t va; bool needtflush; int isro; @@ -1033,14 +938,14 @@ int pmap_enter(pmap, va, pa, prot, flags) - register pmap_t pmap; + pmap_t pmap; vaddr_t va; - register paddr_t pa; + paddr_t pa; vm_prot_t prot; int flags; { - register u_int *pte; - register int npte; + u_int *pte; + int npte; paddr_t opa; bool cacheable = true; bool checkpv = true; @@ -1050,7 +955,7 @@ #ifdef DEBUG if (pmapdebug & (PDB_FOLLOW|PDB_ENTER)) printf("pmap_enter(%p, %lx, %lx, %x, %x)\n", - pmap, va, pa, prot, wired); + pmap, va, pa, prot, wired); if (pmap == pmap_kernel()) enter_stats.kernel++; else @@ -1060,8 +965,8 @@ * For user mapping, allocate kernel VM resources if necessary. */ if (pmap->pm_ptab == NULL) - pmap->pm_ptab = (u_int *) - uvm_km_alloc(pt_map, ATARI_UPTSIZE, 0, + pmap->pm_ptab = (pt_entry_t *) + uvm_km_alloc(pt_map, M68K_MAX_PTSIZE, 0, UVM_KMF_VAONLY | (can_fail ? UVM_KMF_NOWAIT : UVM_KMF_WAITVA)); if (pmap->pm_ptab == NULL) @@ -1148,7 +1053,7 @@ * since pmap_enter can be called at interrupt time. */ if (PAGE_IS_MANAGED(pa)) { - register pv_entry_t pv, npv; + struct pv_entry *pv, *npv; int s; #ifdef DEBUG @@ -1225,23 +1130,23 @@ */ #if defined(M68040) || defined(M68060) #if DEBUG - if (pmapdebug & 0x10000 && mmutype == MMU_68040 && + if (pmapdebug & 0x10000 && mmutype == MMU_68040 && pmap == pmap_kernel()) { - struct proc *cp = curproc; const char *s; - if (va >= ATARI_UPTBASE && - va < (ATARI_UPTBASE + ATARI_UPTMAXSIZE)) + struct proc *cp = curproc; + if (va >= M68K_PTBASE && + va < (M68K_PTBASE + M68K_PTMAXSIZE)) s = "UPT"; - else if (va >= (u_int)Sysmap && - va < ((u_int)Sysmap + ATARI_KPTSIZE)) + else if (va >= (u_int)Sysmap && + va < ((u_int)Sysmap + M68K_MAX_KPTSIZE)) s = "KPT"; - else if (va >= (u_int)pmap->pm_stab && - va < ((u_int)pmap->pm_stab + ATARI_STSIZE)) + else if (va >= (u_int)pmap->pm_stab && + va < ((u_int)pmap->pm_stab + M68K_STSIZE)) s = "KST"; - else if (cp && + else if (cp && va >= (u_int)cp->p_vmspace->vm_map.pmap->pm_stab && va < ((u_int)cp->p_vmspace->vm_map.pmap->pm_stab + - ATARI_STSIZE)) + M68K_STSIZE)) s = "UST"; else s = "other"; @@ -1251,8 +1156,8 @@ } #endif if (mmutype == MMU_68040 && pmap == pmap_kernel() && ( - (va >= ATARI_UPTBASE && va < (ATARI_UPTBASE + ATARI_UPTMAXSIZE)) || - (va >= (u_int)Sysmap && va < ((u_int)Sysmap + ATARI_KPTSIZE)))) + (va >= M68K_PTBASE && va < (M68K_PTBASE + (u_int)M68K_PTMAXSIZE)) || + (va >= (u_int)Sysmap && va < ((u_int)Sysmap + M68K_MAX_KPTSIZE)))) cacheable = false; /* don't cache user page tables */ #endif npte = (pa & PG_FRAME) | pte_prot(pmap, prot) | PG_V; @@ -1260,10 +1165,18 @@ if (wired) npte |= PG_W; if (!checkpv && !cacheable) +#if defined(M68060) && defined(NO_SLOW_CIRRUS) +#if defined(M68040) || defined(M68030) || defined(M68020) npte |= (cputype == CPU_68060 ? PG_CIN : PG_CI); +#else + npte |= PG_CIN; +#endif +#else + npte |= PG_CI; +#endif #if defined(M68040) || defined(M68060) else if (mmutype == MMU_68040 && (npte & PG_PROT) == PG_RW && - (kernel_copyback || pmap != pmap_kernel())) + (kernel_copyback || pmap != pmap_kernel())) npte |= PG_CCB; /* cache copyback */ #endif if (flags & VM_PROT_ALL) { @@ -1294,10 +1207,9 @@ if ((pmapdebug & PDB_WIRING) && pmap != pmap_kernel()) { va -= PAGE_SIZE; pmap_check_wiring("enter", - trunc_page((vaddr_t)pmap_pte(pmap, va))); + trunc_page((vaddr_t) pmap_pte(pmap, va))); } #endif - return 0; } @@ -1318,7 +1230,7 @@ * Segment table entry not valid, we need a new PT page */ - if (!pmap_ste_v(pmap, va)) { + if (!pmap_ste_v(pmap, va)) { s = splvm(); pmap_enter_ptpage(pmap, va, false); splx(s); @@ -1438,10 +1350,10 @@ */ void pmap_unwire(pmap, va) - register pmap_t pmap; + pmap_t pmap; vaddr_t va; { - register u_int *pte; + u_int *pte; pte = pmap_pte(pmap, va); #ifdef DEBUG @@ -1492,16 +1404,15 @@ bool pmap_extract(pmap, va, pap) - register pmap_t pmap; + pmap_t pmap; vaddr_t va; paddr_t *pap; { bool rv = false; - paddr_t pa; + paddr_t pa = 0; u_int pte; #ifdef DEBUG - pa = 0; /* XXX gcc -Wuninitialized */ if (pmapdebug & PDB_FOLLOW) printf("pmap_extract(%p, %lx) -> ", pmap, va); #endif @@ -1591,22 +1502,22 @@ * Helper function for pmap_collect(). Do the actual * garbage-collection of range of physical addresses. */ -static void +void pmap_collect1(pmap, startpa, endpa) - pmap_t pmap; - paddr_t startpa, endpa; + pmap_t pmap; + paddr_t startpa, endpa; { paddr_t pa; struct pv_entry *pv; pt_entry_t *pte; paddr_t kpa; #ifdef DEBUG - int *ste; + st_entry_t *ste; int opmapdebug = 0; #endif for (pa = startpa; pa < endpa; pa += PAGE_SIZE) { - register struct kpt_page *kpt, **pkpt; + struct kpt_page *kpt, **pkpt; /* * Locate physical pages which are being used as kernel @@ -1623,7 +1534,7 @@ continue; #ifdef DEBUG if (pv->pv_va < (vaddr_t)Sysmap || - pv->pv_va >= (vaddr_t)Sysmap + ATARI_KPTSIZE) + pv->pv_va >= (vaddr_t)Sysmap + M68K_MAX_KPTSIZE) printf("collect: kernel PT VA out of range\n"); else goto ok; @@ -1684,7 +1595,7 @@ if (*ste) printf("collect: kernel STE at %p still valid (%x)\n", ste, *ste); - ste = (int *)&Sysptmap[(u_int *)ste-pmap_ste(pmap_kernel(), 0)]; + ste = &Sysptmap[ste - pmap_ste(pmap_kernel(), 0)]; if (*ste) printf("collect: kernel PTmap at %p still valid (%x)\n", ste, *ste); @@ -1706,7 +1617,8 @@ printf("pmap_activate(%p)\n", l); #endif - PMAP_ACTIVATE(pmap, curlwp == NULL || l->l_proc == curproc); + PMAP_ACTIVATE(pmap, (curlwp->l_flag & LW_IDLE) != 0 || + l->l_proc == curproc); } /* @@ -1731,7 +1643,7 @@ */ void pmap_zero_page(phys) - register paddr_t phys; + paddr_t phys; { int s; int dst_pte = PG_RW | PG_V; @@ -1753,7 +1665,7 @@ s = splvm(); - *CMAP1 = phys | dst_pte; + *caddr1_pte = phys | dst_pte; TBIS((vaddr_t)CADDR1); zeropage(CADDR1); @@ -1762,7 +1674,7 @@ * XXX: Invalidating is not strictly necessary.... Not doing it * is saving us a few cycles */ - *CMAP1 = PG_NV; + *caddr1_pte = PG_NV; TBIS((vaddr_t)CADDR1); #endif @@ -1782,7 +1694,7 @@ */ void pmap_copy_page(src, dst) - register paddr_t src, dst; + paddr_t src, dst; { int s; int src_pte = PG_RO | PG_V; @@ -1804,9 +1716,9 @@ #endif s = splvm(); - *CMAP1 = src | src_pte; + *caddr1_pte = src | src_pte; TBIS((vaddr_t)CADDR1); - *CMAP2 = dst | dst_pte; + *caddr2_pte = dst | dst_pte; TBIS((vaddr_t)CADDR2); copypage(CADDR1, CADDR2); @@ -1816,9 +1728,9 @@ * XXX: Invalidating is not strictly necessary.... Not doing it * is saving us a few cycles */ - *CMAP1 = PG_NV; + *caddr1_pte = PG_NV; TBIS((vaddr_t)CADDR1); - *CMAP2 = PG_NV; + *caddr2_pte = PG_NV; TBIS((vaddr_t)CADDR2); #endif @@ -1833,13 +1745,14 @@ pmap_clear_modify(pg) struct vm_page *pg; { - paddr_t pa = VM_PAGE_TO_PHYS(pg); bool rv; + paddr_t pa = VM_PAGE_TO_PHYS(pg); #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) printf("pmap_clear_modify(%lx)\n", pa); #endif + rv = pmap_testbit(pa, PG_M); pmap_changebit(pa, PG_M, false); return rv; @@ -1855,13 +1768,14 @@ pmap_clear_reference(pg) struct vm_page *pg; { - paddr_t pa = VM_PAGE_TO_PHYS(pg); bool rv; + paddr_t pa = VM_PAGE_TO_PHYS(pg); #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) printf("pmap_clear_reference(%lx)\n", pa); #endif + rv = pmap_testbit(pa, PG_U); pmap_changebit(pa, PG_U, false); return rv; @@ -1878,7 +1792,7 @@ pmap_is_referenced(pg) struct vm_page *pg; { - paddr_t pa = VM_PAGE_TO_PHYS(pg); + paddr_t pa = VM_PAGE_TO_PHYS(pg); #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) { @@ -1901,7 +1815,7 @@ pmap_is_modified(pg) struct vm_page *pg; { - paddr_t pa = VM_PAGE_TO_PHYS(pg); + paddr_t pa = VM_PAGE_TO_PHYS(pg); #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) { @@ -2013,33 +1927,33 @@ */ if (refs == 0 && (flags & PRM_KEEPPTPAGE) == 0) { #ifdef DIAGNOSTIC - struct pv_entry *pve; + struct pv_entry *_pv; #endif - paddr_t paddr; + paddr_t _pa; - paddr = pmap_pte_pa(pmap_pte(pmap_kernel(), ptpva)); + _pa = pmap_pte_pa(pmap_pte(pmap_kernel(), ptpva)); #ifdef DIAGNOSTIC - if (PAGE_IS_MANAGED(paddr) == 0) + if (PAGE_IS_MANAGED(_pa) == 0) panic("pmap_remove_mapping: unmanaged PT page"); - pve = pa_to_pvh(paddr); - if (pve->pv_ptste == NULL) + _pv = pa_to_pvh(_pa); + if (_pv->pv_ptste == NULL) panic("pmap_remove_mapping: ptste == NULL"); - if (pve->pv_pmap != pmap_kernel() || - pve->pv_va != ptpva || - pve->pv_next != NULL) + if (_pv->pv_pmap != pmap_kernel() || + _pv->pv_va != ptpva || + _pv->pv_next != NULL) panic("pmap_remove_mapping: " "bad PT page pmap %p, va 0x%lx, next %p", - pve->pv_pmap, pve->pv_va, pve->pv_next); + _pv->pv_pmap, _pv->pv_va, _pv->pv_next); #endif pmap_remove_mapping(pmap_kernel(), ptpva, NULL, PRM_TFLUSH|PRM_CFLUSH); mutex_enter(&uvm_kernel_object->vmobjlock); - uvm_pagefree(PHYS_TO_VM_PAGE(paddr)); + uvm_pagefree(PHYS_TO_VM_PAGE(_pa)); mutex_exit(&uvm_kernel_object->vmobjlock); #ifdef DEBUG if (pmapdebug & (PDB_REMOVE|PDB_PTPAGE)) printf("remove: PT page 0x%lx (0x%lx) freed\n", - ptpva, paddr); + ptpva, _pa); #endif } } @@ -2138,8 +2052,7 @@ ptpmap->pm_stab, ptpmap->pm_sref - 1); if ((pmapdebug & PDB_PARANOIA) && - ptpmap->pm_stab != - (st_entry_t *)trunc_page((vaddr_t)ste)) + ptpmap->pm_stab != (st_entry_t *)trunc_page((vaddr_t) ste)) panic("remove: bogus ste"); #endif if (--(ptpmap->pm_sref) == 0) { @@ -2149,7 +2062,7 @@ ptpmap->pm_stab); #endif uvm_km_free(kernel_map, - (vaddr_t)ptpmap->pm_stab, ATARI_STSIZE, + (vaddr_t)ptpmap->pm_stab, M68K_STSIZE, UVM_KMF_WIRED); ptpmap->pm_stab = Segtabzero; ptpmap->pm_stpa = Segtabzeropa; @@ -2165,10 +2078,6 @@ if (active_user_pmap(ptpmap)) PMAP_ACTIVATE(ptpmap, 1); } -#ifdef DEBUG - else if (ptpmap->pm_sref < 0) - panic("remove: sref < 0"); -#endif } #if 0 /* @@ -2226,39 +2135,14 @@ return (rv); } -static void -atari_protection_init() -{ - register int *kp, prot; - - kp = protection_codes; - for (prot = 0; prot < 8; prot++) { - switch (prot) { - case VM_PROT_NONE | VM_PROT_NONE | VM_PROT_NONE: - *kp++ = 0; - break; - case VM_PROT_READ | VM_PROT_NONE | VM_PROT_NONE: - case VM_PROT_READ | VM_PROT_NONE | VM_PROT_EXECUTE: - case VM_PROT_NONE | VM_PROT_NONE | VM_PROT_EXECUTE: - *kp++ = PG_RO; - break; - case VM_PROT_NONE | VM_PROT_WRITE | VM_PROT_NONE: - case VM_PROT_NONE | VM_PROT_WRITE | VM_PROT_EXECUTE: - case VM_PROT_READ | VM_PROT_WRITE | VM_PROT_NONE: - case VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE: - *kp++ = PG_RW; - break; - } - } -} - -static bool +/* static */ +bool pmap_testbit(pa, bit) - register paddr_t pa; + paddr_t pa; int bit; { - register pv_entry_t pv; - register int *pte; + struct pv_entry *pv; + int *pte; int s; pv = pa_to_pvh(pa); @@ -2291,24 +2175,24 @@ return(false); } -void +static void pmap_changebit(pa, bit, setem) - register paddr_t pa; + paddr_t pa; int bit; bool setem; { - register pv_entry_t pv; - register int *pte, npte; + struct pv_entry *pv; + int *pte, npte; vaddr_t va; - int s; bool firstpage; + int s; firstpage = true; #ifdef DEBUG if (pmapdebug & PDB_BITS) printf("pmap_changebit(%lx, %x, %s)\n", - pa, bit, setem ? "set" : "clear"); + pa, bit, setem ? "set" : "clear"); #endif pv = pa_to_pvh(pa); @@ -2320,10 +2204,12 @@ if (!setem) *pa_to_attribute(pa) &= ~bit; + /* * Loop over all current mappings setting/clearing as appropos * If setting RO do we need to clear the VAC? */ + if (pv->pv_pmap == NULL) { splx(s); return; @@ -2336,11 +2222,13 @@ else npte = *pte & ~bit; if (*pte != npte) { + /* * If we are changing caching status or * protection make sure the caches are * flushed (but only once). */ + #if defined(M68040) || defined(M68060) if (firstpage && mmutype == MMU_68040 && ((bit == PG_RO && setem) || (bit & PG_CMASK))) { @@ -2357,7 +2245,8 @@ splx(s); } -static int +/* static */ +int pmap_enter_ptpage(pmap, va, can_fail) pmap_t pmap; vaddr_t va; @@ -2365,11 +2254,11 @@ { paddr_t ptpa; struct vm_page *pg; - pv_entry_t pv; + struct pv_entry *pv; #ifdef M68060 u_int stpa; -#endif /* M68060 */ - u_int *ste; +#endif + st_entry_t *ste; int s; #ifdef DEBUG @@ -2385,16 +2274,17 @@ * reference count drops to zero. */ if (pmap->pm_stab == Segtabzero) { - pmap->pm_stab = (u_int *) - uvm_km_alloc(kernel_map, ATARI_STSIZE, 0, - UVM_KMF_WIRED | UVM_KMF_ZERO | - (can_fail ? UVM_KMF_NOWAIT : 0)); + /* XXX Atari uses kernel_map here: */ + pmap->pm_stab = (st_entry_t *) + uvm_km_alloc(kernel_map, M68K_STSIZE, 0, + UVM_KMF_WIRED | UVM_KMF_ZERO | + (can_fail ? UVM_KMF_NOWAIT : 0)); if (pmap->pm_stab == NULL) { pmap->pm_stab = Segtabzero; return ENOMEM; } - (void) pmap_extract(pmap_kernel(), - (vaddr_t)pmap->pm_stab, (paddr_t *)&pmap->pm_stpa); + (void) pmap_extract(pmap_kernel(), (vaddr_t)pmap->pm_stab, + (paddr_t *)&pmap->pm_stpa); #if defined(M68040) || defined(M68060) if (mmutype == MMU_68040) { #if defined(M68060) @@ -2403,8 +2293,8 @@ pt_entry_t *pte; pte = pmap_pte(pmap_kernel(), pmap->pm_stab); - while (stpa < (u_int)pmap->pm_stpa + - ATARI_STSIZE) { + while (stpa < (u_int)pmap->pm_stpa + + M68K_STSIZE) { *pte = (*pte & ~PG_CMASK) | PG_CI; ++pte; stpa += PAGE_SIZE; @@ -2477,7 +2367,7 @@ * pmap_enter). */ if (pmap == pmap_kernel()) { - register struct kpt_page *kpt; + struct kpt_page *kpt; s = splvm(); if ((kpt = kpt_free_list) == NULL) { @@ -2599,7 +2489,7 @@ */ #if defined(M68040) || defined(M68060) if (mmutype == MMU_68040) { - u_int *este; + st_entry_t *este; for (este = &ste[NPTEPG / SG4_LEV3SIZE]; ste < este; ++ste) { *ste = ptpa | SG_U | SG_RW | SG_V; @@ -2629,46 +2519,12 @@ return 0; } -/* - * Routine: pmap_virtual_space - * - * Function: - * Report the range of available kernel virtual address - * space to the VM system during bootstrap. Called by - * vm_bootstrap_steal_memory(). - */ -void -pmap_virtual_space(vstartp, vendp) - vaddr_t *vstartp, *vendp; -{ - - *vstartp = virtual_avail; - *vendp = virtual_end; -} - -/* - * Routine: pmap_procwr - * - * Function: - * Synchronize caches corresponding to [addr, addr+len) in - * p. - * - */ -void -pmap_procwr(p, va, len) - struct proc *p; - vaddr_t va; - u_long len; -{ - (void)cachectl1(0x80000004, va, len, p); -} - #ifdef DEBUG -static void +void pmap_pvdump(pa) paddr_t pa; { - register pv_entry_t pv; + struct pv_entry *pv; printf("pa %lx", pa); for (pv = pa_to_pvh(pa); pv; pv = pv->pv_next) @@ -2685,7 +2541,7 @@ * and ensure that it is consistent with the number of wirings * to that page that the VM system has. */ -static void +void pmap_check_wiring(str, va) const char *str; vaddr_t va; @@ -2707,7 +2563,8 @@ } count = 0; - for (pte = (pt_entry_t *)va; pte < (pt_entry_t *)(va + PAGE_SIZE); pte++) + for (pte = (pt_entry_t *)va; pte < (pt_entry_t *)(va + PAGE_SIZE); + pte++) if (*pte) count++; if (pg->wire_count != count) @@ -2715,3 +2572,37 @@ str, va, pg->wire_count, count); } #endif + +/* + * Routine: pmap_virtual_space + * + * Function: + * Report the range of available kernel virtual address + * space to the VM system during bootstrap. Called by + * vm_bootstrap_steal_memory(). + */ +void +pmap_virtual_space(vstartp, vendp) + vaddr_t *vstartp, *vendp; +{ + + *vstartp = virtual_avail; + *vendp = virtual_end; +} + +/* + * Routine: pmap_procwr + * + * Function: + * Synchronize caches corresponding to [addr, addr+len) in + * p. + * + */ +void +pmap_procwr(p, va, len) + struct proc *p; + vaddr_t va; + size_t len; +{ + (void)cachectl1(0x80000004, va, len, p); +} Index: conf/files.atari =================================================================== RCS file: /cvsroot/src/sys/arch/atari/conf/files.atari,v retrieving revision 1.112 diff -u -r1.112 files.atari --- conf/files.atari 20 Feb 2008 21:43:33 -0000 1.112 +++ conf/files.atari 31 Dec 2008 12:15:03 -0000 @@ -203,6 +203,7 @@ file arch/atari/atari/mainbus.c file arch/atari/atari/mem.c file arch/atari/atari/pmap.c +file arch/atari/atari/pmap_bootstrap.c file arch/atari/atari/trap.c file arch/atari/atari/stalloc.c file arch/atari/atari/fpu.c @@ -210,6 +211,7 @@ file arch/atari/atari/intr.c file arch/m68k/m68k/cacheops.c file arch/m68k/m68k/db_memrw.c ddb +#file arch/m68k/m68k/pmap_motorola.c file arch/m68k/m68k/procfs_machdep.c procfs file arch/m68k/m68k/sys_machdep.c file arch/m68k/m68k/vm_machdep.c Index: include/pcb.h =================================================================== RCS file: /cvsroot/src/sys/arch/atari/include/pcb.h,v retrieving revision 1.8 diff -u -r1.8 pcb.h --- include/pcb.h 31 Dec 2008 11:11:05 -0000 1.8 +++ include/pcb.h 31 Dec 2008 12:15:03 -0000 @@ -1,114 +1,3 @@ /* $NetBSD: pcb.h,v 1.8 2008/12/31 11:11:05 tsutsui Exp $ */ -/* - * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * 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. 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. - * - * from: Utah $Hdr: pcb.h 1.13 89/04/23$ - * - * @(#)pcb.h 7.4 (Berkeley) 5/4/91 - */ -/* - * Copyright (c) 1988 University of Utah. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * 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. - * - * from: Utah $Hdr: pcb.h 1.13 89/04/23$ - * - * @(#)pcb.h 7.4 (Berkeley) 5/4/91 - */ - -#ifndef _MACHINE_PCB_H_ -#define _MACHINE_PCB_H_ - -#include - -/* - * ATARI process control block - */ -struct pcb -{ - short pcb_flags; /* misc. process flags (+0) */ - short pcb_ps; /* processor status word (+2) */ - int __pcb_spare0; - int pcb_usp; /* user stack pointer (+8) */ - int pcb_regs[12]; /* D2-D7, A2-A7 (+C) */ - void * pcb_onfault; /* for copyin/out faults */ - struct fpframe pcb_fpregs; /* 68881/2 context save area */ - int pcb_exec[16]; /* exec structure for core dumps */ -}; - -/* Positions within pcb_regs[] of A6 and A7 (FP and SP). For m68k DDB. */ -#define PCB_REGS_FP 10 -#define PCB_REGS_SP 11 - -/* flags (none currently used) */ - -/* - * The pcb is augmented with machine-dependent additional data for - * core dumps. For the hp300, this includes an HP-UX exec header - * which is dumped for HP-UX processes. - */ -struct md_coredump { - int md_exec[16]; /* exec structure for HP-UX core dumps */ -}; - -#endif /* !_MACHINE_PCB_H_ */ +#include Index: include/pmap.h =================================================================== RCS file: /cvsroot/src/sys/arch/atari/include/pmap.h,v retrieving revision 1.38 diff -u -r1.38 pmap.h --- include/pmap.h 9 Dec 2008 20:45:44 -0000 1.38 +++ include/pmap.h 31 Dec 2008 12:15:03 -0000 @@ -76,93 +76,18 @@ #ifndef _MACHINE_PMAP_H_ #define _MACHINE_PMAP_H_ -#include - -/* - * Pmap stuff - */ -struct pmap { - pt_entry_t *pm_ptab; /* KVA of page table */ - st_entry_t *pm_stab; /* KVA of segment table */ - int pm_stfree; /* 040: free lev2 blocks */ - u_int *pm_stpa; /* 040: ST phys. address */ - short pm_sref; /* segment table ref count */ - short pm_count; /* pmap reference count */ - long pm_ptpages; /* more stats: PT pages */ - struct simplelock pm_lock; /* lock on pmap */ - struct pmap_statistics pm_stats; /* pmap statistics */ -}; - -/* - * On the 040 we keep track of which level 2 blocks are already in use - * with the pm_stfree mask. Bits are arranged from LSB (block 0) to MSB - * (block 31). For convenience, the level 1 table is considered to be - * block 0. - * - * MAX[KU]L2SIZE control how many pages of level 2 descriptors are allowed. - * for the kernel and users. 16 implies only the initial "segment table" - * page is used. WARNING: don't change MAXUL2SIZE unless you can allocate - * physically contiguous pages for the ST in pmap.c! - */ -#define MAXKL2SIZE 32 -#define MAXUL2SIZE 16 -#define l2tobm(n) (1 << (n)) -#define bmtol2(n) (ffs(n) - 1) - -/* - * Macros for speed - */ -#define PMAP_ACTIVATE(pmap, loadhw) \ -{ \ - if ((loadhw)) \ - loadustp(m68k_btop((pmap)->pm_stpa)); \ -} +#include /* * Description of the memory segments. Build in atari_init/start_c(). * This gives a better separation between machine dependent stuff and * the pmap-module. */ -#define NMEM_SEGS 8 +#define NMEM_SEGS 8 struct memseg { - paddr_t start; /* PA of first page in segment */ - paddr_t end; /* PA of last page in segment */ - int first_page; /* relative page# of 'start' */ -}; - -/* - * For each struct vm_page, there is a list of all currently valid virtual - * mappings of that page. An entry is a pv_entry_t, the list is pv_table. - */ -typedef struct pv_entry { - struct pv_entry *pv_next; /* next pv_entry */ - struct pmap *pv_pmap; /* pmap where mapping lies */ - vaddr_t pv_va; /* virtual address for mapping */ - u_int *pv_ptste; /* non-zero if VA maps a PT page */ - struct pmap *pv_ptpmap; /* if pv_ptste, pmap for PT page */ - int pv_flags; /* flags */ -} *pv_entry_t; - -#define PV_CI 0x01 /* all entries must be cache inhibited */ -#define PV_PTPAGE 0x02 /* entry maps a page table page */ - -struct pv_page; - -struct pv_page_info { - TAILQ_ENTRY(pv_page) pgi_list; - struct pv_entry *pgi_freelist; - int pgi_nfree; -}; - -/* - * This is basically: - * ((PAGE_SIZE - sizeof(struct pv_page_info)) / sizeof(struct pv_entry)) - */ -#define NPVPPG 340 - -struct pv_page { - struct pv_page_info pvp_pgi; - struct pv_entry pvp_pv[NPVPPG]; + paddr_t start; /* PA of first page in segment */ + paddr_t end; /* PA of last page in segment */ + int first_page; /* relative page# of 'start' */ }; #ifdef _KERNEL @@ -174,34 +99,10 @@ * describes the segments available after system requirements are * substracted (reserved pages, etc...). */ -struct memseg boot_segs[NMEM_SEGS]; -struct memseg usable_segs[NMEM_SEGS]; - -pv_entry_t pv_table; /* array of entries, one per page */ -u_int *Sysmap; -char *vmmap; /* map for mem, dumps, etc. */ - -#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count) -#define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count) - -#define pmap_update(pmap) /* nothing (yet) */ - -static __inline void -pmap_remove_all(struct pmap *pmap) -{ - /* Nothing. */ -} - -#define active_user_pmap(pm) \ - (curproc && \ - (pm) != pmap_kernel() && (pm) == curproc->p_vmspace->vm_map.pmap) - -void pmap_bootstrap __P((psize_t, u_int)); -void pmap_changebit __P((paddr_t, int, bool)); +extern struct memseg boot_segs[NMEM_SEGS]; +extern struct memseg usable_segs[NMEM_SEGS]; -vaddr_t pmap_map __P((vaddr_t, paddr_t, paddr_t, int)); -void pmap_procwr __P((struct proc *, vaddr_t, u_long)); -#define PMAP_NEED_PROCWR +void pmap_bootstrap(vaddr_t, paddr_t); #endif /* _KERNEL */ Index: include/pte.h =================================================================== RCS file: /cvsroot/src/sys/arch/atari/include/pte.h,v retrieving revision 1.7 diff -u -r1.7 pte.h --- include/pte.h 11 Dec 2005 12:16:59 -0000 1.7 +++ include/pte.h 31 Dec 2008 12:15:03 -0000 @@ -1,188 +1,3 @@ /* $NetBSD: pte.h,v 1.7 2005/12/11 12:16:59 christos Exp $ */ -/* - * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * 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. 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. - * - * from: Utah $Hdr: pte.h 1.11 89/09/03$ - * - * @(#)pte.h 7.3 (Berkeley) 5/8/91 - */ -/* - * Copyright (c) 1988 University of Utah. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * 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. - * - * from: Utah $Hdr: pte.h 1.11 89/09/03$ - * - * @(#)pte.h 7.3 (Berkeley) 5/8/91 - */ - -#ifndef _MACHINE_PTE_H_ -#define _MACHINE_PTE_H_ - -/* - * ATARI hardware segment/page table entries - */ - -struct pte { - u_int pte; -}; - -typedef u_int pt_entry_t; - -struct ste { - u_int ste; -}; - -typedef u_int st_entry_t; - -#define PT_ENTRY_NULL ((pt_entry_t *) 0) -#define ST_ENTRY_NULL ((st_entry_t *) 0) - -#define SG_V 0x00000002 /* segment is valid */ -#define SG_NV 0x00000000 -#define SG_PROT 0x00000004 /* access protection mask */ -#define SG_RO 0x00000004 -#define SG_RW 0x00000000 -#define SG_U 0x00000008 /* modified bit (68040) */ -#define SG_FRAME 0xffffe000 -#define SG_IMASK 0xff000000 -#define SG_ISHIFT 24 -#define SG_PMASK 0x00ffe000 -#define SG_PSHIFT 13 - -/* 68040 additions */ -#define SG4_MASK1 0xfe000000 /* pointer table 1 index mask */ -#define SG4_SHIFT1 25 -#define SG4_MASK2 0x01fc0000 /* pointer table 2 index mask */ -#define SG4_SHIFT2 18 -#define SG4_MASK3 0x0003e000 /* page table index mask */ -#define SG4_SHIFT3 13 -#define SG4_ADDR1 0xfffffe00 /* pointer table address mask */ -#define SG4_ADDR2 0xffffff80 /* page table address mask */ -#define SG4_LEV1SIZE 128 /* entries in pointer table 1 */ -#define SG4_LEV2SIZE 128 /* entries in pointer table 2 */ -#define SG4_LEV3SIZE 32 /* entries in page table */ - -#define PG_V 0x00000001 -#define PG_NV 0x00000000 -#define PG_PROT 0x00000004 -#define PG_U 0x00000008 -#define PG_M 0x00000010 -/* - * XXX The Milan uses the U0 pin to switch the pci-bridge between little & big - * endian mode. That's why I moved the 'wired' flag to U1 leo 10Apr/2001. - */ -#if 0 -#define PG_W 0x00000100 -#else -#define PG_W 0x00000200 -#endif -#define PG_RO 0x00000004 -#define PG_RW 0x00000000 -#define PG_FRAME 0xffffe000 -#define PG_CI 0x00000040 -#define PG_SHIFT 13 -#define PG_PFNUM(x) (((x) & PG_FRAME) >> PG_SHIFT) - -/* 68040 additions */ -#define PG_CMASK 0x00000060 /* cache mode mask */ -#define PG_CWT 0x00000000 /* writethrough caching */ -#define PG_CCB 0x00000020 /* copyback caching */ -#define PG_CIS 0x00000040 /* cache inhibited serialized */ -#define PG_CIN 0x00000060 /* cache inhibited nonserialized */ -#define PG_SO 0x00000080 /* supervisor only */ - -#define ATARI_STSIZE (MAXUL2SIZE*SG4_LEV2SIZE*sizeof(st_entry_t)) - -/* - * ATARI_MAX_COREUPT maximum number of incore user page tables - * ATARI_USER_PTSIZE the number of bytes for user pagetables - * ATARI_PTBASE the VA start of the map from which upt's are allocated - * ATARI_PTSIZE the size of the map from which upt's are allocated - * ATARI_KPTSIZE size of kernel page table - * ATARI_MAX_KPTSIZE the most number of bytes for kpt pages - * ATARI_MAX_PTSIZE the number of bytes to map everything - */ -#define ATARI_MAX_COREUPT 1024 -#define ATARI_UPTSIZE roundup(VM_MAXUSER_ADDRESS / NPTEPG, PAGE_SIZE) -#define ATARI_UPTBASE 0x10000000 -#define ATARI_UPTMAXSIZE \ - roundup((ATARI_MAX_COREUPT * ATARI_UPTSIZE), PAGE_SIZE) -#define ATARI_MAX_KPTSIZE \ - (ATARI_MAX_COREUPT * ATARI_UPTSIZE / NPTEPG) -#define ATARI_KPTSIZE \ - roundup((VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / NPTEPG, PAGE_SIZE) -#define ATARI_MAX_PTSIZE roundup(0xffffffff / NPTEPG, PAGE_SIZE) - -/* - * Kernel virtual address to page table entry and to physical address. - */ -#define kvtopte(va) \ - (&Sysmap[((unsigned)(va) - VM_MIN_KERNEL_ADDRESS) >> PGSHIFT]) -#define ptetokv(pt) \ - ((((u_int *)(pt) - Sysmap) << PGSHIFT) + VM_MIN_KERNEL_ADDRESS) -#define kvtophys(va) \ - ((kvtopte(va)->pg_pfnum << PGSHIFT) | ((int)(va) & PGOFSET)) - - -#endif /* !_MACHINE_PTE_H_ */ +#include Index: include/vmparam.h =================================================================== RCS file: /cvsroot/src/sys/arch/atari/include/vmparam.h,v retrieving revision 1.21 diff -u -r1.21 vmparam.h --- include/vmparam.h 11 Dec 2005 12:16:59 -0000 1.21 +++ include/vmparam.h 31 Dec 2008 12:15:03 -0000 @@ -152,7 +152,7 @@ #define VM_MAX_ADDRESS ((vaddr_t)(USRSTACK)) #define VM_MAXUSER_ADDRESS ((vaddr_t)(VM_MAX_ADDRESS)) #define VM_MIN_KERNEL_ADDRESS ((vaddr_t)0) -#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)(0-PAGE_SIZE)) +#define VM_MAX_KERNEL_ADDRESS ((vaddr_t)-(NPTEPG * PAGE_SIZE)) /* * virtual sizes (bytes) for various kernel submaps --- /dev/null 2008-12-31 20:51:42.000000000 +0900 +++ atari/pmap_bootstrap.c 2008-12-31 19:13:15.000000000 +0900 @@ -0,0 +1,212 @@ +/* $NetBSD$ */ +/*- + * Copyright (c) 1999 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jason R. Thorpe. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +/* + * Copyright (c) 1991 Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department. + * + * 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. 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. + * + * @(#)pmap.c 7.5 (Berkeley) 5/10/91 + */ + +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include + +struct memseg boot_segs[NMEM_SEGS]; +struct memseg usable_segs[NMEM_SEGS]; + +extern st_entry_t *Sysseg; +extern pt_entry_t *Sysmap; + +extern paddr_t avail_start; +extern paddr_t avail_end; +extern vsize_t mem_size; +extern vaddr_t virtual_avail; +extern vaddr_t virtual_end; +#if defined(M68040) || defined(M68060) +extern int protostfree; +#endif + +extern void * msgbufaddr; +extern paddr_t msgbufpa; + +/* + * All those kernel PT submaps that BSD is so fond of + */ +void *CADDR1, *CADDR2; +char *vmmap; + +extern int protection_codes[]; + +/* + * Bootstrap the system enough to run with virtual memory. + * + * This is called after mapping has already been enabled + * and just syncs the pmap module with what has already been done. + */ +void +pmap_bootstrap(vaddr_t vstart, paddr_t sysseg_pa) +{ + vaddr_t va; + int i; + + /* + * Announce page-size to the VM-system + */ + uvmexp.pagesize = NBPG; + uvm_setpagesize(); + + /* + * Setup physical address ranges + */ + for (i = 0; usable_segs[i + 1].start; i++) + ; + /* XXX: allow for msgbuf */ + usable_segs[i].end -= m68k_round_page(MSGBUFSIZE); + msgbufpa = usable_segs[i].end; + + /* + * Count physical memory + */ + mem_size = 0; + for (i = 0; i < NMEM_SEGS; i++) { + if (boot_segs[i].start == boot_segs[i].end) + break; + mem_size += boot_segs[i].end - boot_segs[i].start; + } + + /* + * Announce available memory to the VM-system + */ + for (i = 0; usable_segs[i].start; i++) + uvm_page_physload(atop(usable_segs[i].start), + atop(usable_segs[i].end), + atop(usable_segs[i].start), + atop(usable_segs[i].end), + VM_FREELIST_DEFAULT); + + avail_start = usable_segs[0].start; + avail_end = usable_segs[i - 1].end; + + virtual_avail = vstart; + virtual_end = VM_MAX_KERNEL_ADDRESS; + + /* + * Initialize protection array. + * XXX don't use a switch statement, it might produce an + * absolute "jmp" table. + */ + { + int *kp; + + kp = (int *)&protection_codes; + kp[VM_PROT_NONE|VM_PROT_NONE|VM_PROT_NONE] = 0; + kp[VM_PROT_READ|VM_PROT_NONE|VM_PROT_NONE] = PG_RO; + kp[VM_PROT_READ|VM_PROT_NONE|VM_PROT_EXECUTE] = PG_RO; + kp[VM_PROT_NONE|VM_PROT_NONE|VM_PROT_EXECUTE] = PG_RO; + kp[VM_PROT_NONE|VM_PROT_WRITE|VM_PROT_NONE] = PG_RW; + kp[VM_PROT_NONE|VM_PROT_WRITE|VM_PROT_EXECUTE] = PG_RW; + kp[VM_PROT_READ|VM_PROT_WRITE|VM_PROT_NONE] = PG_RW; + kp[VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE] = PG_RW; + } + + /* + * Kernel page/segment table allocated in locore, + * just initialize pointers. + */ + pmap_kernel()->pm_stpa = (st_entry_t *)sysseg_pa; + pmap_kernel()->pm_stab = Sysseg; + pmap_kernel()->pm_ptab = Sysmap; +#if defined(M68040) || defined(M68060) + if (mmutype == MMU_68040) { + pmap_kernel()->pm_stfree = protostfree; + } +#endif + + simple_lock_init(&pmap_kernel()->pm_lock); + pmap_kernel()->pm_count = 1; + + /* + * Allocate all the submaps we need + */ +#define SYSMAP(c, v, n) \ + v = (c)va; va += ((n)*PAGE_SIZE); + + va = virtual_avail; + + SYSMAP(void * ,CADDR1 ,1 ) + SYSMAP(void * ,CADDR2 ,1 ) + SYSMAP(void * ,vmmap ,1 ) + SYSMAP(void * ,msgbufaddr ,btoc(MSGBUFSIZE) ) + + DCIS(); + + virtual_avail = reserve_dumppages(va); +}