Skip to contentSkip to conversation

ppc 85xx inline assembly

U-Boot Qingyu Song 3 participants 3 messages Apr 18, 2009 – Apr 20, 2009

lore
Share & tools
lore
#0 lore raw

Hello,
I am trying to understand the inline assembly function out_be32

extern inline void out_be32(volatile unsigned __iomem *addr, int val)

{
    __asm__ __volatile__("sync; stw%U0%X0 %1,%0" : "=m" (*addr) : "r"

(val));
}

I am not familiar with the syntax here, especially for the %U0%X0 part, can someone help me to translate this into assemble code?

Thanks
Qingyu

#1 lore raw

Dear Qingyu Song,

Quoted 9 lines · In message <[email protected]> you…

extern inline void out_be32(volatile unsigned __iomem *addr, int val)

{
    __asm__ __volatile__("sync; stw%U0%X0 %1,%0" : "=m" (*addr) : "r"

(val));
}

I am not familiar with the syntax here, especially for the %U0%X0 part, can someone help me to translate this into assemble code?

Ask gcc. He is really great in translating C code into assembly code. Try "gcc -S ... "

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The world is coming to an end -- save your buffers!
#2 lore raw
In reply to Qingyu Song
Quoted 11 lines · Qingyu Song

Hello,
I am trying to understand the inline assembly function out_be32

extern inline void out_be32(volatile unsigned __iomem *addr, int val)

{
    __asm__ __volatile__("sync; stw%U0%X0 %1,%0" : "=m" (*addr) : "r"

(val));
}

I am not familiar with the syntax here, especially for the %U0%X0 part, can someone help me to translate this into assemble code?

%U0%X0 tells GCC to add the "u" or "x" suffixes to the instruction as needed by operand 0.

-Scott