Question

Can someone who is good at assembly for the power pc help me decipher this code?

extern inline void out_8(volatile unsigned char __iomem *addr, u8 val)
{
    __asm__ __volatile__("sync;\n"
                 "stb%U0%X0 %1,%0;\n"
                 : "=m" (*addr)
                 : "r" (val));
}

Thank you very much for your help.

Was it helpful?

Solution

Sync - meaning a memory and out of order buffer - flush caches and such followed by a store byte. Looks like a memory barrier byte write. Confirming... yep. sync is used to make sure all previous instructions have completed on the processor and no following instructions have started. Interesting thing is, the symc usually happens after the store instead of before for so the above code is confirming there are no other writes pending before executing the byte write.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top