Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Nov 2002 11:36:44 +0100
From:      Pierre Beyssac <pb@fasterix.frmug.org>
To:        Dag-Erling Smorgrav <des@ofug.org>
Cc:        Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at>, Krzysztof J?druczyk <beaker@hot.pl>, freebsd-current@freebsd.org, Poul-Henning Kamp <phk@freebsd.org>, Pierre Beyssac <pb-wine@fasterix.frmug.org>
Subject:   Re: Wine-2002.10.07 port on FreeBSD 5.0-current
Message-ID:  <20021108103644.GA60686@fasterix.frmug.org>
In-Reply-To: <xzpiszj28lo.fsf@flood.ping.uio.no>
References:  <Pine.BSF.4.44.0210301713470.8111-100000@naos.dbai.tuwien.ac.at> <xzpiszj28lo.fsf@flood.ping.uio.no>

next in thread | previous in thread | raw e-mail | index | archive | help

--vkogqOf2sHV7VnPd
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Wed, Oct 30, 2002 at 05:29:39PM +0100, Dag-Erling Smorgrav wrote:
> That revision doesn't change the structure, just how it is defined, so
> binary compatibility is not an issue.  As for source compatibility,
> just use the DBREG_DRX macro, which exists in both -STABLE and
> -CURRENT (it was merged into -STABLE two years ago).

It's too bad source compatibility hasn't been preserved. This macro
is a real PITA to use with a static structure (see my Wine patch
below).

Argument d is not properly parenthesized, I'll commit the following
patch if nobody objects:

- #define DBREG_DRX(d,x) (d->dr[(x)]) /* reference dr0 - dr7 by
-                                          register number */
+ #define DBREG_DRX(d,x) ((d)->dr[(x)]) /* reference dr0 - dr7 by
+                                          register number */

Now for Gerald and Krzysztof, could you try the attached patch?
Works for me under current at least. I'll test it under stable then
I'll send it to Wine.
-- 
Pierre Beyssac	      	    pb@fasterix.frmug.org pb@fasterix.freenix.org
    Free domains: http://www.eu.org/ or mail dns-manager@EU.org

--vkogqOf2sHV7VnPd
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="context_i386.c.patch"

--- context_i386.c.orig	Wed Aug 14 22:59:03 2002
+++ context_i386.c	Fri Nov  8 11:29:34 2002
@@ -373,6 +373,15 @@
 	struct dbreg dbregs;
         if (ptrace( PTRACE_GETDBREGS, pid, (caddr_t) &dbregs, 0 ) == -1)
 		goto error;
+#ifdef DBREG_DRX
+	/* needed for FreeBSD, the structure fields have changed under 5.x */
+	context->Dr0 = DBREG_DRX((&dbregs), 0);
+	context->Dr1 = DBREG_DRX((&dbregs), 1);
+	context->Dr2 = DBREG_DRX((&dbregs), 2);
+	context->Dr3 = DBREG_DRX((&dbregs), 3);
+	context->Dr6 = DBREG_DRX((&dbregs), 6);
+	context->Dr7 = DBREG_DRX((&dbregs), 7);
+#else
 	context->Dr0 = dbregs.dr0;
 	context->Dr1 = dbregs.dr1;
 	context->Dr2 = dbregs.dr2;
@@ -380,6 +389,8 @@
 	context->Dr6 = dbregs.dr6;
 	context->Dr7 = dbregs.dr7;
 #endif
+
+#endif
     }
     if (flags & CONTEXT_FLOATING_POINT)
     {
@@ -437,6 +448,17 @@
     {
 #ifdef PTRACE_SETDBREGS
 	struct dbreg dbregs;
+#ifdef DBREG_DRX
+	/* needed for FreeBSD, the structure fields have changed under 5.x */
+	DBREG_DRX((&dbregs), 0) = context->Dr0;
+	DBREG_DRX((&dbregs), 1) = context->Dr1;
+	DBREG_DRX((&dbregs), 2) = context->Dr2;
+	DBREG_DRX((&dbregs), 3) = context->Dr3;
+	DBREG_DRX((&dbregs), 4) = 0;
+	DBREG_DRX((&dbregs), 5) = 0;
+	DBREG_DRX((&dbregs), 6) = context->Dr6;
+	DBREG_DRX((&dbregs), 7) = context->Dr7;
+#else
 	dbregs.dr0 = context->Dr0;
 	dbregs.dr1 = context->Dr1;
 	dbregs.dr2 = context->Dr2;
@@ -445,6 +467,7 @@
 	dbregs.dr5 = 0;
 	dbregs.dr6 = context->Dr6;
 	dbregs.dr7 = context->Dr7;
+#endif
         if (ptrace( PTRACE_SETDBREGS, pid, (caddr_t) &dbregs, 0 ) == -1)
 		goto error;
 #endif

--vkogqOf2sHV7VnPd--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021108103644.GA60686>