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