[PATCH:xf86-input-vmmouse 2/2 v2] Add NetBSD/amd64 support for iopl calls.
Thomas Klausner
wiz at NetBSD.org
Fri Jun 26 01:51:59 PDT 2015
Updated patch:
move header include lower and be consistent in ifdef vs. if defined
Thomas
-------------- next part --------------
>From 6cbbb834ee10b4b840f893d29659e53d3719504c Mon Sep 17 00:00:00 2001
From: Thomas Klausner <wiz at NetBSD.org>
Date: Fri, 26 Jun 2015 10:31:53 +0200
Subject: [PATCH:xf86-input-vmmouse 2/2] Add NetBSD/amd64 support for iopl
calls.
While here, correct AC_DEFINE usage.
Signed-off-by: Thomas Klausner <wiz at NetBSD.org>
---
configure.ac | 13 +++++++++----
tools/vmmouse_iopl.c | 50 +++++++++++---------------------------------------
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>
--
2.4.3
More information about the xorg-devel
mailing list