summaryrefslogtreecommitdiff
path: root/tools
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 /tools
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/vmmouse_iopl.c50
1 files changed, 11 insertions, 39 deletions
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>