Re: Inline ARM assembler and the sp register

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

 



Richard Tew writes:
 > Hi,
 > 
 > I am using the inline assembly functionality of gcc (gcc 4.1.0
 > compiled as part of the devkitpro/devkitarm package which
 > uses mingw/msys on Windows).  What I am trying to do is
 > port Stackless Python, which copies portions of the stack
 > off and back on, as it switches between microthreads.
 > 
 > The problem is, gcc preserves the stack pointer on entry to the
 > function and restores it at the end, so while I may copy around
 > portions of the stack with the presumption my modified stack
 > pointer will be used on exit of the function, what I actually get
 > is the modified stack, but the old stack pointer restored over
 > my modified one.
 > 
 > I can hack a solution.  Looking at the disassembly in the
 > debugger I am using, I see that sp is preserved in r7, so if I
 > modify my inline assembler to modify r7 instead of sp,
 > Stackless Python works fine.

Why don't you just write the stack-exchanging routine in pure asm?  It
seems to me that inline asm is just the wrong tool for the job.

Andrew.

[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