Date: Sat, 27 Mar 2010 18:24:27 +0000 (UTC) From: Alan Cox <alc@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r205773 - head/sys/i386/i386 Message-ID: <201003271824.o2RIORTF065203@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: alc Date: Sat Mar 27 18:24:27 2010 New Revision: 205773 URL: http://svn.freebsd.org/changeset/base/205773 Log: Simplify pmap_growkernel(), making the i386 version more like the amd64 version. MFC after: 3 weeks Modified: head/sys/i386/i386/pmap.c Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Sat Mar 27 18:15:18 2010 (r205772) +++ head/sys/i386/i386/pmap.c Sat Mar 27 18:24:27 2010 (r205773) @@ -207,8 +207,8 @@ vm_offset_t virtual_end; /* VA of last a int pgeflag = 0; /* PG_G or-in */ int pseflag = 0; /* PG_PS or-in */ -static int nkpt; -vm_offset_t kernel_vm_end; +static int nkpt = NKPT; +vm_offset_t kernel_vm_end = KERNBASE + NKPT * NBPDR; extern u_int32_t KERNend; extern u_int32_t KPTphys; @@ -395,7 +395,6 @@ pmap_bootstrap(vm_paddr_t firstaddr) mtx_lock_spin(&allpmaps_lock); LIST_INSERT_HEAD(&allpmaps, kernel_pmap, pm_list); mtx_unlock_spin(&allpmaps_lock); - nkpt = NKPT; /* * Reserve some special page table entries/VA space for temporary @@ -2032,24 +2031,12 @@ pmap_growkernel(vm_offset_t addr) pd_entry_t newpdir; mtx_assert(&kernel_map->system_mtx, MA_OWNED); - if (kernel_vm_end == 0) { - kernel_vm_end = KERNBASE; - nkpt = 0; - while (pdir_pde(PTD, kernel_vm_end)) { - kernel_vm_end = (kernel_vm_end + PAGE_SIZE * NPTEPG) & ~(PAGE_SIZE * NPTEPG - 1); - nkpt++; - if (kernel_vm_end - 1 >= kernel_map->max_offset) { - kernel_vm_end = kernel_map->max_offset; - break; - } - } - } - addr = roundup2(addr, PAGE_SIZE * NPTEPG); + addr = roundup2(addr, NBPDR); if (addr - 1 >= kernel_map->max_offset) addr = kernel_map->max_offset; while (kernel_vm_end < addr) { if (pdir_pde(PTD, kernel_vm_end)) { - kernel_vm_end = (kernel_vm_end + PAGE_SIZE * NPTEPG) & ~(PAGE_SIZE * NPTEPG - 1); + kernel_vm_end = (kernel_vm_end + NBPDR) & ~PDRMASK; if (kernel_vm_end - 1 >= kernel_map->max_offset) { kernel_vm_end = kernel_map->max_offset; break; @@ -2072,7 +2059,7 @@ pmap_growkernel(vm_offset_t addr) pdir_pde(KPTD, kernel_vm_end) = pgeflag | newpdir; pmap_kenter_pde(kernel_vm_end, newpdir); - kernel_vm_end = (kernel_vm_end + PAGE_SIZE * NPTEPG) & ~(PAGE_SIZE * NPTEPG - 1); + kernel_vm_end = (kernel_vm_end + NBPDR) & ~PDRMASK; if (kernel_vm_end - 1 >= kernel_map->max_offset) { kernel_vm_end = kernel_map->max_offset; break;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003271824.o2RIORTF065203>