Same treatment as i386/isa/pmap.c - clean up some style to sync towards
KSE diff.
This commit is contained in:
parent
ff741bef86
commit
0a1b2dd6eb
@ -925,30 +925,31 @@ pmap_new_proc(struct proc *p)
|
||||
{
|
||||
int i;
|
||||
vm_object_t upobj;
|
||||
vm_offset_t up;
|
||||
vm_page_t m;
|
||||
struct user *up;
|
||||
pt_entry_t *ptek, oldpte;
|
||||
|
||||
/*
|
||||
* allocate object for the upages
|
||||
*/
|
||||
if ((upobj = p->p_upages_obj) == NULL) {
|
||||
upobj = vm_object_allocate( OBJT_DEFAULT, UPAGES);
|
||||
upobj = p->p_upages_obj;
|
||||
if (upobj == NULL) {
|
||||
upobj = vm_object_allocate(OBJT_DEFAULT, UPAGES);
|
||||
p->p_upages_obj = upobj;
|
||||
}
|
||||
|
||||
/* get a kernel virtual address for the UPAGES for this proc */
|
||||
if ((up = p->p_addr) == NULL) {
|
||||
up = (struct user *) kmem_alloc_nofault(kernel_map,
|
||||
UPAGES * PAGE_SIZE);
|
||||
if (up == NULL)
|
||||
panic("pmap_new_proc: u_map allocation failed");
|
||||
p->p_addr = up;
|
||||
up = (vm_offset_t)p->p_addr;
|
||||
if (up == 0) {
|
||||
up = kmem_alloc_nofault(kernel_map, UPAGES * PAGE_SIZE);
|
||||
if (up == 0)
|
||||
panic("pmap_new_proc: upage allocation failed");
|
||||
p->p_addr = (struct user *)up;
|
||||
}
|
||||
|
||||
ptek = vtopte((vm_offset_t) up);
|
||||
ptek = vtopte(up);
|
||||
|
||||
for(i=0;i<UPAGES;i++) {
|
||||
for (i = 0; i < UPAGES; i++) {
|
||||
/*
|
||||
* Get a kernel stack page
|
||||
*/
|
||||
@ -967,8 +968,7 @@ pmap_new_proc(struct proc *p)
|
||||
*(ptek + i) = pmap_phys_to_pte(VM_PAGE_TO_PHYS(m))
|
||||
| PG_ASM | PG_KRE | PG_KWE | PG_V;
|
||||
if (oldpte)
|
||||
pmap_invalidate_page(kernel_pmap,
|
||||
(vm_offset_t)up + i * PAGE_SIZE);
|
||||
pmap_invalidate_page(kernel_pmap, up + i * PAGE_SIZE);
|
||||
|
||||
vm_page_wakeup(m);
|
||||
vm_page_flag_clear(m, PG_ZERO);
|
||||
@ -987,23 +987,21 @@ pmap_dispose_proc(p)
|
||||
{
|
||||
int i;
|
||||
vm_object_t upobj;
|
||||
vm_offset_t up;
|
||||
vm_page_t m;
|
||||
pt_entry_t *ptek, oldpte;
|
||||
|
||||
upobj = p->p_upages_obj;
|
||||
|
||||
ptek = vtopte((vm_offset_t) p->p_addr);
|
||||
for(i=0;i<UPAGES;i++) {
|
||||
|
||||
if ((m = vm_page_lookup(upobj, i)) == NULL)
|
||||
panic("pmap_dispose_proc: upage already missing???");
|
||||
|
||||
up = (vm_offset_t)p->p_addr;
|
||||
ptek = vtopte(up);
|
||||
for (i = 0; i < UPAGES; i++) {
|
||||
m = vm_page_lookup(upobj, i);
|
||||
if (m == NULL)
|
||||
panic("pmap_dispose_proc: upage already missing?");
|
||||
vm_page_busy(m);
|
||||
|
||||
oldpte = *(ptek + i);
|
||||
*(ptek + i) = 0;
|
||||
pmap_invalidate_page(kernel_pmap,
|
||||
(vm_offset_t)p->p_addr + i * PAGE_SIZE);
|
||||
pmap_invalidate_page(kernel_pmap, up + i * PAGE_SIZE);
|
||||
vm_page_unwire(m, 0);
|
||||
vm_page_free(m);
|
||||
}
|
||||
@ -1018,6 +1016,7 @@ pmap_swapout_proc(p)
|
||||
{
|
||||
int i;
|
||||
vm_object_t upobj;
|
||||
vm_offset_t up;
|
||||
vm_page_t m;
|
||||
|
||||
/*
|
||||
@ -1026,15 +1025,14 @@ pmap_swapout_proc(p)
|
||||
alpha_fpstate_save(p, 1);
|
||||
|
||||
upobj = p->p_upages_obj;
|
||||
/*
|
||||
* let the upages be paged
|
||||
*/
|
||||
for(i=0;i<UPAGES;i++) {
|
||||
if ((m = vm_page_lookup(upobj, i)) == NULL)
|
||||
panic("pmap_swapout_proc: upage already missing???");
|
||||
up = (vm_offset_t)p->p_addr;
|
||||
for (i = 0; i < UPAGES; i++) {
|
||||
m = vm_page_lookup(upobj, i);
|
||||
if (m == NULL)
|
||||
panic("pmap_swapout_proc: upage already missing?");
|
||||
vm_page_dirty(m);
|
||||
vm_page_unwire(m, 0);
|
||||
pmap_kremove((vm_offset_t)p->p_addr + PAGE_SIZE * i);
|
||||
pmap_kremove(up + i * PAGE_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1045,18 +1043,16 @@ void
|
||||
pmap_swapin_proc(p)
|
||||
struct proc *p;
|
||||
{
|
||||
int i,rv;
|
||||
int i, rv;
|
||||
vm_object_t upobj;
|
||||
vm_offset_t up;
|
||||
vm_page_t m;
|
||||
|
||||
upobj = p->p_upages_obj;
|
||||
for(i=0;i<UPAGES;i++) {
|
||||
|
||||
up = (vm_offset_t)p->p_addr;
|
||||
for (i = 0; i < UPAGES; i++) {
|
||||
m = vm_page_grab(upobj, i, VM_ALLOC_NORMAL | VM_ALLOC_RETRY);
|
||||
|
||||
pmap_kenter(((vm_offset_t) p->p_addr) + i * PAGE_SIZE,
|
||||
VM_PAGE_TO_PHYS(m));
|
||||
|
||||
pmap_kenter(up + i * PAGE_SIZE, VM_PAGE_TO_PHYS(m));
|
||||
if (m->valid != VM_PAGE_BITS_ALL) {
|
||||
rv = vm_pager_get_pages(upobj, &m, 1, 0);
|
||||
if (rv != VM_PAGER_OK)
|
||||
@ -1064,7 +1060,6 @@ pmap_swapin_proc(p)
|
||||
m = vm_page_lookup(upobj, i);
|
||||
m->valid = VM_PAGE_BITS_ALL;
|
||||
}
|
||||
|
||||
vm_page_wire(m);
|
||||
vm_page_wakeup(m);
|
||||
vm_page_flag_set(m, PG_MAPPED | PG_WRITEABLE);
|
||||
@ -1074,7 +1069,7 @@ pmap_swapin_proc(p)
|
||||
* The pcb may be at a different physical address now so cache the
|
||||
* new address.
|
||||
*/
|
||||
p->p_md.md_pcbpaddr = (void*) vtophys((vm_offset_t) &p->p_addr->u_pcb);
|
||||
p->p_md.md_pcbpaddr = (void*)vtophys((vm_offset_t)&p->p_addr->u_pcb);
|
||||
}
|
||||
|
||||
/***************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user