PERFORCE change 134630 for review
Kip Macy
kmacy at FreeBSD.org
Fri Feb 1 21:28:22 PST 2008
http://perforce.freebsd.org/chv.cgi?CH=134630
Change 134630 by kmacy at kmacy:storage:toehead on 2008/02/02 05:27:57
fix prot
remove tracing
add error logging
Affected files ...
.. //depot/projects/toehead/sys/dev/cxgb/ulp/tom/cxgb_vm.c#4 edit
Differences ...
==== //depot/projects/toehead/sys/dev/cxgb/ulp/tom/cxgb_vm.c#4 (text+ko) ====
@@ -46,6 +46,7 @@
pmap_t pmap;
vm_page_t m, *pages;
vm_prot_t prot;
+
/*
* Check that virtual address range is legal
@@ -54,16 +55,18 @@
* architectures define it
*/
end = addr + (count * PAGE_SIZE);
- if (end > VM_MAXUSER_ADDRESS)
+ if (end > VM_MAXUSER_ADDRESS) {
+ printf("bad address passed\n");
return (EFAULT);
+ }
- TRACE_ENTER;
td = curthread;
map = &td->td_proc->p_vmspace->vm_map;
pmap = &td->td_proc->p_vmspace->vm_pmap;
pages = mp;
- prot = (flags & VM_HOLD_WRITEABLE) ? VM_PROT_WRITE : VM_PROT_READ;
+ prot = VM_PROT_READ;
+ prot |= (flags & VM_HOLD_WRITEABLE) ? VM_PROT_WRITE : 0;
bzero(pages, sizeof(vm_page_t *) * count);
retry:
@@ -97,7 +100,6 @@
vm_page_unlock_queues();
if (faults == 0) {
- TRACE_EXIT;
return (0);
}
@@ -117,9 +119,13 @@
rv = vm_fault(map, va, VM_PROT_WRITE, VM_FAULT_DIRTY);
} else if (m == NULL)
rv = vm_fault(map, va, VM_PROT_READ, VM_FAULT_NORMAL);
- if (rv)
+ if (rv) {
+ printf("vm_fault bad return rv=%d va=0x%jx\n", rv, va);
+
goto error;
- }
+ }
+ }
+
goto retry;
error:
@@ -128,7 +134,6 @@
if (*pages)
vm_page_unhold(*pages);
vm_page_unlock_queues();
- TRACE_EXIT;
return (EFAULT);
}
More information about the p4-projects
mailing list