From 69073a48e35d5f3cdd6a41d18d3b3cc94072b2c1 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Thu, 15 Feb 2007 19:09:00 +0200 Subject: [PATCH 1/7] os: fix client privates leak Minor leak here. Oops. (cherry picked from commit 811675733e97416c990e6dc9c19271b43d96248d) --- os/connection.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/os/connection.c b/os/connection.c index 96ad11921..98e83ae4c 100644 --- a/os/connection.c +++ b/os/connection.c @@ -1042,6 +1042,8 @@ CloseDownConnection(ClientPtr client) XdmcpCloseDisplay(oc->fd); #endif CloseDownFileDescriptor(oc); + FreeOsBuffers(oc); + xfree(client->osPrivate); client->osPrivate = (pointer)NULL; if (auditTrailLevel > 1) AuditF("client %d disconnected\n", client->index); From 33c2d2ce8ae00d89b91100cd5d7aba4b18b4117d Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Thu, 15 Feb 2007 16:14:57 +0200 Subject: [PATCH 2/7] kdrive/ephyr: free screen struct Free screen->driver on screenFini, instead of just leaking it. (cherry picked from commit 0f6dd4aea6176507dbe1c90c950d332fecbcaacb) --- hw/kdrive/ephyr/ephyr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c index fbb16a465..7c39af361 100644 --- a/hw/kdrive/ephyr/ephyr.c +++ b/hw/kdrive/ephyr/ephyr.c @@ -675,6 +675,8 @@ ephyrRestore (KdCardInfo *card) void ephyrScreenFini (KdScreenInfo *screen) { + xfree(screen->driver); + screen->driver = NULL; } /* From 8a16682892dd73e1b17955ded89a74c077d54f7f Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 2 Feb 2007 14:44:55 -0800 Subject: [PATCH 3/7] Fix bus error on startup in 64-bit Xephyr hostx_get_visual_masks takes unsigned long * arguments, but was being passed pointers to CARD32's. (cherry picked from commit 5dcad9e9d7d9993d65f989219bee94a060bbf476) --- hw/kdrive/ephyr/ephyr.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/hw/kdrive/ephyr/ephyr.c b/hw/kdrive/ephyr/ephyr.c index 7c39af361..6f2e3deb4 100644 --- a/hw/kdrive/ephyr/ephyr.c +++ b/hw/kdrive/ephyr/ephyr.c @@ -75,7 +75,8 @@ Bool ephyrScreenInitialize (KdScreenInfo *screen, EphyrScrPriv *scrpriv) { int width = 640, height = 480; - + unsigned long redMask, greenMask, blueMask; + if (hostx_want_screen_size(&width, &height) || !screen->width || !screen->height) { @@ -127,30 +128,24 @@ ephyrScreenInitialize (KdScreenInfo *screen, EphyrScrPriv *scrpriv) { screen->fb[0].depth = 15; screen->fb[0].bitsPerPixel = 16; - - hostx_get_visual_masks (&screen->fb[0].redMask, - &screen->fb[0].greenMask, - &screen->fb[0].blueMask); - } else if (screen->fb[0].depth <= 16) { screen->fb[0].depth = 16; screen->fb[0].bitsPerPixel = 16; - - hostx_get_visual_masks (&screen->fb[0].redMask, - &screen->fb[0].greenMask, - &screen->fb[0].blueMask); } else { screen->fb[0].depth = 24; screen->fb[0].bitsPerPixel = 32; - - hostx_get_visual_masks (&screen->fb[0].redMask, - &screen->fb[0].greenMask, - &screen->fb[0].blueMask); } + + hostx_get_visual_masks (&redMask, &greenMask, &blueMask); + + screen->fb[0].redMask = (Pixel) redMask; + screen->fb[0].greenMask = (Pixel) greenMask; + screen->fb[0].blueMask = (Pixel) blueMask; + } scrpriv->randr = screen->randr; From d3f507c2a2cc190d417a257b40a49a4a2926e3d3 Mon Sep 17 00:00:00 2001 From: Aaron Plattner Date: Tue, 6 Feb 2007 14:57:22 -0800 Subject: [PATCH 4/7] Add an RDTSC implementation to the x86 emulator. This instruction is being used in some debug VBIOSes. This implementation doesn't even try to be accurate. Instead, it just increments the counter by a fixed amount every time an rdtsc instruction in encountered, to avoid divides by zero. --- hw/xfree86/x86emu/ops2.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/hw/xfree86/x86emu/ops2.c b/hw/xfree86/x86emu/ops2.c index 7b0156aaa..8c6c53539 100644 --- a/hw/xfree86/x86emu/ops2.c +++ b/hw/xfree86/x86emu/ops2.c @@ -63,6 +63,40 @@ static void x86emuOp2_illegal_op( #define xorl(a,b) ((a) && !(b)) || (!(a) && (b)) +/**************************************************************************** +REMARKS: +Handles opcode 0x0f,0x31 +****************************************************************************/ +static void x86emuOp2_rdtsc(u8 X86EMU_UNUSED(op2)) +{ +#ifdef __HAS_LONG_LONG__ + static u64 counter = 0; +#else + static u32 counter = 0; +#endif + + counter += 0x10000; + + /* read timestamp counter */ + /* + * Note that instead of actually trying to accurately measure this, we just + * increase the counter by a fixed amount every time we hit one of these + * instructions. Feel free to come up with a better method. + */ + START_OF_INSTR(); + DECODE_PRINTF("RDTSC\n"); + TRACE_AND_STEP(); +#ifdef __HAS_LONG_LONG__ + M.x86.R_EAX = counter & 0xffffffff; + M.x86.R_EDX = counter >> 32; +#else + M.x86.R_EAX = counter; + M.x86.R_EDX = 0; +#endif + DECODE_CLEAR_SEGOVR(); + END_OF_INSTR(); +} + /**************************************************************************** REMARKS: Handles opcode 0x0f,0x80-0x8F @@ -2580,7 +2614,7 @@ void (*x86emu_optab2[256])(u8) = /* 0x2f */ x86emuOp2_illegal_op, /* 0x30 */ x86emuOp2_illegal_op, -/* 0x31 */ x86emuOp2_illegal_op, +/* 0x31 */ x86emuOp2_rdtsc, /* 0x32 */ x86emuOp2_illegal_op, /* 0x33 */ x86emuOp2_illegal_op, /* 0x34 */ x86emuOp2_illegal_op, From 6fd297e362af7e8d3770801f34cb84f757397898 Mon Sep 17 00:00:00 2001 From: Carl Switzky Date: Thu, 19 Oct 2006 17:30:54 -0700 Subject: [PATCH 5/7] Add ast driver/device info to Xorg server & config utilities (cherry picked from commit edd5f1745461f995670969cb736d1569ca94643f) --- hw/xfree86/common/xf86PciInfo.h | 4 ++++ hw/xfree86/utils/xorgcfg/text-mode.c | 1 + hw/xfree86/utils/xorgconfig/Cards | 5 +++++ 3 files changed, 10 insertions(+) diff --git a/hw/xfree86/common/xf86PciInfo.h b/hw/xfree86/common/xf86PciInfo.h index b8ba73f6a..0630cfa82 100644 --- a/hw/xfree86/common/xf86PciInfo.h +++ b/hw/xfree86/common/xf86PciInfo.h @@ -92,6 +92,7 @@ #define PCI_VENDOR_TRITECH 0x1292 #define PCI_VENDOR_NVIDIA_SGS 0x12D2 #define PCI_VENDOR_VMWARE 0x15AD +#define PCI_VENDOR_AST 0x1A03 #define PCI_VENDOR_3DLABS 0x3D3D #define PCI_VENDOR_AVANCE_2 0x4005 #define PCI_VENDOR_HERCULES 0x4843 @@ -358,6 +359,9 @@ #define PCI_CHIP_RS350_7834 0x7834 #define PCI_CHIP_RS350_7835 0x7835 +/* ASPEED Technology (AST) */ +#define PCI_CHIP_AST2000 0x2000 + /* Avance Logic */ #define PCI_CHIP_ALG2064 0x2064 #define PCI_CHIP_ALG2301 0x2301 diff --git a/hw/xfree86/utils/xorgcfg/text-mode.c b/hw/xfree86/utils/xorgcfg/text-mode.c index 0430a5463..91d9be262 100644 --- a/hw/xfree86/utils/xorgcfg/text-mode.c +++ b/hw/xfree86/utils/xorgcfg/text-mode.c @@ -1128,6 +1128,7 @@ CardConfig(void) static char *xdrivers[] = { "apm", "ark", + "ast", "ati", "r128", "radeon", diff --git a/hw/xfree86/utils/xorgconfig/Cards b/hw/xfree86/utils/xorgconfig/Cards index bf30eab1d..b95928c37 100644 --- a/hw/xfree86/utils/xorgconfig/Cards +++ b/hw/xfree86/utils/xorgconfig/Cards @@ -51,6 +51,11 @@ NAME ** Ark Logic (generic) [ark] SERVER SVGA DRIVER ark +NAME ** ASPEED Technology (generic) [ast] +#CHIPSET ast +SERVER SVGA +DRIVER ast + NAME ** ATI (generic) [ati] #CHIPSET ati SERVER SVGA From 68b79fb193b72bacbdd03ad214bf105e269f2ec1 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 1 Nov 2006 14:34:46 -0800 Subject: [PATCH 6/7] Propogate $LIBS for xtrans, clock_gettime, libm, etc. to libs used for each server (cherry picked from commit 40f84793bca40dcc6883d51aefa1bda44bd1ac61) --- configure.ac | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 073edf75b..a54e06d1d 100644 --- a/configure.ac +++ b/configure.ac @@ -872,7 +872,7 @@ PKG_CHECK_MODULES([XSERVERCFLAGS], [$REQUIRED_MODULES $REQUIRED_LIBS]) PKG_CHECK_MODULES([XSERVERLIBS], [$REQUIRED_LIBS]) XSERVER_CFLAGS="${XSERVERCFLAGS_CFLAGS}" -XSERVER_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} -lm" +XSERVER_LIBS="${XSERVERLIBS_LIBS} ${SYS_LIBS} ${LIBS}" AC_SUBST([SYS_LIBS]) AC_CHECK_FUNCS([clock_gettime], [have_clock_gettime=yes], @@ -883,9 +883,9 @@ AC_MSG_CHECKING([for a useful monotonic clock ...]) if ! test "x$have_clock_gettime" = xno; then if ! test "x$have_clock_gettime" = xyes; then - LIBS="$have_clock_gettime" + CLOCK_LIBS="$have_clock_gettime" else - LIBS="" + CLOCK_LIBS="" fi AC_RUN_IFELSE([ @@ -910,7 +910,8 @@ AC_MSG_RESULT([$MONOTONIC_CLOCK]) if test "x$MONOTONIC_CLOCK" = xyes; then AC_DEFINE(MONOTONIC_CLOCK, 1, [Have monotonic clock from clock_gettime()]) - XSERVER_LIBS="$XSERVER_LIBS $LIBS" + XSERVER_LIBS="$XSERVER_LIBS $CLOCK_LIBS" + LIBS="$LIBS $CLOCK_LIBS" fi dnl Imake defines SVR4 on SVR4 systems, and many files check for it, so @@ -988,7 +989,7 @@ AC_MSG_RESULT([$XVFB]) AM_CONDITIONAL(XVFB, [test "x$XVFB" = xyes]) if test "x$XVFB" = xyes; then - XVFB_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB" + XVFB_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB $LIBS" AC_SUBST([XVFB_LIBS]) fi @@ -1004,7 +1005,7 @@ AC_MSG_RESULT([$XNEST]) AM_CONDITIONAL(XNEST, [test "x$XNEST" = xyes]) if test "x$XNEST" = xyes; then - XNEST_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB" + XNEST_LIBS="$FB_LIB $MI_LIB $FIXES_LIB $XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $XPSTUBS_LIB $CWRAP_LIB $OS_LIB $LIBS" AC_SUBST([XNEST_LIBS]) fi @@ -1364,7 +1365,7 @@ AC_MSG_RESULT([$XPRINT]) if test "x$XPRINT" = xyes; then PKG_CHECK_MODULES([XPRINT], [printproto x11 xfont $XDMCP_MODULES xau]) XPRINT_EXTENSIONS="$XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS" - XPRINT_LIBS="$XPRINT_LIBS $DIX_LIB $XKB_LIB $XKB_STUB_LIB $XPRINT_EXTENSIONS $MI_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB $OS_LIB" + XPRINT_LIBS="$XPRINT_LIBS $DIX_LIB $XKB_LIB $XKB_STUB_LIB $XPRINT_EXTENSIONS $MI_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB $OS_LIB $LIBS" AC_SUBST([XPRINT_CFLAGS]) AC_SUBST([XPRINT_LIBS]) From 9ad0811a54cb041267554c3cda03fcb1602c9ddf Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 4 Dec 2006 13:36:30 -0800 Subject: [PATCH 7/7] Check for __sparc as well as __sparc__ for compatibility with Sun cc (gcc defines __sparc__, Sun cc defines __sparc) (cherry picked from commit f9f7d7f3be53c808abb5eaceb7a1abc55744a210) --- hw/xfree86/common/compiler.h | 4 ++-- hw/xfree86/common/xf86.h | 2 +- hw/xfree86/common/xf86Bus.c | 8 ++++---- hw/xfree86/common/xf86Bus.h | 2 +- hw/xfree86/common/xf86Configure.c | 8 ++++---- hw/xfree86/loader/xf86sym.c | 2 +- hw/xfree86/utils/xorgcfg/loadmod.c | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h index a330fadf4..ea995eda1 100644 --- a/hw/xfree86/common/compiler.h +++ b/hw/xfree86/common/compiler.h @@ -118,7 +118,7 @@ extern int ffs(unsigned long); # if defined(NO_INLINE) || defined(DO_PROTOTYPES) # if !defined(__arm__) -# if !defined(__sparc__) && !defined(__arm32__) \ +# if !defined(__sparc__) && !defined(__sparc) && !defined(__arm32__) \ && !(defined(__alpha__) && defined(linux)) \ && !(defined(__ia64__) && defined(linux)) \ @@ -1697,7 +1697,7 @@ static __inline__ void ppc_flush_icache(char *addr) : : "r"(addr) : "memory"); } -# elif defined(__sparc__) || defined(sparc) +# elif defined(__sparc__) || defined(sparc) || defined(__sparc) /* * Like powerpc, we provide byteswapping and no byteswapping functions * here with byteswapping as default, drivers that don't need byteswapping diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h index 51125304e..485a4b300 100644 --- a/hw/xfree86/common/xf86.h +++ b/hw/xfree86/common/xf86.h @@ -64,7 +64,7 @@ extern ScrnInfoPtr xf86CurrentScreen; extern Bool pciSlotClaimed; extern Bool isaSlotClaimed; extern Bool fbSlotClaimed; -#ifdef __sparc__ +#if defined(__sparc__) || defined(__sparc) extern Bool sbusSlotClaimed; #endif extern confDRIRec xf86ConfigDRI; diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c index e20837851..7617bf78a 100644 --- a/hw/xfree86/common/xf86Bus.c +++ b/hw/xfree86/common/xf86Bus.c @@ -113,7 +113,7 @@ void xf86BusProbe(void) { xf86PciProbe(); -#if defined(__sparc__) && !defined(__OpenBSD__) +#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) xf86SbusProbe(); #endif } @@ -2373,7 +2373,7 @@ xf86PostProbe(void) if (fbSlotClaimed) { if (pciSlotClaimed || isaSlotClaimed -#if defined(__sparc__) && !defined(__OpenBSD__) +#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) || sbusSlotClaimed #endif ) { @@ -3006,7 +3006,7 @@ xf86FindPrimaryDevice() } -#if !defined(__sparc__) && !defined(__powerpc__) && !defined(__mips__) +#if !defined(__sparc) && !defined(__sparc__) && !defined(__powerpc__) && !defined(__mips__) #include "vgaHW.h" #include "compiler.h" #endif @@ -3018,7 +3018,7 @@ static void CheckGenericGA() { /* This needs to be changed for multiple domains */ -#if !defined(__sparc__) && !defined(__powerpc__) && !defined(__mips__) && !defined(__ia64__) && !defined(__arm__) && !defined(__s390__) +#if !defined(__sparc__) && !defined(__sparc) && !defined(__powerpc__) && !defined(__mips__) && !defined(__ia64__) && !defined(__arm__) && !defined(__s390__) IOADDRESS GenericIOBase = VGAHW_GET_IOBASE(); CARD8 CurrentValue, TestValue; diff --git a/hw/xfree86/common/xf86Bus.h b/hw/xfree86/common/xf86Bus.h index b7d16089c..b638e9026 100644 --- a/hw/xfree86/common/xf86Bus.h +++ b/hw/xfree86/common/xf86Bus.h @@ -40,7 +40,7 @@ #define _XF86_BUS_H #include "xf86pciBus.h" -#ifdef __sparc__ +#if defined(__sparc__) || defined(__sparc) #include "xf86sbusBus.h" #endif diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c index cb091080c..3a6012123 100644 --- a/hw/xfree86/common/xf86Configure.c +++ b/hw/xfree86/common/xf86Configure.c @@ -48,7 +48,7 @@ #include "Configint.h" #include "vbe.h" #include "xf86DDC.h" -#if defined(__sparc__) && !defined(__OpenBSD__) +#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) #include "xf86Bus.h" #include "xf86Sbus.h" #endif @@ -57,7 +57,7 @@ typedef struct _DevToConfig { GDevRec GDev; pciVideoPtr pVideo; -#if defined(__sparc__) && !defined(__OpenBSD__) +#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) sbusDevicePtr sVideo; #endif int iDriver; @@ -134,7 +134,7 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int if (!DevToConfig[i].pVideo) return NULL; break; -#if defined(__sparc__) && !defined(__OpenBSD__) +#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) case BUS_SBUS: for (i = 0; i < nDevToConfig; i++) if (DevToConfig[i].sVideo && @@ -213,7 +213,7 @@ xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int NewDevice.GDev.identifier = "ISA Adapter"; NewDevice.GDev.busID = "ISA"; break; -#if defined(__sparc__) && !defined(__OpenBSD__) +#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) case BUS_SBUS: { char *promPath = NULL; NewDevice.sVideo = (sbusDevicePtr) busData; diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c index 2d1b88776..2f1f6af01 100644 --- a/hw/xfree86/loader/xf86sym.c +++ b/hw/xfree86/loader/xf86sym.c @@ -510,7 +510,7 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(xf86AddModuleInfo) SYMFUNC(xf86DeleteModuleInfo) -#if defined(__sparc__) && !defined(__OpenBSD__) +#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) /* xf86sbusBus.c */ SYMFUNC(xf86MatchSbusInstances) SYMFUNC(xf86GetSbusInfoForEntity) diff --git a/hw/xfree86/utils/xorgcfg/loadmod.c b/hw/xfree86/utils/xorgcfg/loadmod.c index 598d0c06a..6f83f3509 100644 --- a/hw/xfree86/utils/xorgcfg/loadmod.c +++ b/hw/xfree86/utils/xorgcfg/loadmod.c @@ -181,7 +181,7 @@ LOOKUP xfree86LookupTab[] = { SYMFUNC(xf86memchr) SYMFUNC(xf86memcmp) SYMFUNC(xf86memcpy) -#if (defined(__powerpc__) && (defined(Lynx) || defined(linux))) || defined(__sparc__) || defined(__ia64__) || defined (__amd64__) +#if (defined(__powerpc__) && (defined(Lynx) || defined(linux))) || defined(__sparc__) || defined(__sparc) || defined(__ia64__) || defined (__amd64__) /* * Some PPC, SPARC, and IA64 compilers generate calls to memcpy to handle * structure copies. This causes a problem both here and in shared