delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/03/22/12:00:56

Message-Id: <200003221407.JAA07314@delorie.com>
From: "Dieter Buerssner" <buers AT gmx DOT de>
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
Date: Wed, 22 Mar 2000 15:08:08 +0100
MIME-Version: 1.0
Subject: Re: NEED HELP WITH GRX
CC: djgpp AT delorie DOT com
References: <8b8iu3$4jkep$1 AT fu-berlin DOT de>
In-reply-to: <Pine.SUN.3.91.1000322112120.17945j@is>
X-mailer: Pegasus Mail for Win32 (v3.12b)
Reply-To: djgpp AT delorie DOT com

On 22 Mar 00, Eli Zaretskii wrote:

> To this day, I know of _no_ other patches which are self-contained and
> proven to be bug-free.  This thread is yet another evidence that
> there's still no consensus on this issue.

I did not look at Ian Miller's patches yet, but I can show, what 
seems to work for me.

I append the diffs of my source tree. I cannot prove them to
be bug-free, but I am  confident, that they fix the "spilled 
register" problem in a correct way. Anybody, who knows gcc inline 
assembly should be able to confirm this from the diffs only for two 
of the three patches, where all the context is there. Also, my 
programs seem to work with these patches in 16 color mode and in
16M color mode. (AFAIK the others mode are not affected by the 
patches)

The patches apply to the grx source tree, that was updated with
grx23up1.zip form the grx home page at
http://www.techfak.uni-kiel.de/~hsc/GRX/

Ian Miller may want to comment. 

Somebody should upload the grx23up1.zip to simtel, and also place a 
warning there, that grx23.zip and grx23up1.zip should be unpacked 
inside the contrib directory.

> And while at that, why not upload the fixed version of GRX to SimTel,
> so that the FAQ won't need to point people at patches?

I think, this should be done by the GRX programmer(s). Is GRX still
maintained?  

Regards,
Dieter

diff -u -r grx23org/src/include/gcc/memfill.h grx23/src/include/gcc/memfill.h
--- grx23org/src/include/gcc/memfill.h	Sat Jun  6 21:43:30 1998
+++ grx23/src/include/gcc/memfill.h	Wed Mar 22 12:56:02 2000
@@ -172,6 +172,7 @@
 /* ====================================================== 24bpp support */

 #define __INLINE_386_REPFILL24__(p,c,b,INS,SEG) do {               \
+  int dum;                                                         \
   __asm__ volatile (                "\n"                           \
     "      testl  $1,%0              \n"                           \
     "      je     1f                 \n"                           \
@@ -238,9 +239,9 @@
     "    "#INS"b  %%dl,"#SEG"(%0)    \n"                           \
     "      incl   %0                 \n"                           \
     "9:                              \n"                           \
-	  : "=r" ((void *)(p)), "=r" ((int)(b))                    \
-	  : "d"  ((int)(c)), "0"  ((void *)(p)), "1"  ((int)(b))   \
-	  : "ax", "cx", "dx"                                       \
+	  : "=r" ((void *)(p)), "=r" ((int)(b)), "=d" (dum)        \
+	  : "2"  ((int)(c)), "0"  ((void *)(p)), "1"  ((int)(b))   \
+	  : "ax", "cx"                                             \
   );                                                               \
 } while (0)

diff -u -r grx23org/src/include/gcc/mempeek.h grx23/src/include/gcc/mempeek.h
--- grx23org/src/include/gcc/mempeek.h	Mon May  4 20:23:36 1998
+++ grx23/src/include/gcc/mempeek.h	Fri Jan 21 12:38:26 2000
@@ -81,14 +81,13 @@
	  (GrColor)_pix_;                                               \
 })

-#define __INLINE_386_POKE24__(P,C,INS,SEL) do {                         \
+#define __INLINE_386_POKE24__(P,C,INS,SEL) do {   int dum;                      \
	  __asm__ volatile(                              "\n"           \
-		"    "#INS"w %%ax," SEL "(%1)             \n"           \
+		"    "#INS"w %%ax," SEL "(%2)             \n"           \
		"    shrl    $8,%%eax                     \n"           \
-		"    "#INS"b %%ah," SEL "2(%1)            \n"           \
-		: /* nothing */                                         \
-		: "a" ((unsigned)(C)), "r" ((void *)(P))                \
-		: "ax"                                                  \
+		"    "#INS"b %%ah," SEL "2(%2)            \n"           \
+		: "=a" (dum) : "0" (C), "r" ((void *)(P))                \
+								  \
	  );                                                            \
 } while (0)

diff -u -r grx23org/src/utils/shiftscl.c grx23/src/utils/shiftscl.c
--- grx23org/src/utils/shiftscl.c	Sun Apr  5 22:48:50 1998
+++ grx23/src/utils/shiftscl.c	Thu Mar 16 15:28:10 2000
@@ -25,26 +25,26 @@
       GR_int8u far *s = *(src++) + ws;
       GR_int8u far *d = *(dst++) + ws;
 #     if defined(__GNUC__) && defined(__i386__)
-	int w = ws;
+	int w = ws, dum;
	/* sad but true: the x86 bytesex forces this inefficient code :( */
	asm volatile ("\n"
-	  "   movb    (%3),%%ch    \n"
+	  "   movb    (%4),%%ch    \n"
	  "   jmp     1f           \n"
	  "   .align  4,0x90       \n"
-	  "1: decl    %3           \n"
+	  "1: decl    %4           \n"
	  "   movb    %%ch,%%al    \n"
-	  "   movb    (%3),%%ah    \n"
+	  "   movb    (%4),%%ah    \n"
	  "   movb    %%ah,%%ch    \n"
	  "   shrl    %%cl,%%eax   \n"
-	  "   movb    %%al,(%4)    \n"
-	  "   decl    %4           \n"
+	  "   movb    %%al,(%5)    \n"
	  "   decl    %5           \n"
+	  "   decl    %6           \n"
	  "   jne     1b           \n"
	  "   shrb    %%cl,%%ch    \n"
-	  "   movb    %%ch,(%4)      "
-	  : "=r" ((void *)s), "=r" ((void *)d), "=r" ((int)w)
-	  : "0" ((void *)s), "1" ((void *)d), "2" ((int)w), "c" ((int)shift)
-	  : "ax", "cx"
+	  "   movb    %%ch,(%5)      "
+	  : "=r" ((void *)s), "=r" ((void *)d), "=r" ((int)w), "=c" (dum)
+	  : "0" ((void *)s), "1" ((void *)d), "2" ((int)w), "3" ((int)shift)
+	  : "ax" /*, "cx" buers */
	);
 #     elif defined(__TURBOC__)
	asm     push  ds           ;
@@ -82,23 +82,23 @@
       GR_int8u far *s = *(src++);
       GR_int8u far *d = *(dst++);
 #     if defined(__GNUC__) && defined(__i386__)
-	int w = ws;
+	int w = ws, dum;
	asm volatile ("\n"
-	  "   movb    (%3),%%ch    \n"
+	  "   movb    (%4),%%ch    \n"
	  "   jmp     1f           \n"
	  "   .align  4,0x90       \n"
-	  "1: incl    %3           \n"
+	  "1: incl    %4           \n"
	  "   movb    %%ch,%%ah    \n"
-	  "   movb    (%3),%%al    \n"
+	  "   movb    (%4),%%al    \n"
	  "   movb    %%al,%%ch    \n"
	  "   shrl    %%cl,%%eax   \n"
-	  "   movb    %%al,(%4)    \n"
-	  "   incl    %4           \n"
-	  "   decl    %5           \n"
+	  "   movb    %%al,(%5)    \n"
+	  "   incl    %5           \n"
+	  "   decl    %6           \n"
	  "   jne     1b             "
-	  : "=r" ((void *)s), "=r" ((void *)d), "=r" ((int)w)
-	  : "0" ((void *)s), "1" ((void *)d), "2" ((int)w), "c" ((int)shift)
-	  : "ax", "cx"
+	  : "=r" ((void *)s), "=r" ((void *)d), "=r" ((int)w), "=c" (dum)
+	  : "0" ((void *)s), "1" ((void *)d), "2" ((int)w), "3" ((int)shift)
+	  : "ax"/* , "cx"  buers */
	);
 #     elif defined(__TURBOC__)
	asm     push  ds           ;


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019