Subject: pkg/29943: vmware-module3 fails to compile - patch included
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Juergen Hannken-Illjes <hannken@eis.cs.tu-bs.de>
List: pkgsrc-bugs
Date: 04/11/2005 10:27:00
>Number:         29943
>Category:       pkg
>Synopsis:       vmware-module3 fails to compile - patch included
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 11 10:27:00 +0000 2005
>Originator:     Juergen Hannken-Illjes
>Release:        NetBSD 3.99.3
>Organization:
>Environment:
Architecture: i386
Machine: i386
>Description:
	emulators/vmware-module3 needs update for yamt-km branch.
>How-To-Repeat:
>Fix:
	These three patches work for me.
====
Patch patchab
--- source/vmmon/netbsd/drv.c.orig	2004-12-07 22:06:47.000000000 +0100
+++ source/vmmon/netbsd/drv.c
@@ -426,7 +426,11 @@ vmmon_alloc_low_pages(struct vmx86_softc
 	/*
 	 * Map the segment into wired kernel virtual memory.
 	 */
+#if __NetBSD_Version__ >= 399000300
+	va = uvm_km_alloc(kernel_map, numPages * PAGE_SIZE, 0, UVM_KMF_VAONLY);
+#else
 	va = uvm_km_valloc(kernel_map, numPages * PAGE_SIZE);
+#endif
 	if (va == 0) {
 		VMDEBUG("vmmon_alloc_low_pages: km_valloc failed\n");
 		goto bad;
@@ -496,7 +500,15 @@ vmmon_destroy_low_pages(MemRange *r)
 	/*
 	 * Unmap the kernel virtual memory used by this range.
 	 */
+#if __NetBSD_Version__ >= 399000300
+	pmap_remove(pmap_kernel(), (vaddr_t)r->kAddr,
+	    (vaddr_t)r->kAddr + r->numPages * PAGE_SIZE);
+	pmap_update(pmap_kernel());
+	uvm_km_free(kernel_map, (vaddr_t)r->kAddr, r->numPages * PAGE_SIZE,
+	    UVM_KMF_VAONLY);
+#else
 	uvm_km_free(kernel_map, (vaddr_t)r->kAddr, r->numPages * PAGE_SIZE);
+#endif
 
 	/*
 	 * Build a list of pages to free back to the VM system.
====
Patch patchac
--- source/vmmon/netbsd/host.c.orig	2003-10-09 20:38:04.000000000 +0200
+++ source/vmmon/netbsd/host.c
@@ -656,7 +656,12 @@ HostIF_UserToDriverPtr(VMDriver *vm, // 
 	    VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
 
 	uaddr = (vaddr_t)addr;
+#if __NetBSD_Version__ >= 399000300
+	kvaddr = uvm_km_alloc(kernel_map, PAGE_SIZE, 0,
+	    UVM_KMF_VAONLY | UVM_KMF_WAITVA);
+#else
 	kvaddr = uvm_km_valloc_wait(kernel_map, PAGE_SIZE);
+#endif
 	pmap_extract(vm_map_pmap(&curproc->p_vmspace->vm_map), uaddr, &paddr);
 	pmap_kenter_pa(kvaddr, paddr,
 	    VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE);
====
Patch patchad
--- source/vmnet/if_hubmod.c.orig	2004-12-07 22:06:47.000000000 +0100
+++ source/vmnet/if_hubmod.c
@@ -433,7 +433,12 @@ port_mappoll(struct hubport_softc *ports
 	off = uaddr - upage;
 	if (off > (PAGE_SIZE - sizeof(u_int32_t)))
 		return EINVAL;
+#if __NetBSD_Version__ >= 399000300
+	kpage = uvm_km_alloc(kernel_map, PAGE_SIZE, 0,
+	    UVM_KMF_VAONLY | UVM_KMF_WAITVA);
+#else
 	kpage = uvm_km_valloc_wait(kernel_map, PAGE_SIZE);
+#endif
 	kaddr = kpage + off;
 
 	PHOLD(CURLWP);
@@ -456,7 +461,11 @@ port_mappoll(struct hubport_softc *ports
 
     err:
 	PRELE(CURLWP);
+#if __NetBSD_Version__ >= 399000300
+	uvm_km_free(kernel_map, kpage, PAGE_SIZE, UVM_KMF_VAONLY);
+#else
 	uvm_km_free_wakeup(kernel_map, kpage, PAGE_SIZE);
+#endif
 	return (error);
 }
 
@@ -467,7 +476,12 @@ port_unmappoll(struct hubport_softc *por
 #if 1
 	pmap_update(pmap_kernel());
 #endif
+#if __NetBSD_Version__ >= 399000300
+	uvm_km_free(kernel_map, portsc->port_kpollpage, PAGE_SIZE,
+	    UVM_KMF_VAONLY);
+#else
 	uvm_km_free_wakeup(kernel_map, portsc->port_kpollpage, PAGE_SIZE);
+#endif
 	PHOLD(CURLWP);
 	uvm_vsunlock(curproc, (void *)portsc->port_upollpage, PAGE_SIZE);
 	PRELE(CURLWP);