27 Aug
2009
27 Aug
'09
10:56 a.m.
On Wed, 26 Aug 2009, M?ns Rullg?rd wrote:
+ "mtctr %0 \n" + "stw 2,-4(1) \n" + "li 2,16 \n" + "bctrl \n" + "lwz 2,-4(1) \n" // ABI docs say r2 is general purpose and caller-saved, but gcc doesn't save it and crashes
I assume you meant stwu to push the value of r2 and lwz/addi to restore it. Even with that change, it would fail on ppc64 since you'd be preserving only half the register. Furthermore, the ABI mandates a 16-byte-aligned stack at all times, but you could probably get away without that if you never call any compiled code.
I meant to store it in the redzone. My asm also never touches the stack pointer, and store their return addresses at fixed locations in the redzone. --Loren Merritt