aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2002-11-08 16:08:04 +0800
committeralfred <alfred@FreeBSD.org>2002-11-08 16:08:04 +0800
commit156b95e6418a8939ab3f749b6c1b17cf68484f34 (patch)
treea745e1a01f6803eec24dce33adb6ca347a77a8fd
parent2163e0df3354315a4d053a08480fcd04e1ac31c7 (diff)
downloadfreebsd-ports-gnome-156b95e6418a8939ab3f749b6c1b17cf68484f34.tar.gz
freebsd-ports-gnome-156b95e6418a8939ab3f749b6c1b17cf68484f34.tar.zst
freebsd-ports-gnome-156b95e6418a8939ab3f749b6c1b17cf68484f34.zip
Make context_i386.c work on 5.x as well as 4.x by using the DBREG_DRX
macro to access the fields of 'struct dbreg' instead of accessing them directly. Because the macro is buggy on older versions of FreeBSD as it lacks proper macro argument parens, use an extra pointer as a workaround so that we'll work on pre-patched versions of FreeBSD. Reviewed by: gerald (maintainer)
-rw-r--r--emulators/wine-devel/files/patch-context_i38651
-rw-r--r--emulators/wine/files/patch-context_i38651
2 files changed, 102 insertions, 0 deletions
diff --git a/emulators/wine-devel/files/patch-context_i386 b/emulators/wine-devel/files/patch-context_i386
new file mode 100644
index 000000000000..10b35c7c7f52
--- /dev/null
+++ b/emulators/wine-devel/files/patch-context_i386
@@ -0,0 +1,51 @@
+--- server/context_i386.c.orig Wed Aug 14 13:59:03 2002
++++ server/context_i386.c Thu Nov 7 14:54:01 2002
+@@ -371,14 +371,15 @@
+ {
+ #ifdef PTRACE_GETDBREGS
+ struct dbreg dbregs;
+- if (ptrace( PTRACE_GETDBREGS, pid, (caddr_t) &dbregs, 0 ) == -1)
++ struct dbreg *dbregs_ptr = &dbregs; /* ptr to workaround buggy macro */
++ if (ptrace( PTRACE_GETDBREGS, pid, (caddr_t) dbregs_ptr, 0 ) == -1)
+ goto error;
+- context->Dr0 = dbregs.dr0;
+- context->Dr1 = dbregs.dr1;
+- context->Dr2 = dbregs.dr2;
+- context->Dr3 = dbregs.dr3;
+- context->Dr6 = dbregs.dr6;
+- context->Dr7 = dbregs.dr7;
++ context->Dr0 = DBREG_DRX(dbregs_ptr, 0);
++ context->Dr1 = DBREG_DRX(dbregs_ptr, 1);
++ context->Dr2 = DBREG_DRX(dbregs_ptr, 2);
++ context->Dr3 = DBREG_DRX(dbregs_ptr, 3);
++ context->Dr6 = DBREG_DRX(dbregs_ptr, 6);
++ context->Dr7 = DBREG_DRX(dbregs_ptr, 7);
+ #endif
+ }
+ if (flags & CONTEXT_FLOATING_POINT)
+@@ -437,15 +438,16 @@
+ {
+ #ifdef PTRACE_SETDBREGS
+ struct dbreg dbregs;
+- dbregs.dr0 = context->Dr0;
+- dbregs.dr1 = context->Dr1;
+- dbregs.dr2 = context->Dr2;
+- dbregs.dr3 = context->Dr3;
+- dbregs.dr4 = 0;
+- dbregs.dr5 = 0;
+- dbregs.dr6 = context->Dr6;
+- dbregs.dr7 = context->Dr7;
+- if (ptrace( PTRACE_SETDBREGS, pid, (caddr_t) &dbregs, 0 ) == -1)
++ struct dbreg *dbregs_ptr = &dbregs; /* ptr to workaround buggy macro */
++ DBREG_DRX(dbregs_ptr, 0) = context->Dr0;
++ DBREG_DRX(dbregs_ptr, 1) = context->Dr1;
++ DBREG_DRX(dbregs_ptr, 2) = context->Dr2;
++ DBREG_DRX(dbregs_ptr, 3) = context->Dr3;
++ DBREG_DRX(dbregs_ptr, 4) = 0;
++ DBREG_DRX(dbregs_ptr, 5) = 0;
++ DBREG_DRX(dbregs_ptr, 6) = context->Dr6;
++ DBREG_DRX(dbregs_ptr, 7) = context->Dr7;
++ if (ptrace( PTRACE_SETDBREGS, pid, (caddr_t) dbregs_ptr, 0 ) == -1)
+ goto error;
+ #endif
+ }
diff --git a/emulators/wine/files/patch-context_i386 b/emulators/wine/files/patch-context_i386
new file mode 100644
index 000000000000..10b35c7c7f52
--- /dev/null
+++ b/emulators/wine/files/patch-context_i386
@@ -0,0 +1,51 @@
+--- server/context_i386.c.orig Wed Aug 14 13:59:03 2002
++++ server/context_i386.c Thu Nov 7 14:54:01 2002
+@@ -371,14 +371,15 @@
+ {
+ #ifdef PTRACE_GETDBREGS
+ struct dbreg dbregs;
+- if (ptrace( PTRACE_GETDBREGS, pid, (caddr_t) &dbregs, 0 ) == -1)
++ struct dbreg *dbregs_ptr = &dbregs; /* ptr to workaround buggy macro */
++ if (ptrace( PTRACE_GETDBREGS, pid, (caddr_t) dbregs_ptr, 0 ) == -1)
+ goto error;
+- context->Dr0 = dbregs.dr0;
+- context->Dr1 = dbregs.dr1;
+- context->Dr2 = dbregs.dr2;
+- context->Dr3 = dbregs.dr3;
+- context->Dr6 = dbregs.dr6;
+- context->Dr7 = dbregs.dr7;
++ context->Dr0 = DBREG_DRX(dbregs_ptr, 0);
++ context->Dr1 = DBREG_DRX(dbregs_ptr, 1);
++ context->Dr2 = DBREG_DRX(dbregs_ptr, 2);
++ context->Dr3 = DBREG_DRX(dbregs_ptr, 3);
++ context->Dr6 = DBREG_DRX(dbregs_ptr, 6);
++ context->Dr7 = DBREG_DRX(dbregs_ptr, 7);
+ #endif
+ }
+ if (flags & CONTEXT_FLOATING_POINT)
+@@ -437,15 +438,16 @@
+ {
+ #ifdef PTRACE_SETDBREGS
+ struct dbreg dbregs;
+- dbregs.dr0 = context->Dr0;
+- dbregs.dr1 = context->Dr1;
+- dbregs.dr2 = context->Dr2;
+- dbregs.dr3 = context->Dr3;
+- dbregs.dr4 = 0;
+- dbregs.dr5 = 0;
+- dbregs.dr6 = context->Dr6;
+- dbregs.dr7 = context->Dr7;
+- if (ptrace( PTRACE_SETDBREGS, pid, (caddr_t) &dbregs, 0 ) == -1)
++ struct dbreg *dbregs_ptr = &dbregs; /* ptr to workaround buggy macro */
++ DBREG_DRX(dbregs_ptr, 0) = context->Dr0;
++ DBREG_DRX(dbregs_ptr, 1) = context->Dr1;
++ DBREG_DRX(dbregs_ptr, 2) = context->Dr2;
++ DBREG_DRX(dbregs_ptr, 3) = context->Dr3;
++ DBREG_DRX(dbregs_ptr, 4) = 0;
++ DBREG_DRX(dbregs_ptr, 5) = 0;
++ DBREG_DRX(dbregs_ptr, 6) = context->Dr6;
++ DBREG_DRX(dbregs_ptr, 7) = context->Dr7;
++ if (ptrace( PTRACE_SETDBREGS, pid, (caddr_t) dbregs_ptr, 0 ) == -1)
+ goto error;
+ #endif
+ }