linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 5/8] ppc: use correct asm ops
@ 2005-09-24 22:43 Roman Zippel
  2005-09-27  0:00 ` Hollis Blanchard
  0 siblings, 1 reply; 4+ messages in thread
From: Roman Zippel @ 2005-09-24 22:43 UTC (permalink / raw)
  To: linuxppc-dev


Use the correct assembler instructions, which match
__do_in_asm/__do_out_asm.

---

 include/asm-ppc/io.h |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Index: linux/include/asm-ppc/io.h
===================================================================
--- linux.orig/include/asm-ppc/io.h	2005-09-23 16:20:24.000000000 +0200
+++ linux/include/asm-ppc/io.h	2005-09-23 16:20:26.000000000 +0200
@@ -294,10 +294,10 @@ extern __inline__ void name(unsigned int
 __do_out_asm(outb, "stbx")
 #ifdef CONFIG_APUS
 __do_in_asm(inb, "lbzx")
-__do_in_asm(inw, "lhz%U1%X1")
-__do_in_asm(inl, "lwz%U1%X1")
-__do_out_asm(outl,"stw%U0%X0")
-__do_out_asm(outw, "sth%U0%X0")
+__do_in_asm(inw, "lhzx")
+__do_in_asm(inl, "lwzx")
+__do_out_asm(outl,"stwx")
+__do_out_asm(outw, "sthx")
 #elif defined (CONFIG_8260_PCI9)
 /* in asm cannot be defined if PCI9 workaround is used */
 #define inb(port)		in_8((port)+___IO_BASE)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 5/8] ppc: use correct asm ops
  2005-09-24 22:43 [PATCH 5/8] ppc: use correct asm ops Roman Zippel
@ 2005-09-27  0:00 ` Hollis Blanchard
  2005-09-27  0:36   ` Roman Zippel
  2005-09-27 18:22   ` Segher Boessenkool
  0 siblings, 2 replies; 4+ messages in thread
From: Hollis Blanchard @ 2005-09-27  0:00 UTC (permalink / raw)
  To: Roman Zippel; +Cc: linuxppc-dev

On Sep 24, 2005, at 5:43 PM, Roman Zippel wrote:
>
> Use the correct assembler instructions, which match
> __do_in_asm/__do_out_asm.

Could you define "correct" here?

> --- linux.orig/include/asm-ppc/io.h	2005-09-23 16:20:24.000000000 +0200
> +++ linux/include/asm-ppc/io.h	2005-09-23 16:20:26.000000000 +0200
> @@ -294,10 +294,10 @@ extern __inline__ void name(unsigned int
>  __do_out_asm(outb, "stbx")
>  #ifdef CONFIG_APUS
>  __do_in_asm(inb, "lbzx")
> -__do_in_asm(inw, "lhz%U1%X1")
> -__do_in_asm(inl, "lwz%U1%X1")
> -__do_out_asm(outl,"stw%U0%X0")
> -__do_out_asm(outw, "sth%U0%X0")
> +__do_in_asm(inw, "lhzx")
> +__do_in_asm(inl, "lwzx")
> +__do_out_asm(outl,"stwx")
> +__do_out_asm(outw, "sthx")
>  #elif defined (CONFIG_8260_PCI9)
>  /* in asm cannot be defined if PCI9 workaround is used */
>  #define inb(port)		in_8((port)+___IO_BASE)

I don't see where this is explained in the GCC docs, but as I 
understand it those %U %X things are allowing somebody to use the 
"update" and "index" variants of the instruction. Why doesn't this work 
for you?

-Hollis

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 5/8] ppc: use correct asm ops
  2005-09-27  0:00 ` Hollis Blanchard
@ 2005-09-27  0:36   ` Roman Zippel
  2005-09-27 18:22   ` Segher Boessenkool
  1 sibling, 0 replies; 4+ messages in thread
From: Roman Zippel @ 2005-09-27  0:36 UTC (permalink / raw)
  To: Hollis Blanchard; +Cc: linuxppc-dev

Hi,

On Mon, 26 Sep 2005, Hollis Blanchard wrote:

> > --- linux.orig/include/asm-ppc/io.h	2005-09-23 16:20:24.000000000 +0200
> > +++ linux/include/asm-ppc/io.h	2005-09-23 16:20:26.000000000 +0200
> > @@ -294,10 +294,10 @@ extern __inline__ void name(unsigned int
> >  __do_out_asm(outb, "stbx")
> >  #ifdef CONFIG_APUS
> >  __do_in_asm(inb, "lbzx")
> > -__do_in_asm(inw, "lhz%U1%X1")
> > -__do_in_asm(inl, "lwz%U1%X1")
> > -__do_out_asm(outl,"stw%U0%X0")
> > -__do_out_asm(outw, "sth%U0%X0")
> > +__do_in_asm(inw, "lhzx")
> > +__do_in_asm(inl, "lwzx")
> > +__do_out_asm(outl,"stwx")
> > +__do_out_asm(outw, "sthx")
> >  #elif defined (CONFIG_8260_PCI9)
> >  /* in asm cannot be defined if PCI9 workaround is used */
> >  #define inb(port)		in_8((port)+___IO_BASE)
> 
> I don't see where this is explained in the GCC docs, but as I understand it
> those %U %X things are allowing somebody to use the "update" and "index"
> variants of the instruction. Why doesn't this work for you?

Because it requires the matching arguments, which are defined by 
__do_{in,out}_asm, otherwise an invalid instruction is generated.

bye, Roman

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 5/8] ppc: use correct asm ops
  2005-09-27  0:00 ` Hollis Blanchard
  2005-09-27  0:36   ` Roman Zippel
@ 2005-09-27 18:22   ` Segher Boessenkool
  1 sibling, 0 replies; 4+ messages in thread
From: Segher Boessenkool @ 2005-09-27 18:22 UTC (permalink / raw)
  To: Hollis Blanchard; +Cc: linuxppc-dev

> I don't see where this is explained in the GCC docs,

It is documented in gcc/gcc/config/rs6000/rs6000.c,
function print_operand() ;-)

> but as I understand it those %U %X things are allowing somebody to use 
> the "update" and "index" variants of the instruction.

Indeed.

> Why doesn't this work for you?

The code works fine.  The U and X have no effect at all,
though; they require a memory operand to do anything,
and __do_in_asm() c.q. __do_out_asm() take a register
input.  It would be better if __do_in_asm() would say

	"m" (*(port + ___IO_BASE))

where it now says

	"r" (port + ___IO_BASE)

and keep the %U %X stuff (and similarly for __do_out_asm()
of course).


Segher

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-10-01 18:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-24 22:43 [PATCH 5/8] ppc: use correct asm ops Roman Zippel
2005-09-27  0:00 ` Hollis Blanchard
2005-09-27  0:36   ` Roman Zippel
2005-09-27 18:22   ` Segher Boessenkool

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).