summaryrefslogtreecommitdiff
path: root/emulators
diff options
context:
space:
mode:
authorobache <obache@pkgsrc.org>2007-07-31 14:44:02 +0000
committerobache <obache@pkgsrc.org>2007-07-31 14:44:02 +0000
commit8427aa0d23853b8f8b3da5cf51f9861b53ad73f7 (patch)
tree6155cb12e41feaef757e049e02c508b70652f385 /emulators
parent402a1d0078dc9df4827bf3d35c1e5df12ecd422f (diff)
downloadpkgsrc-8427aa0d23853b8f8b3da5cf51f9861b53ad73f7.tar.gz
Fixed build problem on NetBSD 3.x (PR 36632) and NetBSD 2.x (PR 25474).
Almost of patches are inspired by emulators/vmware-module3.
Diffstat (limited to 'emulators')
-rw-r--r--emulators/vmware-module/Makefile4
-rw-r--r--emulators/vmware-module/distinfo6
-rw-r--r--emulators/vmware-module/patches/patch-ac205
-rw-r--r--emulators/vmware-module/patches/patch-ad45
-rw-r--r--emulators/vmware-module/patches/patch-ae209
-rw-r--r--emulators/vmware-module/patches/patch-af20
6 files changed, 485 insertions, 4 deletions
diff --git a/emulators/vmware-module/Makefile b/emulators/vmware-module/Makefile
index 4c0b7650453..b0db5839639 100644
--- a/emulators/vmware-module/Makefile
+++ b/emulators/vmware-module/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.24 2007/02/22 19:26:29 wiz Exp $
+# $NetBSD: Makefile,v 1.25 2007/07/31 14:44:02 obache Exp $
DISTNAME= vmware-netbsd-1.2
PKGNAME= vmware-module-1.2
@@ -10,8 +10,6 @@ MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= http://www.wasabisystems.com/
COMMENT= Kernel modules for the VMware 2.x emulator
-BROKEN_IN= pkgsrc-2005Q4 pkgsrc-2006Q1 pkgsrc-2006Q4
-
CONFLICTS= vmware-module-3*
ONLY_FOR_PLATFORM= NetBSD-*-i386
diff --git a/emulators/vmware-module/distinfo b/emulators/vmware-module/distinfo
index cda2df38cd3..cf23e98d3e9 100644
--- a/emulators/vmware-module/distinfo
+++ b/emulators/vmware-module/distinfo
@@ -1,6 +1,10 @@
-$NetBSD: distinfo,v 1.7 2005/02/23 18:49:21 agc Exp $
+$NetBSD: distinfo,v 1.8 2007/07/31 14:44:02 obache Exp $
SHA1 (vmware-netbsd-1.2.tgz) = 383512f5a9f6cbc50ad5d25ea7e2ae921b00bb1a
RMD160 (vmware-netbsd-1.2.tgz) = 857b17876611ca999747e38fce234a85ed9802a9
Size (vmware-netbsd-1.2.tgz) = 97596 bytes
SHA1 (patch-ab) = 19ff0b151b62870835a2b87e69a52b1cb3d95045
+SHA1 (patch-ac) = a576f04959e793cffbcbaddc409f69ad6929c541
+SHA1 (patch-ad) = 68d7ab77e51f73074f2ef4661af928bfafc7b72d
+SHA1 (patch-ae) = 928deb0c7530905ffe5a04045ef27699fc68d43f
+SHA1 (patch-af) = 2ac5dfaecf97152ca8735c2ec40db881b49d2d76
diff --git a/emulators/vmware-module/patches/patch-ac b/emulators/vmware-module/patches/patch-ac
new file mode 100644
index 00000000000..0c3d810cdbc
--- /dev/null
+++ b/emulators/vmware-module/patches/patch-ac
@@ -0,0 +1,205 @@
+$NetBSD: patch-ac,v 1.3 2007/07/31 14:44:03 obache Exp $
+
+--- source/vmmon/netbsd/drv.c.orig 2003-02-16 21:28:36.000000000 +0900
++++ source/vmmon/netbsd/drv.c
+@@ -68,6 +68,29 @@
+ #include <vm/vm.h>
+ #endif
+
++/* use curproc for pre-nathanw-sa world, curlwp post */
++#if __NetBSD_Version__ >= 106130000
++#define CURLWP curlwp /* new world order */
++#else
++#define CURLWP curproc /* old world order */
++#endif
++
++/* change to pass lwp rather than proc to driver entry points in 1.6V */
++#if __NetBSD_Version__ == 106220000 || __NetBSD_Version__ >= 399001400
++#define ENTRYARG lwp
++#define LWP2PROC(l) (l->l_proc)
++#else
++#define ENTRYARG proc
++#define LWP2PROC(l) (l)
++#endif
++
++/* dupfd moved from struct proc to struct lwp in 1.6ZA */
++#if __NetBSD_Version__ >= 106270000
++#define DUPFD(p) (curlwp)->l_dupfd
++#else
++#define DUPFD(p) (p)->p_dupfd
++#endif
++
+ #define FILECODE "F(300)"
+
+ #include "x86.h"
+@@ -95,13 +118,13 @@
+ int vmmon_lkmentry(struct lkm_table *, int, int);
+ static int vmmon_handle(struct lkm_table *, int);
+
+-static int vmmon_open(dev_t dev, int oflags, int devtype, struct proc *p);
+-static int vmmon_close(dev_t dev, int cflags, int devtype, struct proc *p);
++static int vmmon_open(dev_t dev, int oflags, int devtype, struct ENTRYARG *l);
++static int vmmon_close(dev_t dev, int cflags, int devtype, struct ENTRYARG *l);
+ static int vmmon_ioctl(dev_t dev, u_long cmd, caddr_t data, int flags,
+- struct proc *p);
+-static int vmmon_poll(dev_t, int, struct proc *);
++ struct ENTRYARG *l);
++static int vmmon_poll(dev_t, int, struct ENTRYARG *);
+
+-static int vmmon_fake_clonedev(dev_t, int, struct proc *);
++static int vmmon_fake_clonedev(dev_t, int, struct ENTRYARG *);
+
+ static int vm_create(struct vmmon_softc *, struct vmx86_softc **);
+ static struct vmx86_softc * vm_allocate(struct vmmon_softc *);
+@@ -163,19 +186,19 @@ vmmon_handle(struct lkm_table *lkmtp, in
+ }
+
+ static int
+-vmmon_open(dev_t dev, int flag, int mode, struct proc *p)
++vmmon_open(dev_t dev, int flag, int mode, struct ENTRYARG *l)
+ {
+ struct vmmon_softc *vmmonsc;
+ struct vmx86_softc *vmxsc;
+ int error;
+ VMDriver *vm;
+
+- if (p->p_dupfd >= 0)
++ if (DUPFD(LWP2PROC(l)) >= 0)
+ return ENODEV;
+
+- VMDEBUG("vmmon: %d opened device\n", p->p_pid);
++ VMDEBUG("vmmon: %d opened device\n", LWP2PROC(l)->p_pid);
+
+- if (suser(p->p_ucred, &p->p_acflag) != 0)
++ if (suser(LWP2PROC(l)->p_ucred, &LWP2PROC(l)->p_acflag) != 0)
+ return (EPERM);
+
+ vmmonsc = &vmmon_sc;
+@@ -189,15 +212,15 @@ vmmon_open(dev_t dev, int flag, int mode
+ vmmon_refcnt++;
+
+ VMDEBUG("vmmon: pid %d new vm: num %d major %d\n",
+- p->p_pid, VMNUM(vmxsc->vm_dev), major(vmxsc->vm_dev));
++ LWP2PROC(l)->p_pid, VMNUM(vmxsc->vm_dev), major(vmxsc->vm_dev));
+
+- error = vmmon_fake_clonedev(vmxsc->vm_dev, flag, p);
+- if (error != 0 && p->p_dupfd < 0) {
++ error = vmmon_fake_clonedev(vmxsc->vm_dev, flag, l);
++ if (error != 0 && DUPFD(LWP2PROC(l)) < 0) {
+ vm_destroy(vmmonsc, VMNUM(vmxsc->vm_dev));
+ return error;
+ }
+
+- vm = Vmx86_Init((void *)vmxsc, (void *)(p->p_pid));
++ vm = Vmx86_Init((void *)vmxsc, (void *)(LWP2PROC(l)->p_pid));
+ if (vm == NULL) {
+ vm_destroy(vmmonsc, VMNUM(vmxsc->vm_dev));
+ error = ENOMEM;
+@@ -211,13 +234,13 @@ vmmon_open(dev_t dev, int flag, int mode
+
+
+ static int
+-vmmon_close(dev_t dev, int flags, int mode, struct proc *p)
++vmmon_close(dev_t dev, int flags, int mode, struct ENTRYARG *l)
+ {
+ int num;
+ struct vmmon_softc *sc;
+ struct vmx86_softc *vmxsc;
+
+- VMDEBUG("vmmon: close vm %d by pid %d\n", VMNUM(dev), p->p_pid);
++ VMDEBUG("vmmon: close vm %d by pid %d\n", VMNUM(dev), LWP2PROC(l)->p_pid);
+
+ sc = &vmmon_sc;
+
+@@ -240,7 +263,7 @@ vmmon_close(dev_t dev, int flags, int mo
+ printf("vmmon: refcnt < 0 ??\n");
+ }
+
+- VMDEBUG("vmmon: vm %d closed by %d\n", num, p->p_pid);
++ VMDEBUG("vmmon: vm %d closed by %d\n", num, LWP2PROC(l)->p_pid);
+
+ return (0);
+ }
+@@ -250,7 +273,7 @@ vmmon_close(dev_t dev, int flags, int mo
+ * XXXX - poor man's device cloning.
+ */
+ int
+-vmmon_fake_clonedev(dev_t dev, int flag, struct proc *p)
++vmmon_fake_clonedev(dev_t dev, int flag, struct ENTRYARG *l)
+ {
+ struct file *fp;
+ int error, fd;
+@@ -260,7 +283,7 @@ vmmon_fake_clonedev(dev_t dev, int flag,
+ /* XXX */
+ return EINVAL;
+
+- error = falloc(p, &fp, &fd);
++ error = falloc(LWP2PROC(l), &fp, &fd);
+ if (error != 0)
+ return error;
+ error = cdevvp(dev, &vp);
+@@ -279,9 +302,9 @@ vmmon_fake_clonedev(dev_t dev, int flag,
+ FILE_SET_MATURE(fp);
+ #endif
+ #endif
+- FILE_UNUSE(fp, p);
++ FILE_UNUSE(fp, l);
+
+- p->p_dupfd = fd;
++ DUPFD(LWP2PROC(l)) = fd;
+
+ return ENXIO;
+ }
+@@ -292,7 +315,7 @@ vmmon_fake_clonedev(dev_t dev, int flag,
+ * set syscall return values for the benefit of Linux emulation.
+ */
+ static int
+-vmmon_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
++vmmon_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct ENTRYARG *l)
+ {
+ struct vmx86_softc *vmxsc;
+ struct vmmon_softc *sc;
+@@ -307,7 +330,7 @@ vmmon_ioctl(dev_t dev, u_long cmd, caddr
+ VMDriver *vm;
+
+ VMDEBUG("vmmon: ioctl %lx on vm %d by pid %d\n",
+- cmd, VMNUM(dev), p->p_pid);
++ cmd, VMNUM(dev), LWP2PROC(l)->p_pid);
+
+ sc = &vmmon_sc;
+
+@@ -469,7 +492,7 @@ vm_select_timo(void *arg)
+
+
+ static int
+-vmmon_poll(dev_t dev, int events, struct proc *p)
++vmmon_poll(dev_t dev, int events, struct ENTRYARG *l)
+ {
+ struct vmmon_softc *sc;
+ struct vmx86_softc *vmxsc;
+@@ -484,7 +507,7 @@ vmmon_poll(dev_t dev, int events, struct
+ return ENXIO;
+
+ VMDEBUG("vmmon: poll on vm %d by pid %d\n",
+- VMNUM(dev), p->p_pid);
++ VMNUM(dev), LWP2PROC(l)->p_pid);
+
+ s = splsoftclock();
+ if (vmxsc->vm_flags & VMFL_SELTIMO) {
+@@ -493,7 +516,7 @@ vmmon_poll(dev_t dev, int events, struct
+ } else {
+ if (vmxsc->vm_flags & VMFL_SELWAIT)
+ callout_stop(&vmxsc->vm_callout);
+- selrecord(p, &vmxsc->vm_rsel);
++ selrecord(l, &vmxsc->vm_rsel);
+ vmxsc->vm_flags |= VMFL_SELWAIT;
+ callout_reset(&vmxsc->vm_callout, 1, vm_select_timo, vmxsc);
+ }
+@@ -673,6 +696,6 @@ Panic(char *fmt, ...)
+ vWarning(vm);
+ }
+
+- exit1(curproc, 0);
++ exit1(CURLWP, 0);
+ /* NOTREACHED */
+ }
diff --git a/emulators/vmware-module/patches/patch-ad b/emulators/vmware-module/patches/patch-ad
new file mode 100644
index 00000000000..b138367716c
--- /dev/null
+++ b/emulators/vmware-module/patches/patch-ad
@@ -0,0 +1,45 @@
+$NetBSD: patch-ad,v 1.5 2007/07/31 14:44:03 obache Exp $
+
+--- source/vmmon/netbsd/host.c.orig 2003-02-16 21:28:36.000000000 +0900
++++ source/vmmon/netbsd/host.c
+@@ -60,6 +60,13 @@ lyaev Exp $
+ extern vm_map_t kernel_map;
+ #endif
+
++/* use curproc for pre-nathanw-sa world, curlwp post */
++#if __NetBSD_Version__ >= 106130000
++#define CURLWP curlwp /* new world order */
++#else
++#define CURLWP curproc /* old world order */
++#endif
++
+ #include "x86.h"
+ #include "vm_types.h"
+ #include "vm_assert.h"
+@@ -272,7 +279,7 @@ HostIF_InitFP(VMDriver *vm)
+
+ if (!(val & mask)) {
+ val = val | mask;
+- outb(val,0xA1);
++ outb(0xA1,val);
+ }
+ #endif
+ }
+@@ -635,7 +642,7 @@ HostIF_UserToDriverPtr(VMDriver *vm, voi
+ if (vm->crossvaddr != NULL)
+ Warning("KernelAddr already allocated\n");
+
+- PHOLD(curproc);
++ PHOLD(CURLWP);
+ uvm_vslock(curproc, addr, PAGE_SIZE,
+ VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
+
+@@ -644,7 +651,7 @@ HostIF_UserToDriverPtr(VMDriver *vm, voi
+ 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);
+- PRELE(curproc);
++ PRELE(CURLWP);
+ vm->crossvaddr = (void *)kvaddr;
+ vm->crossuaddr = addr;
+ #ifdef DEBUG
diff --git a/emulators/vmware-module/patches/patch-ae b/emulators/vmware-module/patches/patch-ae
new file mode 100644
index 00000000000..33cfb9ef686
--- /dev/null
+++ b/emulators/vmware-module/patches/patch-ae
@@ -0,0 +1,209 @@
+$NetBSD: patch-ae,v 1.4 2007/07/31 14:44:04 obache Exp $
+
+--- source/vmnet/if_hubmod.c.orig 2003-02-16 11:09:13.000000000 +0900
++++ source/vmnet/if_hubmod.c
+@@ -87,17 +87,40 @@ static int ether_ioctl(struct ifnet *, u
+ #include <vm/vm.h>
+ #endif
+
++/* use curproc for pre-nathanw-sa world, curlwp post */
++#if __NetBSD_Version__ >= 106130000
++#define CURLWP curlwp /* new world order */
++#else
++#define CURLWP curproc /* old world order */
++#endif
++
++/* change to pass lwp rather than proc to driver entry points in 1.6V */
++#if __NetBSD_Version__ == 106220000 || __NetBSD_Version__ >= 399001400
++#define ENTRYARG lwp
++#define LWP2PROC(l) (l->l_proc)
++#else
++#define ENTRYARG proc
++#define LWP2PROC(l) (l)
++#endif
++
++/* dupfd moved from struct proc to struct lwp in 1.6ZA */
++#if __NetBSD_Version__ >= 106270000
++#define DUPFD(p) (curlwp)->l_dupfd
++#else
++#define DUPFD(p) (p)->p_dupfd
++#endif
++
+ #define HUBDEBUG if (hub_debug) printf
+
+ int if_hub_lkmentry(struct lkm_table *, int, int);
+
+-static int hub_open(dev_t dev, int oflags, int devtype, struct proc *p);
+-static int hub_close(dev_t dev, int cflags, int devtype, struct proc *p);
++static int hub_open(dev_t dev, int oflags, int devtype, struct ENTRYARG *l);
++static int hub_close(dev_t dev, int cflags, int devtype, struct ENTRYARG *l);
+ static int hub_ioctl(dev_t dev, u_long cmd, caddr_t data, int flags,
+- struct proc *p);
++ struct ENTRYARG *p);
+ static int hub_read(dev_t, struct uio *, int);
+ static int hub_write(dev_t, struct uio *, int);
+-static int hub_poll(dev_t, int, struct proc *);
++static int hub_poll(dev_t, int, struct ENTRYARG *);
+
+ static int hub_ifinit(struct ifnet *);
+ static int hub_handle(struct lkm_table *, int);
+@@ -112,7 +135,7 @@ static struct hubport_softc *port_alloca
+ static void port_deallocate(struct hubport_softc *);
+
+ static int hub_sendchain(struct hubport_softc *, struct mbuf *);
+-static int hub_fake_clonedev(dev_t, int, struct proc *);
++static int hub_fake_clonedev(dev_t, int, struct ENTRYARG *);
+
+
+
+@@ -356,24 +379,24 @@ port_pktmatch(struct hubport_softc *port
+
+
+ static int
+-hub_open(dev_t dev, int flag, int mode, struct proc *p)
++hub_open(dev_t dev, int flag, int mode, struct ENTRYARG *l)
+ {
+ struct hubdev_softc *hubsc;
+ struct hubport_softc *portsc;
+ int error, unit;
+
+- if (p->p_dupfd >= 0)
++ if (DUPFD(LWP2PROC(l)) >= 0)
+ return ENODEV;
+
+ unit = HUBUNIT(dev);
+
+- HUBDEBUG("if_hub: %d opened minor %d hub %d\n", p->p_pid, minor(dev),
++ HUBDEBUG("if_hub: %d opened minor %d hub %d\n", LWP2PROC(l)->p_pid, minor(dev),
+ unit);
+
+ if (unit >= MAXHUBDEVS)
+ return (ENXIO);
+
+- if (suser(p->p_ucred, &p->p_acflag) != 0)
++ if (suser(LWP2PROC(l)->p_ucred, &LWP2PROC(l)->p_acflag) != 0)
+ return (EPERM);
+
+ hubsc = hub_scs[unit];
+@@ -393,11 +416,11 @@ hub_open(dev_t dev, int flag, int mode,
+ hub_refcnt++;
+
+ HUBDEBUG("if_hub: pid %d new port: unit %d, port %d\n",
+- p->p_pid, HUBUNIT(portsc->port_dev),
++ LWP2PROC(l)->p_pid, HUBUNIT(portsc->port_dev),
+ HUBPORT(portsc->port_dev));
+
+- error = hub_fake_clonedev(portsc->port_dev, flag, p);
+- if (error != 0 && p->p_dupfd < 0)
++ error = hub_fake_clonedev(portsc->port_dev, flag, l);
++ if (error != 0 && DUPFD(LWP2PROC(l)) < 0)
+ port_destroy(hubsc, HUBPORT(portsc->port_dev));
+
+ return error;
+@@ -410,7 +433,7 @@ hub_open(dev_t dev, int flag, int mode,
+ * close the device - mark i/f down & delete routing info
+ */
+ static int
+-hub_close(dev_t dev, int flags, int mode, struct proc *p)
++hub_close(dev_t dev, int flags, int mode, struct ENTRYARG *l)
+ {
+ int s, unit, port;
+ struct hubdev_softc *hubsc;
+@@ -418,7 +441,7 @@ hub_close(dev_t dev, int flags, int mode
+ struct mbuf *m;
+
+ HUBDEBUG("if_hub: close hub %d unit %d by pid %d\n",
+- HUBUNIT(dev), HUBPORT(dev), p->p_pid);
++ HUBUNIT(dev), HUBPORT(dev), LWP2PROC(l)->p_pid);
+ /*
+ * The 2 cases below shouldn't ever happen.
+ */
+@@ -452,7 +475,7 @@ hub_close(dev_t dev, int flags, int mode
+ printf("if_hub: refcnt < 0 ??\n");
+ }
+
+- HUBDEBUG("if_hub: hub %d port %d closed by %d\n", unit, port, p->p_pid);
++ HUBDEBUG("if_hub: hub %d port %d closed by %d\n", unit, port, LWP2PROC(l)->p_pid);
+
+ return (0);
+ }
+@@ -485,7 +508,7 @@ hub_ifioctl(struct ifnet *ifp, u_long cm
+ * XXXX - poor man's device cloning.
+ */
+ int
+-hub_fake_clonedev(dev_t dev, int flag, struct proc *p)
++hub_fake_clonedev(dev_t dev, int flag, struct ENTRYARG *l)
+ {
+ struct file *fp;
+ int error, fd;
+@@ -495,7 +518,7 @@ hub_fake_clonedev(dev_t dev, int flag, s
+ /* XXX */
+ return EINVAL;
+
+- error = falloc(p, &fp, &fd);
++ error = falloc(LWP2PROC(l), &fp, &fd);
+ if (error != 0)
+ return error;
+ error = cdevvp(dev, &vp);
+@@ -514,11 +537,15 @@ hub_fake_clonedev(dev_t dev, int flag, s
+ FILE_SET_MATURE(fp);
+ #endif
+ #endif
+- FILE_UNUSE(fp, p);
++ FILE_UNUSE(fp, l);
+
+- p->p_dupfd = fd;
++ DUPFD(LWP2PROC(l)) = fd;
+
++#ifdef EMOVEFD
++ return EMOVEFD;
++#else
+ return ENXIO;
++#endif
+ }
+
+ /*
+@@ -653,7 +680,7 @@ hub_ifstart(struct ifnet *ifp)
+
+
+ static int
+-hub_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
++hub_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct ENTRYARG *l)
+ {
+ struct hubport_softc *portsc, *newport;
+ struct hubdev_softc *hubsc;
+@@ -669,7 +696,7 @@ hub_ioctl(dev_t dev, u_long cmd, caddr_t
+ u_long val;
+
+ HUBDEBUG("if_hub: ioctl %lx on hub %d port %d by pid %d\n",
+- cmd, HUBUNIT(dev), HUBPORT(dev), p->p_pid);
++ cmd, HUBUNIT(dev), HUBPORT(dev), LWP2PROC(l)->p_pid);
+
+ hubsc = hub_scs[HUBUNIT(dev)];
+ if (hubsc == NULL)
+@@ -984,7 +1011,7 @@ hub_write(dev_t dev, struct uio *uio, in
+ * anyway, it either accepts the packet or drops it
+ */
+ static int
+-hub_poll(dev_t dev, int events, struct proc *p)
++hub_poll(dev_t dev, int events, struct ENTRYARG *l)
+ {
+ struct hubdev_softc *hubsc;
+ struct hubport_softc *portsc;
+@@ -998,14 +1025,14 @@ hub_poll(dev_t dev, int events, struct p
+ return ENXIO;
+
+ HUBDEBUG("if_hub: poll on hub %d port %d by pid %d\n",
+- HUBUNIT(dev), HUBPORT(dev), p->p_pid);
++ HUBUNIT(dev), HUBPORT(dev), LWP2PROC(l)->p_pid);
+
+ s = splnet();
+ if (events & (POLLIN | POLLRDNORM)) {
+ if (portsc->port_rcvq.ifq_len > 0)
+ revents |= (events & (POLLIN | POLLRDNORM));
+ else
+- selrecord(p, &portsc->port_rsel);
++ selrecord(l, &portsc->port_rsel);
+ }
+
+ if (events & (POLLOUT | POLLWRNORM))
diff --git a/emulators/vmware-module/patches/patch-af b/emulators/vmware-module/patches/patch-af
new file mode 100644
index 00000000000..0ccf96d78c7
--- /dev/null
+++ b/emulators/vmware-module/patches/patch-af
@@ -0,0 +1,20 @@
+$NetBSD: patch-af,v 1.3 2007/07/31 14:44:04 obache Exp $
+
+--- source/vmmon/include/x86.h.orig 2003-02-16 19:09:57.000000000 +0900
++++ source/vmmon/include/x86.h
+@@ -180,9 +180,15 @@
+ #define MSR_TSC 0x00000010
+ #endif /* MSR_TSC */
+ #define MSR_MTRR_CAP 0x000000fe
++#ifndef MSR_SYSENTER_CS
+ #define MSR_SYSENTER_CS 0x00000174
++#endif
++#ifndef MSR_SYSENTER_ESP
+ #define MSR_SYSENTER_ESP 0x00000175
++#endif
++#ifndef MSR_SYSENTER_EIP
+ #define MSR_SYSENTER_EIP 0x00000176
++#endif
+
+
+ typedef uint32 CReg;