summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Vignatti <tiago.vignatti@nokia.com>2009-11-30 18:04:26 +0200
committerTiago Vignatti <tiago.vignatti@nokia.com>2009-11-30 19:48:21 +0200
commit38c907bc96200c70ef1e4615776e35bb31335a19 (patch)
treefe7e2d2de5daaedaebb3b39b9ec1f430839c09d8
parentb327015cf23ff3b3062bea09b6e08b5b00afb90e (diff)
Set backend by CPU capabilities instead OS
I'm assuming that all i*86 are capable to use vm86. This fix the autoconf behaviour introduced on commit fd3b986d and fix some header definitions. Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
-rw-r--r--configure.ac19
-rw-r--r--include/libx86.h10
-rw-r--r--src/lrmi/backend-vm86.c4
-rw-r--r--src/vm86/vm86.c9
-rw-r--r--src/vm86/vm86.h6
5 files changed, 13 insertions, 35 deletions
diff --git a/configure.ac b/configure.ac
index f4a13fc..ebf34d0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -33,23 +33,22 @@ AC_PROG_CC
AC_PROG_LIBTOOL
-dnl OS capabilities.
+dnl CPU capabilities.
BACKEND=x86emu
-case $host_os in
- *linux*) BACKEND=vm86 ;;
+case $host_cpu in
+ i*86) BACKEND=vm86 ;;
esac
dnl Build options.
-AC_ARG_ENABLE(x86emu, AS_HELP_STRING([--enable-x86emu], [Build with x86emu as
-backend (default: disabled)]), [X86EMU=$enableval], [X86EMU=no])
+AC_ARG_WITH(backend, AS_HELP_STRING([--with-backend=BACKEND],
+ [Build with backend: x86emu or vm86]),
+ [X86EMU_OPT="$withval"],
+ [X86EMU_OPT="$BACKEND"])
-AM_CONDITIONAL(X86EMU, [test "x$X86EMU" = xyes])
-if test "x$X86EMU" = xyes; then
+if test "x$X86EMU_OPT" = xx86emu; then
BACKEND=x86emu
- AC_DEFINE(X86EMU, 1, [Build with x86emu as backend])
- AC_SUBST(X86EMU)
fi
-
+AM_CONDITIONAL(X86EMU, [test "x$X86EMU_OPT" = xx86emu])
AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [Build with debug message (default: disabled)]), [DEBUG=$enableval], [DEBUG=no])
diff --git a/include/libx86.h b/include/libx86.h
index 31fb3cf..df1871d 100644
--- a/include/libx86.h
+++ b/include/libx86.h
@@ -26,12 +26,6 @@ OTHER DEALINGS IN THE SOFTWARE.
#ifndef LRMI_H
#define LRMI_H
-
-#if defined(__i386__) && (defined(__linux__) || defined(__NetBSD__) \
- || defined(__FreeBSD__) || defined(__OpenBSD__))
-
-#include <stdlib.h>
-
#ifndef LRMI_PREFIX
#define LRMI_PREFIX LRMI_
#endif
@@ -105,8 +99,4 @@ LRMI_free_real(void *m);
size_t
LRMI_base_addr(void);
-#else /* (__linux__ || __NetBSD__ || __FreeBSD__) && __i386__ */
-#warning "LRMI is not supported on your system!"
-#endif
-
#endif
diff --git a/src/lrmi/backend-vm86.c b/src/lrmi/backend-vm86.c
index 29342b1..bac1414 100644
--- a/src/lrmi/backend-vm86.c
+++ b/src/lrmi/backend-vm86.c
@@ -38,8 +38,6 @@ OTHER DEALINGS IN THE SOFTWARE.
#endif
#define DEFAULT_STACK_SIZE 0x1000
-extern vm86context context;
-
static inline void
set_bit(unsigned int bit, void *array)
{
@@ -215,5 +213,5 @@ LRMI_base_addr(void)
}
#else /* (__linux__ || __NetBSD__ || __FreeBSD__ || __OpenBSD__) && __i386__ */
-#warning "LRMI is not supported on your system!"
+#error "VM86 is not supported on your system!"
#endif
diff --git a/src/vm86/vm86.c b/src/vm86/vm86.c
index 2d6f12c..ad421c3 100644
--- a/src/vm86/vm86.c
+++ b/src/vm86/vm86.c
@@ -46,13 +46,8 @@ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
-#if defined(__i386__) && (defined(__linux__) || defined(__NetBSD__) \
- || defined(__FreeBSD__) || defined(__OpenBSD__))
-
#include "vm86.h"
-vm86context context = { 0 };
-
unsigned int
get_int_seg(int i)
@@ -635,7 +630,3 @@ run_vm86(void)
return (0);
}
#endif /* __NetBSD__ || __FreeBSD__ || __OpenBSD__ */
-
-#else /* (__linux__ || __NetBSD__ || __FreeBSD__ || __OpenBSD__) && __i386__ */
-#warning "LRMI is not supported on your system!"
-#endif
diff --git a/src/vm86/vm86.h b/src/vm86/vm86.h
index 0652cff..031351c 100644
--- a/src/vm86/vm86.h
+++ b/src/vm86/vm86.h
@@ -24,7 +24,7 @@ OTHER DEALINGS IN THE SOFTWARE.
#include <stdio.h>
#include <string.h>
-#if defined(__linux__)
+#if defined(__linux__) && defined(__i386__)
#include <asm/vm86.h>
#include <signal.h>
@@ -79,7 +79,7 @@ OTHER DEALINGS IN THE SOFTWARE.
#endif
-typedef struct _vm86context {
+struct _vm86context {
int ready;
unsigned short ret_seg, ret_off;
unsigned short stack_seg, stack_off;
@@ -97,6 +97,6 @@ typedef struct _vm86context {
void *old_sighandler;
int vret;
#endif
-} vm86context;
+} context = { 0 };