On Mon, 17 Apr 2000, Klaus Friis Østergaard wrote:
it leaves with messages about not valid asm set 2 register CREG
in line 48 of shiftscl.c
can you help me?
Hi Klaus,
Andris Pavenis posted a patch last August:
RE: error in compiling utils/shiftscl.c Datum: Wed, 18 Aug 1999 14:58:49 +0300 Von:pavenis@lanet.lv
Hope it works
Hartmut
*** GRX23/src/include/gcc/memfill.h~4 Mon May 18 11:30:56 1998 --- GRX23/src/include/gcc/memfill.h Wed Aug 18 14:46:56 1999 *************** *** 182,188 **** "9: \n" \ : "=r" ((void *)(p)), "=r" ((int)(b)) \ : "d" ((int)(c)), "0" ((void *)(p)), "1" ((int)(b)) \ ! : "ax", "cx", "dx" \ ); \ } while (0)
--- 182,188 ---- "9: \n" \ : "=r" ((void *)(p)), "=r" ((int)(b)) \ : "d" ((int)(c)), "0" ((void *)(p)), "1" ((int)(b)) \ ! : "ax", "cx" \ ); \ } while (0)
*** GRX23/src/include/gcc/mempeek.h~4 Mon May 4 20:23:36 1998 --- GRX23/src/include/gcc/mempeek.h Wed Aug 18 14:47:28 1999 *************** *** 88,94 **** " "#INS"b %%ah," SEL "2(%1) \n" \ : /* nothing */ \ : "a" ((unsigned)(C)), "r" ((void *)(P)) \ - : "ax" \ ); \ } while (0)
--- 88,93 ---- *** GRX23/src/utils/shiftscl.c~4 Sun Apr 5 22:48:50 1998 --- GRX23/src/utils/shiftscl.c Wed Aug 18 14:40:24 1999 *************** *** 44,50 **** " 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" ); # elif defined(__TURBOC__) asm push ds ; --- 44,50 ---- " 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" ); # elif defined(__TURBOC__) asm push ds ; *************** *** 98,104 **** " 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" ); # elif defined(__TURBOC__) asm push ds ; --- 98,104 ---- " jne 1b " : "=r" ((void *)s), "=r" ((void *)d), "=r" ((int)w) : "0" ((void *)s), "1" ((void *)d), "2" ((int)w), "c" ((int)shift) ! : "ax" ); # elif defined(__TURBOC__) asm push ds ;
On 17 Apr 00, at 21:18, Hartmut Schirmer wrote:
On Mon, 17 Apr 2000, Klaus Friis Østergaard wrote:
it leaves with messages about not valid asm set 2 register CREG
in line 48 of shiftscl.c
can you help me?
Hi Klaus,
Andris Pavenis posted a patch last August:
IHMO, these patches are wrong. Please feel to correct me.
I try to elaborate one example in GRX23/src/include/gcc/mempeek.h
The original grx23 distribution here has:
#define __INLINE_386_POKE24__(P,C,INS,SEL) do { \ __asm__ volatile( "\n" \ " "#INS"w %%ax," SEL "(%1) \n" \ " shrl $8,%%eax \n" \ " "#INS"b %%ah," SEL "2(%1) \n" \ : /* nothing */ \ : "a" ((unsigned)(C)), "r" ((void *)(P)) \ : "ax" \ ); \ } while (0)
No, the problem with newer gcc is, that you are not allowed to put an input register into the clobber-list. The listed patch "solves" this problem by:
*** GRX23/src/include/gcc/mempeek.h~4 Mon May 4 20:23:36 1998 --- GRX23/src/include/gcc/mempeek.h Wed Aug 18 14:47:28 1999 *************** *** 88,94 **** " "#INS"b %%ah," SEL "2(%1) \n" \ : /* nothing */ \ : "a" ((unsigned)(C)), "r" ((void *)(P)) \ - : "ax" \ ); \ } while (0)
So, it just deletes the "ax" from the clobber-list. But "eax" will still be clobbered by the code. Gcc has no chance of knowing it. The correct solution is to use a temporary variable as output. Care must be taken then, to renumber the %1 to %2.
So I think the code should look like this:
#define __INLINE_386_POKE24__(P,C,INS,SEL) do { int dum; __asm__ volatile( "\n" \ " "#INS"w %%ax," SEL "(%2) \n" \ " shrl $8,%%eax \n" \ " "#INS"b %%ah," SEL "2(%2) \n" \ : "=a" (dum) : "0" (C), "r" ((void *)(P)) \ \ ); \ } while (0)
The other patches have similar problems. I have sent some patches to comp.os.msdos.djgpp. At least one person reported, that they work.
Ian Miller has put the patches together with some other patches to:
http://www.shelob.f9.co.uk/djgpp/patgrx23.dif http://www.shelob.f9.co.uk/djgpp/grxasm.dif
Regards, Dieter
On 18 Apr 2000, at 20:27, Dieter Buerssner wrote:
On 17 Apr 00, at 21:18, Hartmut Schirmer wrote:
On Mon, 17 Apr 2000, Klaus Friis Østergaard wrote:
it leaves with messages about not valid asm set 2 register CREG
in line 48 of shiftscl.c
can you help me?
Hi Klaus,
Andris Pavenis posted a patch last August:
IHMO, these patches are wrong. Please feel to correct me.
Yes. They were wrong. That time I didn't saw problems, but I also didn't use all stuff included in GRX.
Andris