[U-Boot-Users] v2p4 porting troubles
Wolfgang Denk
wd at denx.de
Wed Mar 17 00:40:22 CET 2004
In message <009b01c40baa$a324f2b0$cb01a8c0 at xiphos.ca> you wrote:
> We're doing quite the tag team here.
;-)
> The code from Xilinx is as follows...
>
> void XIo_Out32(XIo_Address OutAddress, Xuint32 Value)
> {
> __asm__ volatile ("stw %0,0(%1); eieio" : : "r" (Value), "r"
> (OutAddress));
> }
This code is broken. The "r" operand specification sais "a register
operand is allowed provided that it is in a general register." Of
course R0 is a GPR as well. I think you need to use "m" (any kind of
address that the machine supports in general) here:
__asm__ volatile ("stw %0,0(%1); eieio" : : "r" (Value), "m" (OutAddress));
> But why? What is it about this C code which causes this sort of thing?
Actually this is no C code, but inline assembler. And yes, it is the
code, which uses an inappropriate operand specification.
> What constraints should be used? Where is decent, unambiguous documentation
Use "m".
> of gcc inline assembler (instead of poorly explained examples)?
The GCC info pages are pretty useful. See File: gcc.info, Node:
Simple Constraints,
> Thank you Wolfgang for your help so far. Your comments have been very
> useful.
I'm glad if I could help.
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de
Man did not weave the web of life; he is merely a strand in it.
Whatever he does to the web, he does to himself. - Seattle [1854]
More information about the U-Boot
mailing list