summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Klausner <wiz@NetBSD.org>2015-06-26 10:31:53 +0200
committerThomas Hellstrom <thellstrom@vmware.com>2015-06-26 14:06:24 +0200
commit8081bdcaeae7dce7b4ffa5ada4737716421dba47 (patch)
treeb58bb76890faf38253bd662ffe866887dfbbddf7
parente57a592d35273f1e5ba5c944b8bc87efb9503c32 (diff)
Add NetBSD/amd64 support for iopl calls.
While here, correct AC_DEFINE usage. Signed-off-by: Thomas Klausner <wiz@NetBSD.org> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
-rw-r--r--configure.ac13
-rw-r--r--tools/vmmouse_iopl.c50
2 files changed, 20 insertions, 43 deletions
diff --git a/configure.ac b/configure.ac
index 55b2345..87ea3ae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -152,17 +152,17 @@ case $host_cpu in
i*86)
case $host_os in
*freebsd*) AC_DEFINE(USE_DEV_IO) ;;
- *netbsd*) AC_DEFINE(USE_I386_IOPL)
+ *netbsd*) AC_DEFINE([USE_I386_IOPL], [], [BSD i386 iopl])
use_i386_iopl=yes ;;
- *openbsd*) AC_DEFINE(USE_I386_IOPL)
+ *openbsd*) AC_DEFINE([USE_I386_IOPL], [], [BSD i386 iopl])
use_i386_iopl=yes ;;
esac
;;
x86_64*|amd64*)
case $host_os in
*freebsd*) AC_DEFINE(USE_DEV_IO, 1, [BSD /dev/io]) ;;
- *netbsd*) AC_DEFINE(USE_I386_IOPL, 1, [BSD i386 iopl])
- use_i386_iopl=yes ;;
+ *netbsd*) AC_DEFINE(USE_X86_64_IOPL, 1, [BSD X86_64 iopl])
+ use_x86_64_iopl=yes ;;
*openbsd*) AC_DEFINE(USE_AMD64_IOPL, 1, [BSD AMD64 iopl])
use_amd64_iopl=yes ;;
esac
@@ -179,6 +179,11 @@ if test x$use_amd64_iopl = xyes; then
[AC_MSG_ERROR([cannot find library for amd64_iopl])])
fi
+if test x$use_x86_64_iopl = xyes; then
+ AC_CHECK_LIB(x86_64, x86_64_iopl,[],
+ [AC_MSG_ERROR([cannot find library for x86_64_iopl])])
+fi
+
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.0.1] xproto $REQUIRED_MODULES)
PKG_CHECK_EXISTS([xorg-server >= 1.1.0],
diff --git a/tools/vmmouse_iopl.c b/tools/vmmouse_iopl.c
index 8794622..27bbe62 100644
--- a/tools/vmmouse_iopl.c
+++ b/tools/vmmouse_iopl.c
@@ -44,8 +44,15 @@
#if defined(VMMOUSE_OS_BSD)
#include <sys/types.h>
-#ifdef USE_I386_IOPL
+#if defined(USE_I386_IOPL) || defined(USE_AMD64_IOPL) || defined(USE_X86_64_IOPL)
#include <machine/sysarch.h>
+#if defined(USE_I386_IOPL)
+#define IOPL_NAME i386_iopl
+#elif defined(USE_AMD64_IOPL)
+#define IOPL_NAME amd64_iopl
+#elif defined(USE_X86_64_IOPL)
+#define IOPL_NAME x86_64_iopl
+#endif
/***************************************************************************/
/* I/O Permissions section */
/***************************************************************************/
@@ -57,7 +64,7 @@ xf86EnableIO()
if (ExtendedEnabled)
return true;
- if (i386_iopl(1) < 0)
+ if (IOPL_NAME(1) < 0)
return false;
ExtendedEnabled = true;
@@ -70,48 +77,13 @@ xf86DisableIO()
if (!ExtendedEnabled)
return;
- i386_iopl(0);
+ IOPL_NAME(0);
ExtendedEnabled = false;
return;
}
-#endif /* USE_I386_IOPL */
-
-#ifdef USE_AMD64_IOPL
-#include <machine/sysarch.h>
-/***************************************************************************/
-/* I/O Permissions section */
-/***************************************************************************/
-
-static bool ExtendedEnabled = false;
-
-bool
-xf86EnableIO()
-{
- if (ExtendedEnabled)
- return true;
-
- if (amd64_iopl(1) < 0)
- return false;
-
- ExtendedEnabled = true;
- return true;
-}
-
-void
-xf86DisableIO()
-{
- if (!ExtendedEnabled)
- return;
-
- if (amd64_iopl(0) == 0)
- ExtendedEnabled = false;
-
- return;
-}
-
-#endif /* USE_AMD64_IOPL */
+#endif /* defined(USE_I386_IOPL) || defined(USE_AMD64_IOPL) || defined(USE_X86_64_IOPL) */
#ifdef USE_DEV_IO
#include <sys/stat.h>