Subject: Re: Fw: vmware-module3 and NetBSD current
To: None <current-users@netbsd.org>
From: Juergen Hannken-Illjes <hannken@eis.cs.tu-bs.de>
List: current-users
Date: 03/19/2006 01:28:39
--SUOF0GtieIMvvwua
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit

On Sat, Mar 18, 2006 at 07:28:32PM -0400, César Catrián Carreño wrote:
> 
> 
> Begin forwarded message:
> 
> Date: Sat, 18 Mar 2006 19:09:55 -0400
> From: César Catrián Carreño <ccatrian@eml.cc>
> To: pkgsrc-users@NetBSD.org
> Subject: vmware-module3 and NetBSD current
> 
> 
> Hello.
> 
> I need help on compiling vmware-module3 on NetBSD 3.99.17 . This is the output:
[snip] 

I use the attached local patch set.

-- 
Juergen Hannken-Illjes - hannken@eis.cs.tu-bs.de - TU Braunschweig (Germany)

--SUOF0GtieIMvvwua
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch-ab

--- source/vmmon/netbsd/drv.c.orig	2004-12-07 22:06:47.000000000 +0100
+++ source/vmmon/netbsd/drv.c
@@ -80,7 +80,7 @@
 #endif
 
 /* change to pass lwp rather than proc to driver entry points in 1.6V */
-#if __NetBSD_Version__ == 106220000
+#if __NetBSD_Version__ == 106220000 || __NetBSD_Version__ >= 399001400
 #define ENTRYARG	lwp
 #define LWP2PROC(l)	(l->l_proc)
 #else
@@ -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.

--SUOF0GtieIMvvwua
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch-ac

--- 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);

--SUOF0GtieIMvvwua
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch-ad

--- 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);

--SUOF0GtieIMvvwua
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch-ae

--- source/linuxrtc/rtc.c.orig	2003-08-26 10:07:30.000000000 +0200
+++ source/linuxrtc/rtc.c
@@ -69,7 +69,7 @@
 #include "rtcvar.h"
 
 /* change to pass lwp rather than proc to driver entry points in 1.6V */
-#if __NetBSD_Version__ == 106220000
+#if __NetBSD_Version__ == 106220000 || __NetBSD_Version__ >= 399001400
 #define ENTRYARG	lwp
 #define LWP2PROC(l)	(l->l_proc)
 #else

--SUOF0GtieIMvvwua
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch-af

--- source/vmnet/if_hubmod.c.orig	2005-12-24 16:52:14.000000000 +0100
+++ source/vmnet/if_hubmod.c
@@ -101,7 +101,7 @@
 #endif
 
 /* change to pass lwp rather than proc to driver entry points in 1.6V */
-#if __NetBSD_Version__ == 106220000
+#if __NetBSD_Version__ == 106220000 || __NetBSD_Version__ >= 399001400
 #define ENTRYARG	lwp
 #define LWP2PROC(l)	(l->l_proc)
 #else

--SUOF0GtieIMvvwua--