Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Feb 2008 05:28:21 GMT
From:      Kip Macy <kmacy@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 134630 for review
Message-ID:  <200802020528.m125SLqw066385@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=134630

Change 134630 by kmacy@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);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200802020528.m125SLqw066385>