Blue Swirl wrote:
Ah okay - so swap retl with plain ret? And can I just use %sp like the SPARC64 version?
Yes. If you add 'save' and 'restore', then %sp can be used.
Okay - perhaps I'm missing something more fundamental here. The attached patch creates a simple handler that does nothing except flush windows to the stack and then call the C function - but it still seems to corrupt the stack somehow as subsequent calls into OBP have the wrong parameters.
The only thing I can think of is that this simple example fails because of something related to the return address, but I'm not 100% sure. Also what are the rules about how much information you can push onto the stack of the previous frame, i.e. the frame pointer? My current thoughts are that I can either i) push arguments onto the %fp and not save into a new window or ii) push arguments onto the %sp after a save (in which case I need additional code to copy the i registers into the o registers before calling the C function). Does this sound correct?
ATB,
Mark.