Re: Using the stack from inline assembly

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

 



On 12/13/2016 08:51 AM, Florian Weimer wrote:
On 12/13/2016 04:41 PM, Jeff Law wrote:
On 12/13/2016 12:13 AM, Florian Weimer wrote:
Is it possible to use the stack from inline assembly?  I'm particularly
interested in i386 and x86_64, and push/pop instructions and function
calls.
You can push/pop and perform a function call.  Obviously you have to
express what's going on from a dataflow standpoint if you use a new
style asm -- that includes notifying GCC of the registers clobbered at
the call point and the memory usage.

How do I express that?  It's not that %rsp is clobbered, its unchanged.
How can I express a clobber on memory which does not even have an
address as far as C is concerned?
For the push/pop I'd express what's externally visible. ie, you hit memory and use some operand (the source of the push). You need not describe the state of the stack pointer though. I wouldn't think you'd need to expose the frame pointer.

It's probably wise to ensure the stack pointer keeps proper alignment and such, but that's entirely within the asm itself.

No idea what's going on with Andrew's example, I haven't dug into it.

jeff



[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