Re: Issue with __sync_synchronize() or asm volatile("": : :"memory")

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* William Tambe:

> I am using the following assembly where timer_intr is a function that
> I am calling within the assembly.
>
> __sync_synchronize();
> asm volatile("": : :"memory")
> asm volatile (
>     "jl %%rp, %0\n"
>     :: "r"(timer_intr)
>     :  "memory");
>
> The issue that I am having is that, despite the use of the "memory"
> clobber or __sync_synchronize() or asm volatile("": : :"memory"),
> registers holding local variables are not flushed to memory;

Variables do not necessarily reside in memory, so there is no flushing
to be done.

> which causes them to have a different value after the assembly because
> the function timer_intr() modified them.

Which ABI is this?

timer_intr needs to follow the calling convention and not clobber
callee-saved registers.  You might be able to work around this by adding
register clobbers to the extended asm statement, but calling functions
from inline assembly is problematic on other targets.

The right fix would be to have an assembler wrapper for timer_intr which
adapts it to the ABI calling convention.





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux