pmap.c (e29632c9e12dabb912a35bba6e8a86646d38cf75) | pmap.c (910548dea729e52e27a95187cd3f7e9859ba05f2) |
---|---|
1/* 2 * Copyright (c) 1991 Regents of the University of California. 3 * All rights reserved. 4 * Copyright (c) 1994 John S. Dyson 5 * All rights reserved. 6 * Copyright (c) 1994 David Greenman 7 * All rights reserved. 8 * --- 1272 unchanged lines hidden (view full) --- 1281{ 1282 vm_page_t ptdpg; 1283 1284 /* 1285 * No need to allocate page table space yet but we do need a valid 1286 * page directory table. 1287 */ 1288 if (pmap->pm_pdir == NULL) | 1/* 2 * Copyright (c) 1991 Regents of the University of California. 3 * All rights reserved. 4 * Copyright (c) 1994 John S. Dyson 5 * All rights reserved. 6 * Copyright (c) 1994 David Greenman 7 * All rights reserved. 8 * --- 1272 unchanged lines hidden (view full) --- 1281{ 1282 vm_page_t ptdpg; 1283 1284 /* 1285 * No need to allocate page table space yet but we do need a valid 1286 * page directory table. 1287 */ 1288 if (pmap->pm_pdir == NULL) |
1289 pmap->pm_pdir = 1290 (pd_entry_t *)kmem_alloc_pageable(kernel_map, PAGE_SIZE); | 1289 pmap->pm_pdir = (pd_entry_t *)kmem_alloc_pageable(kernel_map, 1290 NBPTD); |
1291 1292 /* 1293 * allocate object for the ptes 1294 */ 1295 if (pmap->pm_pteobj == NULL) | 1291 1292 /* 1293 * allocate object for the ptes 1294 */ 1295 if (pmap->pm_pteobj == NULL) |
1296 pmap->pm_pteobj = vm_object_allocate(OBJT_DEFAULT, PTDPTDI + 1); | 1296 pmap->pm_pteobj = vm_object_allocate(OBJT_DEFAULT, PTDPTDI + 1297 NPGPTD); |
1297 1298 /* 1299 * allocate the page directory page 1300 */ 1301 ptdpg = vm_page_grab(pmap->pm_pteobj, PTDPTDI, 1302 VM_ALLOC_NORMAL | VM_ALLOC_RETRY | VM_ALLOC_WIRED | VM_ALLOC_ZERO); 1303 vm_page_lock_queues(); 1304 vm_page_flag_clear(ptdpg, PG_BUSY); 1305 ptdpg->valid = VM_PAGE_BITS_ALL; 1306 vm_page_unlock_queues(); 1307 | 1298 1299 /* 1300 * allocate the page directory page 1301 */ 1302 ptdpg = vm_page_grab(pmap->pm_pteobj, PTDPTDI, 1303 VM_ALLOC_NORMAL | VM_ALLOC_RETRY | VM_ALLOC_WIRED | VM_ALLOC_ZERO); 1304 vm_page_lock_queues(); 1305 vm_page_flag_clear(ptdpg, PG_BUSY); 1306 ptdpg->valid = VM_PAGE_BITS_ALL; 1307 vm_page_unlock_queues(); 1308 |
1308 pmap_qenter((vm_offset_t) pmap->pm_pdir, &ptdpg, 1); | 1309 pmap_qenter((vm_offset_t)pmap->pm_pdir, &ptdpg, NPGPTD); |
1309 if ((ptdpg->flags & PG_ZERO) == 0) 1310 bzero(pmap->pm_pdir, PAGE_SIZE); 1311 1312 mtx_lock_spin(&allpmaps_lock); 1313 LIST_INSERT_HEAD(&allpmaps, pmap, pm_list); 1314 mtx_unlock_spin(&allpmaps_lock); 1315 /* Wire in kernel global address entries. */ 1316 /* XXX copies current process, does not fill in MPPTDI */ --- 2101 unchanged lines hidden (view full) --- 3418 LIST_FOREACH(p, &allproc, p_list) { 3419 if (p->p_pid != pid) 3420 continue; 3421 3422 if (p->p_vmspace) { 3423 int i,j; 3424 index = 0; 3425 pmap = vmspace_pmap(p->p_vmspace); | 1310 if ((ptdpg->flags & PG_ZERO) == 0) 1311 bzero(pmap->pm_pdir, PAGE_SIZE); 1312 1313 mtx_lock_spin(&allpmaps_lock); 1314 LIST_INSERT_HEAD(&allpmaps, pmap, pm_list); 1315 mtx_unlock_spin(&allpmaps_lock); 1316 /* Wire in kernel global address entries. */ 1317 /* XXX copies current process, does not fill in MPPTDI */ --- 2101 unchanged lines hidden (view full) --- 3419 LIST_FOREACH(p, &allproc, p_list) { 3420 if (p->p_pid != pid) 3421 continue; 3422 3423 if (p->p_vmspace) { 3424 int i,j; 3425 index = 0; 3426 pmap = vmspace_pmap(p->p_vmspace); |
3426 for (i = 0; i < NPDEPG; i++) { | 3427 for (i = 0; i < NPDEPTD; i++) { |
3427 pd_entry_t *pde; 3428 pt_entry_t *pte; 3429 vm_offset_t base = i << PDRSHIFT; 3430 3431 pde = &pmap->pm_pdir[i]; 3432 if (pde && pmap_pde_v(pde)) { 3433 for (j = 0; j < NPTEPG; j++) { 3434 vm_offset_t va = base + (j << PAGE_SHIFT); --- 43 unchanged lines hidden (view full) --- 3478 pmap_t pm; 3479{ 3480 int i, j; 3481 vm_offset_t va; 3482 pt_entry_t *ptep; 3483 3484 if (pm == kernel_pmap) 3485 return; | 3428 pd_entry_t *pde; 3429 pt_entry_t *pte; 3430 vm_offset_t base = i << PDRSHIFT; 3431 3432 pde = &pmap->pm_pdir[i]; 3433 if (pde && pmap_pde_v(pde)) { 3434 for (j = 0; j < NPTEPG; j++) { 3435 vm_offset_t va = base + (j << PAGE_SHIFT); --- 43 unchanged lines hidden (view full) --- 3479 pmap_t pm; 3480{ 3481 int i, j; 3482 vm_offset_t va; 3483 pt_entry_t *ptep; 3484 3485 if (pm == kernel_pmap) 3486 return; |
3486 for (i = 0; i < NPDEPG; i++) | 3487 for (i = 0; i < NPDEPTD; i++) |
3487 if (pm->pm_pdir[i]) 3488 for (j = 0; j < NPTEPG; j++) { 3489 va = (i << PDRSHIFT) + (j << PAGE_SHIFT); 3490 if (pm == kernel_pmap && va < KERNBASE) 3491 continue; 3492 if (pm != kernel_pmap && va > UPT_MAX_ADDRESS) 3493 continue; 3494 ptep = pmap_pte_quick(pm, va); --- 22 unchanged lines hidden --- | 3488 if (pm->pm_pdir[i]) 3489 for (j = 0; j < NPTEPG; j++) { 3490 va = (i << PDRSHIFT) + (j << PAGE_SHIFT); 3491 if (pm == kernel_pmap && va < KERNBASE) 3492 continue; 3493 if (pm != kernel_pmap && va > UPT_MAX_ADDRESS) 3494 continue; 3495 ptep = pmap_pte_quick(pm, va); --- 22 unchanged lines hidden --- |