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>
This commit is contained in:
Thomas Klausner
2015-06-26 10:31:53 +02:00
committed by Thomas Hellstrom
parent e57a592d35
commit 8081bdcaea
2 changed files with 20 additions and 43 deletions

View File

@@ -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],

View File

@@ -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>