[PATCH] int10: Remove the vm86 and stub backends

Adam Jackson ajax at redhat.com
Tue Jul 13 14:32:54 PDT 2010


vm86 has been defaulted off since 1.6, and is still a terrible idea to
actually use.  Time to say goodbye.

The stub backend is only ever built by default on freebsd/ppc, and can't
be doing any good there.  The right fix is --disable-int10 if you want
to not ship int10 support.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 configure.ac                                       |   15 -
 hw/xfree86/int10/Makefile.am                       |   17 -
 hw/xfree86/int10/stub.c                            |   69 ---
 hw/xfree86/os-support/int10Defines.h               |   52 +--
 hw/xfree86/os-support/linux/int10/linux.c          |  544 --------------------
 .../os-support/linux/int10/vm86/linux_vm86.c       |  300 -----------
 hw/xfree86/x86emu/Makefile.am                      |    2 -
 include/dix-config.h.in                            |    3 -
 8 files changed, 1 insertions(+), 1001 deletions(-)
 delete mode 100644 hw/xfree86/int10/stub.c
 delete mode 100644 hw/xfree86/os-support/linux/int10/linux.c
 delete mode 100644 hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c

diff --git a/configure.ac b/configure.ac
index b3b752c..1a8221e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -332,7 +332,6 @@ dnl ---------------------------------------------------------------------------
 dnl Bus options and CPU capabilities.  Replaces logic in
 dnl hw/xfree86/os-support/bus/Makefile.am, among others.
 dnl ---------------------------------------------------------------------------
-DEFAULT_INT10="x86emu"
 
 dnl Override defaults as needed for specific platforms:
 
@@ -363,9 +362,6 @@ case $host_cpu in
         ;;
   powerpc*)
 	PPC_VIDEO=yes
-	case $host_os in
-		*freebsd*)	DEFAULT_INT10=stub ;;
-	esac
 	;;
   sparc*)
 	SPARC64_VIDEO=yes
@@ -476,9 +472,6 @@ AC_ARG_ENABLE(unit-tests,    AS_HELP_STRING([--enable-unit-tests],
 AC_ARG_ENABLE(use-sigio-by-default, AS_HELP_STRING([--enable-use-sigio-by-default]
   [Enable SIGIO input handlers by default (default: $USE_SIGIO_BY_DEFAULT)]),
                                 [USE_SIGIO_BY_DEFAULT=$enableval], [])
-AC_ARG_WITH(int10,           AS_HELP_STRING([--with-int10=BACKEND], [int10 backend: vm86, x86emu or stub]),
-				[INT10="$withval"],
-				[INT10="$DEFAULT_INT10"])
 AC_ARG_WITH(vendor-name,     AS_HELP_STRING([--with-vendor-name=VENDOR],
 				  [Vendor string reported by the server]),
 				[ VENDOR_NAME="$withval" ], [])
@@ -707,14 +700,6 @@ XTRANS_CONNECTION_FLAGS
 XTRANS_SECURE_RPC_FLAGS
 AM_CONDITIONAL(SECURE_RPC, [test "x$SECURE_RPC" = xyes])
 
-AM_CONDITIONAL(INT10_VM86, [test "x$INT10" = xvm86])
-AM_CONDITIONAL(INT10_X86EMU, [test "x$INT10" = xx86emu])
-AM_CONDITIONAL(INT10_STUB, [test "x$INT10" = xstub])
-if test "x$INT10" = xyes; then
-	dnl VM86 headers
-	AC_CHECK_HEADERS([sys/vm86.h sys/io.h])
-fi
-
 dnl Handle building documentation
 AM_CONDITIONAL(BUILDDOCS, test "x$BUILDDOCS" = xyes)
 XORG_ENABLE_DEVEL_DOCS
diff --git a/hw/xfree86/int10/Makefile.am b/hw/xfree86/int10/Makefile.am
index f5ece69..79eb25a 100644
--- a/hw/xfree86/int10/Makefile.am
+++ b/hw/xfree86/int10/Makefile.am
@@ -17,16 +17,6 @@ if I386_VIDEO
 I386_VIDEO_CFLAGS = -D_PC
 endif
 
-if INT10_VM86
-AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_VM86_LINUX $(DIX_CFLAGS) $(XORG_CFLAGS) $(EXTRA_CFLAGS)
-INCLUDES = $(XORG_INCS)
-libint10_la_SOURCES = \
-	$(COMMON_SOURCES) \
-	$(srcdir)/../os-support/linux/int10/vm86/linux_vm86.c \
-	$(srcdir)/../os-support/linux/int10/linux.c
-endif
-
-if INT10_X86EMU
 AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_X86EMU -DNO_SYS_HEADERS \
            $(XORG_CFLAGS) $(EXTRA_CFLAGS) $(DIX_CFLAGS)
 INCLUDES = $(XORG_INCS) -I$(srcdir)/../x86emu
@@ -35,12 +25,5 @@ libint10_la_SOURCES = \
 	xf86x86emu.c \
 	generic.c \
 	x86emu.c
-endif
-
-if INT10_STUB
-AM_CFLAGS = $(I386_VIDEO_CFLAGS) -D_VM86_LINUX $(DIX_CFLAGS) $(XORG_CFLAGS) $(EXTRA_CFLAGS)
-INCLUDES = $(XORG_INCS)
-libint10_la_SOURCES = stub.c xf86int10module.c
-endif
 
 EXTRA_DIST = xf86x86emu.h INT10.HOWTO
diff --git a/hw/xfree86/int10/stub.c b/hw/xfree86/int10/stub.c
deleted file mode 100644
index 58b6578..0000000
--- a/hw/xfree86/int10/stub.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- *                   XFree86 int10 module
- *   execute BIOS int 10h calls in x86 real mode environment
- *                 Copyright 1999 Egbert Eich
- */
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86.h"
-#include "xf86str.h"
-#include "xf86_OSproc.h"
-#define _INT10_PRIVATE
-#include "xf86int10.h"
-
-xf86Int10InfoPtr
-xf86InitInt10(int entityIndex)
-{
-    return xf86ExtendedInitInt10(entityIndex, 0);
-}
-
-xf86Int10InfoPtr
-xf86ExtendedInitInt10(int entityIndex, int Flags)
-{
-    return NULL;
-}
-
-Bool
-MapCurrentInt10(xf86Int10InfoPtr pInt)
-{
-    return FALSE;
-}
-
-void
-xf86FreeInt10(xf86Int10InfoPtr pInt)
-{
-    return;
-}
-
-void *
-xf86Int10AllocPages(xf86Int10InfoPtr pInt,int num, int *off)
-{
-    *off = 0;
-    return NULL;
-}
-
-void
-xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num)
-{
-    return;
-}
-
-Bool
-xf86Int10ExecSetup(xf86Int10InfoPtr pInt)
-{
-    return FALSE;
-}
-
-void
-xf86ExecX86int10(xf86Int10InfoPtr pInt)
-{
-    return;
-}
-
-pointer
-xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr)
-{
-    return 0;
-}
diff --git a/hw/xfree86/os-support/int10Defines.h b/hw/xfree86/os-support/int10Defines.h
index d942fbd..9240bed 100644
--- a/hw/xfree86/os-support/int10Defines.h
+++ b/hw/xfree86/os-support/int10Defines.h
@@ -32,58 +32,8 @@
 #ifndef _INT10DEFINES_H_
 #define _INT10DEFINES_H_ 1
 
-#ifdef _VM86_LINUX
-
-#include <asm/vm86.h>
-
-#define CPU_R(type,name,num) \
-	(((type *)&(((struct vm86_struct *)REG->cpuRegs)->regs.name))[num])
-#define CPU_RD(name,num) CPU_R(CARD32,name,num)
-#define CPU_RW(name,num) CPU_R(CARD16,name,num)
-#define CPU_RB(name,num) CPU_R(CARD8,name,num)
-
-#define X86_EAX CPU_RD(eax,0)
-#define X86_EBX CPU_RD(ebx,0)
-#define X86_ECX CPU_RD(ecx,0)
-#define X86_EDX CPU_RD(edx,0)
-#define X86_ESI CPU_RD(esi,0)
-#define X86_EDI CPU_RD(edi,0)
-#define X86_EBP CPU_RD(ebp,0)
-#define X86_EIP CPU_RD(eip,0)
-#define X86_ESP CPU_RD(esp,0)
-#define X86_EFLAGS CPU_RD(eflags,0)
-
-#define X86_FLAGS CPU_RW(eflags,0)
-#define X86_AX CPU_RW(eax,0)
-#define X86_BX CPU_RW(ebx,0)
-#define X86_CX CPU_RW(ecx,0)
-#define X86_DX CPU_RW(edx,0)
-#define X86_SI CPU_RW(esi,0)
-#define X86_DI CPU_RW(edi,0)
-#define X86_BP CPU_RW(ebp,0)
-#define X86_IP CPU_RW(eip,0)
-#define X86_SP CPU_RW(esp,0)
-#define X86_CS CPU_RW(cs,0)
-#define X86_DS CPU_RW(ds,0)
-#define X86_ES CPU_RW(es,0)
-#define X86_SS CPU_RW(ss,0)
-#define X86_FS CPU_RW(fs,0)
-#define X86_GS CPU_RW(gs,0)
-
-#define X86_AL CPU_RB(eax,0)
-#define X86_BL CPU_RB(ebx,0)
-#define X86_CL CPU_RB(ecx,0)
-#define X86_DL CPU_RB(edx,0)
-
-#define X86_AH CPU_RB(eax,1)
-#define X86_BH CPU_RB(ebx,1)
-#define X86_CH CPU_RB(ecx,1)
-#define X86_DH CPU_RB(edx,1)
-
-#elif defined(_X86EMU)
-
+#if defined(_X86EMU)
 #include "xf86x86emu.h"
-
 #endif
 
 #endif
diff --git a/hw/xfree86/os-support/linux/int10/linux.c b/hw/xfree86/os-support/linux/int10/linux.c
deleted file mode 100644
index 2965b37..0000000
--- a/hw/xfree86/os-support/linux/int10/linux.c
+++ /dev/null
@@ -1,544 +0,0 @@
-/*
- * linux specific part of the int10 module
- * Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2008 Egbert Eich
- */
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86.h"
-#include "xf86_OSproc.h"
-#include "xf86Pci.h"
-#include "compiler.h"
-#define _INT10_PRIVATE
-#include "xf86int10.h"
-#ifdef __sparc__
-#define DEV_MEM "/dev/fb"
-#else
-#define DEV_MEM "/dev/mem"
-#endif
-#define ALLOC_ENTRIES(x) ((V_RAM / x) - 1)
-#define SHMERRORPTR (pointer)(-1)
-
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/mman.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <unistd.h>
-#include <string.h>
-
-static int counter = 0;
-static unsigned long int10Generation = 0;
-
-static CARD8 read_b(xf86Int10InfoPtr pInt, int addr);
-static CARD16 read_w(xf86Int10InfoPtr pInt, int addr);
-static CARD32 read_l(xf86Int10InfoPtr pInt, int addr);
-static void write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val);
-static void write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val);
-static void write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val);
-
-int10MemRec linuxMem = {
-    read_b,
-    read_w,
-    read_l,
-    write_b,
-    write_w,
-    write_l
-};
-
-typedef struct {
-    int lowMem;
-    int highMem;
-    char* base;
-    char* base_high;
-    int screen;
-    char* alloc;
-} linuxInt10Priv;
-
-#if defined DoSubModules
-
-typedef enum {
-    INT10_NOT_LOADED,
-    INT10_LOADED_VM86,
-    INT10_LOADED_X86EMU,
-    INT10_LOAD_FAILED
-} Int10LinuxSubModuleState;
-
-static Int10LinuxSubModuleState loadedSubModule = INT10_NOT_LOADED;
-
-static Int10LinuxSubModuleState int10LinuxLoadSubModule(ScrnInfoPtr pScrn);
-
-#endif /* DoSubModules */
-
-xf86Int10InfoPtr
-xf86ExtendedInitInt10(int entityIndex, int Flags)
-{
-    xf86Int10InfoPtr pInt = NULL;
-    int screen;
-    int fd;
-    static void* vidMem = NULL;
-    static void* sysMem = NULL;
-    void* vMem = NULL;
-    void *options = NULL;
-    int low_mem;
-    int high_mem = -1;
-    char *base = SHMERRORPTR;
-    char *base_high = SHMERRORPTR;
-    int pagesize; 
-    memType cs;
-    legacyVGARec vga;
-    Bool videoBiosMapped = FALSE;
-    
-    if (int10Generation != serverGeneration) {
-	counter = 0;
-	int10Generation = serverGeneration;
-    }
-
-    screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex;
-
-    options = xf86HandleInt10Options(xf86Screens[screen],entityIndex);
-
-    if (int10skip(options)) {
-	free(options);
-	return NULL;
-    }
-
-#if defined DoSubModules
-    if (loadedSubModule == INT10_NOT_LOADED) 
-	loadedSubModule = int10LinuxLoadSubModule(xf86Screens[screen]);
-
-    if (loadedSubModule == INT10_LOAD_FAILED)
-	return NULL;
-#endif
-
-    if ((!vidMem) || (!sysMem)) {
-	if ((fd = open(DEV_MEM, O_RDWR, 0)) >= 0) {
-	    if (!sysMem) {
-		DebugF("Mapping sys bios area\n");
-		if ((sysMem = mmap((void *)(SYS_BIOS), BIOS_SIZE,
-				   PROT_READ | PROT_EXEC,
-				   MAP_SHARED | MAP_FIXED, fd, SYS_BIOS))
-		    == MAP_FAILED) {
-		    xf86DrvMsg(screen, X_ERROR, "Cannot map SYS BIOS\n");
-		    close(fd);
-		    goto error0;
-		}
-	    }
-	    if (!vidMem) {
-		DebugF("Mapping VRAM area\n");
-		if ((vidMem = mmap((void *)(V_RAM), VRAM_SIZE,
-				   PROT_READ | PROT_WRITE | PROT_EXEC,
-				   MAP_SHARED | MAP_FIXED, fd, V_RAM))
-		    == MAP_FAILED) {
-		    xf86DrvMsg(screen, X_ERROR, "Cannot map V_RAM\n");
-		    close(fd);
-		    goto error0;
-		}
-	    }
-	    close(fd);
-	} else {
-	    xf86DrvMsg(screen, X_ERROR, "Cannot open %s\n", DEV_MEM);
-	    goto error0;
-	}
-    }
-
-    pInt = (xf86Int10InfoPtr)xnfcalloc(1, sizeof(xf86Int10InfoRec));
-    pInt->scrnIndex = screen;
-    pInt->entityIndex = entityIndex;
-    pInt->dev = xf86GetPciInfoForEntity(entityIndex);
-
-    if (!xf86Int10ExecSetup(pInt))
-	goto error0;
-    pInt->mem = &linuxMem;
-    pagesize = getpagesize();
-    pInt->private = (pointer)xnfcalloc(1, sizeof(linuxInt10Priv));
-    ((linuxInt10Priv*)pInt->private)->screen = screen;
-    ((linuxInt10Priv*)pInt->private)->alloc =
-	(pointer)xnfcalloc(1, ALLOC_ENTRIES(pagesize));
-
-    if (!xf86IsEntityPrimary(entityIndex)) {
-	DebugF("Mapping high memory area\n");
-	if ((high_mem = shmget(counter++, HIGH_MEM_SIZE,
-			       IPC_CREAT | SHM_R | SHM_W)) == -1) {
-	    if (errno == ENOSYS)
-		xf86DrvMsg(screen, X_ERROR, "shmget error\n Please reconfigure"
-			   " your kernel to include System V IPC support\n");
-	    else
-		xf86DrvMsg(screen, X_ERROR,
-			   "shmget(highmem) error: %s\n",strerror(errno));
-	    goto error1;
-	}
-    } else {
-	DebugF("Mapping Video BIOS\n");
-	videoBiosMapped = TRUE;
-	if ((fd = open(DEV_MEM, O_RDWR, 0)) >= 0) {
-	    if ((vMem = mmap((void *)(V_BIOS), SYS_BIOS - V_BIOS,
-			     PROT_READ | PROT_WRITE | PROT_EXEC,
-			     MAP_SHARED | MAP_FIXED, fd, V_BIOS))
-		== MAP_FAILED) {
-		xf86DrvMsg(screen, X_ERROR, "Cannot map V_BIOS\n");
-		close(fd);
-		goto error1;
-	    }
-	    close (fd);
-	} else
-	    goto error1;
-    }
-    ((linuxInt10Priv*)pInt->private)->highMem = high_mem;
-    
-    DebugF("Mapping 640kB area\n");
-    if ((low_mem = shmget(counter++, V_RAM,
-			  IPC_CREAT | SHM_R | SHM_W)) == -1) {
-	xf86DrvMsg(screen, X_ERROR,
-		   "shmget(lowmem) error: %s\n",strerror(errno));
-	goto error2;
-    }
-
-    ((linuxInt10Priv*)pInt->private)->lowMem = low_mem;
-    base = shmat(low_mem, 0, 0);
-    if (base == SHMERRORPTR) {
-	xf86DrvMsg(screen, X_ERROR,
-		   "shmat(low_mem) error: %s\n",strerror(errno));
-	goto error3;
-    }
-    ((linuxInt10Priv *)pInt->private)->base = base;
-    if (high_mem > -1) {
-	base_high = shmat(high_mem, 0, 0);
-	if (base_high == SHMERRORPTR) {
-	    xf86DrvMsg(screen, X_ERROR,
-		       "shmat(high_mem) error: %s\n",strerror(errno));
-	    goto error3;
-	}
-	((linuxInt10Priv*)pInt->private)->base_high = base_high;
-    } else
-	((linuxInt10Priv*)pInt->private)->base_high = NULL;
-
-    if (!MapCurrentInt10(pInt))
-	goto error3;
-    
-    Int10Current = pInt;
-
-    DebugF("Mapping int area\n");
-    if (xf86ReadBIOS(0, 0, (unsigned char *)0, LOW_PAGE_SIZE) < 0) {
-	xf86DrvMsg(screen, X_ERROR, "Cannot read int vect\n");
-	goto error3;
-    }
-    DebugF("done\n");
-    /*
-     * Read in everything between V_BIOS and SYS_BIOS as some system BIOSes
-     * have executable code there.  Note that xf86ReadBIOS() can only bring in
-     * 64K bytes at a time.
-     */
-    if (!videoBiosMapped) {
-	memset((pointer)V_BIOS, 0, SYS_BIOS - V_BIOS);
-	DebugF("Reading BIOS\n");
-	for (cs = V_BIOS;  cs < SYS_BIOS;  cs += V_BIOS_SIZE)
-	    if (xf86ReadBIOS(cs, 0, (pointer)cs, V_BIOS_SIZE) < V_BIOS_SIZE)
-		xf86DrvMsg(screen, X_WARNING,
-			   "Unable to retrieve all of segment 0x%06lX.\n",
-			   (long)cs);
-	DebugF("done\n");
-    }
-
-    if (xf86IsEntityPrimary(entityIndex) && !(initPrimary(options))) {
-	if (!xf86int10GetBiosSegment(pInt, NULL))
-	    goto error3;
-
-	set_return_trap(pInt);
-#ifdef _PC	
-	pInt->Flags = Flags & (SET_BIOS_SCRATCH | RESTORE_BIOS_SCRATCH);
-	if (! (pInt->Flags & SET_BIOS_SCRATCH))
-	    pInt->Flags &= ~RESTORE_BIOS_SCRATCH;
-  	xf86Int10SaveRestoreBIOSVars(pInt, TRUE);
-#endif
-    } else {
-	const BusType location_type = xf86int10GetBiosLocationType(pInt);
-
-	switch (location_type) {
-	case BUS_PCI: {
-	    int err;
-	    struct pci_device *rom_device =
-		xf86GetPciInfoForEntity(pInt->entityIndex);
-
-#if HAVE_PCI_DEVICE_ENABLE
-	    pci_device_enable(rom_device);
-#endif
-
-	    err = pci_device_read_rom(rom_device, (unsigned char *)(V_BIOS));
-	    if (err) {
-		xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (%s)\n",
-			   strerror(err));
-		goto error3;
-	    }
-
-	    pInt->BIOSseg = V_BIOS >> 4;
-	    break;
-	}
-	default:
-	    goto error3;
-	}
-
-	pInt->num = 0xe6;
-	reset_int_vect(pInt);
-	set_return_trap(pInt);
-	LockLegacyVGA(pInt, &vga);
-	xf86ExecX86int10(pInt);
-	UnlockLegacyVGA(pInt, &vga);
-    }
-#ifdef DEBUG
-    dprint(0xc0000, 0x20);
-#endif
-
-    free(options);
-    return pInt;
-
-error3:
-    if (base_high)
-	shmdt(base_high);
-    shmdt(base);
-    shmdt(0);
-    if (base_high)
-	shmdt((char*)HIGH_MEM);
-    shmctl(low_mem, IPC_RMID, NULL);
-    Int10Current = NULL;
-error2:
-    if (high_mem > -1)
-	shmctl(high_mem, IPC_RMID,NULL);
-error1:
-    if (vMem)
-	munmap(vMem, SYS_BIOS - V_BIOS);
-    free(((linuxInt10Priv*)pInt->private)->alloc);
-    free(pInt->private);
-error0:
-    free(options);
-    free(pInt);
-    return NULL;
-}
-
-Bool
-MapCurrentInt10(xf86Int10InfoPtr pInt)
-{
-    pointer addr;
-    int fd = -1;
-    
-    if (Int10Current) {
-	shmdt(0);
-	if (((linuxInt10Priv*)Int10Current->private)->highMem >= 0)
-	    shmdt((char*)HIGH_MEM);
-	else
-	    munmap((pointer)V_BIOS, (SYS_BIOS - V_BIOS));
-    }
-    addr = shmat(((linuxInt10Priv*)pInt->private)->lowMem, (char*)1, SHM_RND);
-    if (addr == SHMERRORPTR) {
-	xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot shmat() low memory\n");
-	xf86DrvMsg(pInt->scrnIndex, X_ERROR,
-		   "shmat(low_mem) error: %s\n",strerror(errno));
-	return FALSE;
-    }
-    if (mprotect((void*)0, V_RAM, PROT_READ|PROT_WRITE|PROT_EXEC) != 0)
-        xf86DrvMsg(pInt->scrnIndex, X_ERROR,
-		   "Cannot set EXEC bit on low memory: %s\n", strerror(errno));
-
-    if (((linuxInt10Priv*)pInt->private)->highMem >= 0) {
-	addr = shmat(((linuxInt10Priv*)pInt->private)->highMem,
-		     (char*)HIGH_MEM, 0);
-	if (addr == SHMERRORPTR) {
-	    xf86DrvMsg(pInt->scrnIndex, X_ERROR,
-		       "Cannot shmat() high memory\n");
-	    xf86DrvMsg(pInt->scrnIndex, X_ERROR,
-		       "shmget error: %s\n",strerror(errno));
-	    return FALSE;
-	}
-	if (mprotect((void*)HIGH_MEM, HIGH_MEM_SIZE,
-		     PROT_READ|PROT_WRITE|PROT_EXEC) != 0)
-	    xf86DrvMsg(pInt->scrnIndex, X_ERROR,
-		       "Cannot set EXEC bit on high memory: %s\n",
-		       strerror(errno));
-    } else {
-	if ((fd = open(DEV_MEM, O_RDWR, 0)) >= 0) {
-	    if (mmap((void *)(V_BIOS), SYS_BIOS - V_BIOS,
-			     PROT_READ | PROT_WRITE | PROT_EXEC,
-			     MAP_SHARED | MAP_FIXED, fd, V_BIOS)
-		== MAP_FAILED) {
-		xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot map V_BIOS\n");
-		close (fd);
-		return FALSE;
-	    }
-	} else {
-	    xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot open %s\n",DEV_MEM);
-	    return FALSE;
-	}
-	close (fd);
-    }
-    
-    return TRUE;
-}
-
-void
-xf86FreeInt10(xf86Int10InfoPtr pInt)
-{
-    if (!pInt)
-	return;
-
-#ifdef _PC
-    xf86Int10SaveRestoreBIOSVars(pInt, FALSE); 
-#endif
-    if (Int10Current == pInt) {
-	shmdt(0);
-	if (((linuxInt10Priv*)pInt->private)->highMem >= 0)
-	    shmdt((char*)HIGH_MEM);
-	else
-	    munmap((pointer)V_BIOS, (SYS_BIOS - V_BIOS));
-	Int10Current = NULL;
-    }
-    
-    if (((linuxInt10Priv*)pInt->private)->base_high)
-	shmdt(((linuxInt10Priv*)pInt->private)->base_high);
-    shmdt(((linuxInt10Priv*)pInt->private)->base);
-    shmctl(((linuxInt10Priv*)pInt->private)->lowMem, IPC_RMID, NULL);
-    if (((linuxInt10Priv*)pInt->private)->highMem >= 0)
-	shmctl(((linuxInt10Priv*)pInt->private)->highMem, IPC_RMID, NULL);
-    free(((linuxInt10Priv*)pInt->private)->alloc);
-    free(pInt->private);
-    free(pInt);
-}
-
-void *
-xf86Int10AllocPages(xf86Int10InfoPtr pInt, int num, int *off)
-{
-    int pagesize = getpagesize();
-    int num_pages = ALLOC_ENTRIES(pagesize);
-    int i, j;
-
-    for (i = 0; i < (num_pages - num); i++) {
-	if (((linuxInt10Priv*)pInt->private)->alloc[i] == 0) {
-	    for (j = i; j < (num + i); j++)
-		if ((((linuxInt10Priv*)pInt->private)->alloc[j] != 0))
-		    break;
-	    if (j == (num + i))
-		break;
-	    else
-		i = i + num;
-	}
-    }
-    if (i == (num_pages - num))
-	return NULL;
-
-    for (j = i; j < (i + num); j++)
-	((linuxInt10Priv*)pInt->private)->alloc[j] = 1;
-
-    *off = (i + 1) * pagesize;
-
-    return ((linuxInt10Priv*)pInt->private)->base + ((i + 1) * pagesize);
-}
-
-void
-xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num)
-{
-    int pagesize = getpagesize();
-    int first = (((unsigned long)pbase
-		 - (unsigned long)((linuxInt10Priv*)pInt->private)->base)
-	/ pagesize) - 1;
-    int i;
-
-    for (i = first; i < (first + num); i++)
-	((linuxInt10Priv*)pInt->private)->alloc[i] = 0;
-}
-
-static CARD8
-read_b(xf86Int10InfoPtr pInt, int addr)
-{
-    return *((CARD8 *)(memType)addr);
-}
-
-static CARD16
-read_w(xf86Int10InfoPtr pInt, int addr)
-{
-    return *((CARD16 *)(memType)addr);
-}
-
-static CARD32
-read_l(xf86Int10InfoPtr pInt, int addr)
-{
-    return *((CARD32 *)(memType)addr);
-}
-
-static void
-write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val)
-{
-    *((CARD8 *)(memType)addr) = val;
-}
-
-static void
-write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val)
-{
-    *((CARD16 *)(memType)addr) = val;
-}
-
-static
-void write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val)
-{
-    *((CARD32 *)(memType) addr) = val;
-}
-
-pointer
-xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr)
-{
-    if (addr < V_RAM)
-	return ((linuxInt10Priv*)pInt->private)->base + addr;
-    else if (addr < V_BIOS)
-	return (pointer)(memType)addr;
-    else if (addr < SYS_BIOS) {
-	if (((linuxInt10Priv*)pInt->private)->base_high)
-	    return (pointer)(((linuxInt10Priv*)pInt->private)->base_high
-			     - V_BIOS + addr);
-	else
-	    return (pointer) (memType)addr;
-    } else
-	return (pointer) (memType)addr;
-}
-
-#if defined DoSubModules
-
-static Bool
-vm86_tst(void)
-{
-    int __res;
-
-#ifdef __PIC__
-    /* When compiling with -fPIC, we can't use asm constraint "b" because
-       %ebx is already taken by gcc. */
-    __asm__ __volatile__("pushl %%ebx\n\t"
-			 "movl %2,%%ebx\n\t"
-			 "movl %1,%%eax\n\t"
-			 "int $0x80\n\t"
-			 "popl %%ebx"
-			 :"=a" (__res)
-			 :"n" ((int)113), "r" (NULL));
-#else
-    __asm__ __volatile__("int $0x80\n\t"
-			 :"=a" (__res):"a" ((int)113),
-			 "b" ((struct vm86_struct *)NULL));
-#endif
-
-    if (__res < 0 && __res == -ENOSYS) 
-	return FALSE;
-
-    return TRUE;
-}
-
-static Int10LinuxSubModuleState
-int10LinuxLoadSubModule(ScrnInfoPtr pScrn)
-{
-    if (vm86_tst()) {
-	if (xf86LoadSubModule(pScrn,"vm86"))
-	    return INT10_LOADED_VM86;
-    } 
-    if (xf86LoadSubModule(pScrn,"x86emu"))
-	return INT10_LOADED_X86EMU;
-
-    return INT10_LOAD_FAILED;
-}
-
-#endif /* DoSubModules */
diff --git a/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c b/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c
deleted file mode 100644
index 34afd95..0000000
--- a/hw/xfree86/os-support/linux/int10/vm86/linux_vm86.c
+++ /dev/null
@@ -1,300 +0,0 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <errno.h>
-#include <string.h>
-
-#include "xf86.h"
-#include "xf86_OSproc.h"
-#include "xf86Pci.h"
-#include "compiler.h"
-#define _INT10_PRIVATE
-#include "xf86int10.h"
-
-#define REG pInt
-
-#ifdef _VM86_LINUX
-#include "int10Defines.h"
-
-static int vm86_rep(struct vm86_struct *ptr);
-static struct vm86_struct vm86_s;
-
-Bool
-xf86Int10ExecSetup(xf86Int10InfoPtr pInt)
-{
-#define VM86S ((struct vm86_struct *)pInt->cpuRegs)
-
-    pInt->cpuRegs =  &vm86_s;
-    VM86S->flags = 0;
-    VM86S->screen_bitmap = 0;
-    VM86S->cpu_type = CPU_586;
-    memset(&VM86S->int_revectored, 0xff, sizeof(VM86S->int_revectored));
-    memset(&VM86S->int21_revectored, 0xff, sizeof(VM86S->int21_revectored));
-    return TRUE;
-}
-
-/* get the linear address */
-#define LIN_PREF_SI ((pref_seg << 4) + X86_SI)
-#define LWECX       ((prefix66 ^ prefix67) ? X86_ECX : X86_CX)
-#define LWECX_ZERO  {if (prefix66 ^ prefix67) X86_ECX = 0; else X86_CX = 0;}
-#define DF (1 << 10)
-
-/* vm86 fault handling */
-static Bool
-vm86_GP_fault(xf86Int10InfoPtr pInt)
-{
-    unsigned char *csp, *lina;
-    CARD32 org_eip;
-    int pref_seg;
-    int done, is_rep, prefix66, prefix67;
-
-    csp = lina = SEG_ADR((unsigned char *), X86_CS, IP);
-
-    is_rep = 0;
-    prefix66 = prefix67 = 0;
-    pref_seg = -1;
-
-    /* eat up prefixes */
-    done = 0;
-    do {
-	switch (MEM_RB(pInt, (int)csp++)) {
-	case 0x66:      /* operand prefix */  prefix66=1; break;
-	case 0x67:      /* address prefix */  prefix67=1; break;
-	case 0x2e:      /* CS */              pref_seg=X86_CS; break;
-	case 0x3e:      /* DS */              pref_seg=X86_DS; break;
-	case 0x26:      /* ES */              pref_seg=X86_ES; break;
-	case 0x36:      /* SS */              pref_seg=X86_SS; break;
-	case 0x65:      /* GS */              pref_seg=X86_GS; break;
-	case 0x64:      /* FS */              pref_seg=X86_FS; break;
-	case 0xf0:      /* lock */            break;
-	case 0xf2:      /* repnz */
-	case 0xf3:      /* rep */             is_rep=1; break;
-	default: done=1;
-	}
-    } while (!done);
-    csp--;   /* oops one too many */
-    org_eip = X86_EIP;
-    X86_IP += (csp - lina);
-
-    switch (MEM_RB(pInt, (int)csp)) {
-    case 0x6c:                    /* insb */
-	/* NOTE: ES can't be overwritten; prefixes 66,67 should use esi,edi,ecx
-	 * but is anyone using extended regs in real mode? */
-	/* WARNING: no test for DI wrapping! */
-	X86_EDI += port_rep_inb(pInt, X86_DX, SEG_EADR((CARD32), X86_ES, DI),
-				X86_FLAGS & DF, is_rep ? LWECX : 1);
-	if (is_rep) LWECX_ZERO;
-	X86_IP++;
-	break;
-
-    case 0x6d:                  /* (rep) insw / insd */
-	/* NOTE: ES can't be overwritten */
-	/* WARNING: no test for _DI wrapping! */
-	if (prefix66) {
-	    X86_DI += port_rep_inl(pInt, X86_DX, SEG_ADR((CARD32), X86_ES, DI),
-				   X86_EFLAGS & DF, is_rep ? LWECX : 1);
-	}
-	else {
-	    X86_DI += port_rep_inw(pInt, X86_DX, SEG_ADR((CARD32), X86_ES, DI),
-				   X86_FLAGS & DF, is_rep ? LWECX : 1);
-	}
-	if (is_rep) LWECX_ZERO;
-	X86_IP++;
-	break;
-
-    case 0x6e:                  /* (rep) outsb */
-	if (pref_seg < 0) pref_seg = X86_DS;
-	/* WARNING: no test for _SI wrapping! */
-	X86_SI += port_rep_outb(pInt, X86_DX, (CARD32)LIN_PREF_SI,
-			        X86_FLAGS & DF, is_rep ? LWECX : 1);
-	if (is_rep) LWECX_ZERO;
-	X86_IP++;
-	break;
-
-    case 0x6f:                  /* (rep) outsw / outsd */
-	if (pref_seg < 0) pref_seg = X86_DS;
-	/* WARNING: no test for _SI wrapping! */
-	if (prefix66) {
-	    X86_SI += port_rep_outl(pInt, X86_DX, (CARD32)LIN_PREF_SI,
-				    X86_EFLAGS & DF, is_rep ? LWECX : 1);
-	}
-	else {
-	    X86_SI += port_rep_outw(pInt, X86_DX, (CARD32)LIN_PREF_SI,
-				    X86_FLAGS & DF, is_rep ? LWECX : 1);
-	}
-	if (is_rep) LWECX_ZERO;
-	X86_IP++;
-	break;
-
-    case 0xe5:                  /* inw xx, inl xx */
-	if (prefix66) X86_EAX = x_inl(csp[1]);
-	else X86_AX = x_inw(csp[1]);
-	X86_IP += 2;
-	break;
-
-    case 0xe4:                  /* inb xx */
-	X86_AL = x_inb(csp[1]);
-	X86_IP += 2;
-	break;
-
-    case 0xed:                  /* inw dx, inl dx */
-	if (prefix66) X86_EAX = x_inl(X86_DX);
-	else X86_AX = x_inw(X86_DX);
-	X86_IP += 1;
-	break;
-
-    case 0xec:                  /* inb dx */
-	X86_AL = x_inb(X86_DX);
-	X86_IP += 1;
-	break;
-
-    case 0xe7:                  /* outw xx */
-	if (prefix66) x_outl(csp[1], X86_EAX);
-	else x_outw(csp[1], X86_AX);
-	X86_IP += 2;
-	break;
-
-    case 0xe6:                  /* outb xx */
-	x_outb(csp[1], X86_AL);
-	X86_IP += 2;
-	break;
-
-    case 0xef:                  /* outw dx */
-	if (prefix66) x_outl(X86_DX, X86_EAX);
-	else x_outw(X86_DX, X86_AX);
-	X86_IP += 1;
-	break;
-
-    case 0xee:                  /* outb dx */
-	x_outb(X86_DX, X86_AL);
-	X86_IP += 1;
-	break;
-
-    case 0xf4:
-	DebugF("hlt at %p\n", lina);
-	return FALSE;
-
-    case 0x0f:
-	xf86DrvMsg(pInt->scrnIndex, X_ERROR,
-	    "CPU 0x0f Trap at CS:EIP=0x%4.4x:0x%8.8lx\n", X86_CS, X86_EIP);
-	goto op0ferr;
-
-    default:
-	xf86DrvMsg(pInt->scrnIndex, X_ERROR, "unknown reason for exception\n");
-
-    op0ferr:
-	dump_registers(pInt);
-	stack_trace(pInt);
-	dump_code(pInt);
-	xf86DrvMsg(pInt->scrnIndex, X_ERROR, "cannot continue\n");
-	return FALSE;
-    }                           /* end of switch() */
-    return TRUE;
-}
-
-static int
-do_vm86(xf86Int10InfoPtr pInt)
-{
-    int retval, signo;
-
-    xf86InterceptSignals(&signo);
-    retval = vm86_rep(VM86S);
-    xf86InterceptSignals(NULL);
-
-    if (signo >= 0) {
-	xf86DrvMsg(pInt->scrnIndex, X_ERROR,
-	    "vm86() syscall generated signal %d.\n", signo);
-	dump_registers(pInt);
-	dump_code(pInt);
-	stack_trace(pInt);
-	return 0;
-    }
-
-    switch (VM86_TYPE(retval)) {
-    case VM86_UNKNOWN:
-	if (!vm86_GP_fault(pInt)) return 0;
-	break;
-    case VM86_STI:
-	xf86DrvMsg(pInt->scrnIndex, X_ERROR, "vm86_sti :-((\n");
-	dump_registers(pInt);
-	dump_code(pInt);
-	stack_trace(pInt);
-	return 0;
-    case VM86_INTx:
-	pInt->num = VM86_ARG(retval);
-	if (!int_handler(pInt)) {
-	    xf86DrvMsg(pInt->scrnIndex, X_ERROR,
-		"Unknown vm86_int: 0x%X\n\n", VM86_ARG(retval));
-	    dump_registers(pInt);
-	    dump_code(pInt);
-	    stack_trace(pInt);
-	    return 0;
-	}
-	/* I'm not sure yet what to do if we can handle ints */
-	break;
-    case VM86_SIGNAL:
-	return 1;
-	/*
-	 * we used to warn here and bail out - but now the sigio stuff
-	 * always fires signals at us. So we just ignore them for now.
-	 */
-	xf86DrvMsg(pInt->scrnIndex, X_WARNING, "received signal\n");
-	return 0;
-    default:
-	xf86DrvMsg(pInt->scrnIndex, X_ERROR, "unknown type(0x%x)=0x%x\n",
-		VM86_ARG(retval), VM86_TYPE(retval));
-	dump_registers(pInt);
-	dump_code(pInt);
-	stack_trace(pInt);
-	return 0;
-    }
-
-    return 1;
-}
-
-void
-xf86ExecX86int10(xf86Int10InfoPtr pInt)
-{
-    int sig = setup_int(pInt);
-
-    if (int_handler(pInt))
-	while(do_vm86(pInt)) {};
-
-    finish_int(pInt, sig);
-}
-
-static int
-vm86_rep(struct vm86_struct *ptr)
-{
-    int __res;
-
-#ifdef __PIC__
-    /* When compiling with -fPIC, we can't use asm constraint "b" because
-       %ebx is already taken by gcc. */
-    __asm__ __volatile__("pushl %%ebx\n\t"
-			 "push %%gs\n\t"
-			 "movl %2,%%ebx\n\t"
-			 "movl %1,%%eax\n\t"
-			 "int $0x80\n\t"
-			 "pop %%gs\n\t"
-			 "popl %%ebx"
-			 :"=a" (__res)
-			 :"n" ((int)113), "r" ((struct vm86_struct *)ptr));
-#else
-    __asm__ __volatile__("push %%gs\n\t"
-			 "int $0x80\n\t"
-			 "pop %%gs"
-			 :"=a" (__res):"a" ((int)113),
-			 "b" ((struct vm86_struct *)ptr));
-#endif
-
-	    if (__res < 0) {
-		errno = -__res;
-		__res = -1;
-	    }
-	    else errno = 0;
-	    return __res;
-}
-
-#endif
diff --git a/hw/xfree86/x86emu/Makefile.am b/hw/xfree86/x86emu/Makefile.am
index df96977..987ea8b 100644
--- a/hw/xfree86/x86emu/Makefile.am
+++ b/hw/xfree86/x86emu/Makefile.am
@@ -1,6 +1,4 @@
-if INT10_X86EMU
 noinst_LTLIBRARIES = libx86emu.la
-endif
 
 libx86emu_la_SOURCES = debug.c \
                       decode.c \
diff --git a/include/dix-config.h.in b/include/dix-config.h.in
index 6a33264..bfd659e 100644
--- a/include/dix-config.h.in
+++ b/include/dix-config.h.in
@@ -225,9 +225,6 @@
 /* Define to 1 if you have the <sys/utsname.h> header file. */
 #undef HAVE_SYS_UTSNAME_H
 
-/* Define to 1 if you have the <sys/vm86.h> header file. */
-#undef HAVE_SYS_VM86_H
-
 /* Define to 1 if you have the <tslib.h> header file. */
 #undef HAVE_TSLIB_H
 
-- 
1.7.1.1



More information about the xorg-devel mailing list