This is the mail archive of the crossgcc@sourceware.cygnus.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: How to pass a #defined constant as an address to the inline assembler


Peter Barada wrote:
>
> If I understand the problem correctly, then you want to store the
> value foo at the 16 bit I/O register CNTR1.

No, just the opposite. I want to store the 16 bit that lie at address
CNTR1 to the variable foo.

This is my code now:
--
unsigned short foo;
#define MODBASE  0xFFFFF000L
#define CNTR1   (unsigned short *)(MODBASE+0x060A)
asm volatile ("move.w %1,%0" : "=g" (foo) : "g" (*CNTR1));
--

And it produces:
--
move.w (0F60A).w,(0FFFE,A6)
--

Now it uses the constant as a pointer (which is good) but the pointer is
shortened to 16 bits which is not the correct address.

Any ideas how to get rid of this?

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]