Hi Vaibhav, On Wed, Oct 14, 2015 at 11:26 AM, Vaibhav Sood <vaibhav_s...@persistent.com> wrote: > code to return back to the calling function slp_switch. However in between > the calling function’s stack content is overwritten by the g_restore_state > code (it memcpy’s the stored heap memory data to the stack) causing the > saved LR value to be destroyed and thus returning from the g_restore_state > function (using blr) causes a segfault
I would decrement sp around the two calls to the C functions, g_save_state and g_restore_state, to give them their own temporary places to write to without interference. This is similar to how the x86 version gives "rsp" as argument, but then uses CALL, which pushes the return address just below rsp, i.e. out of scope of the saving/restoring. Example: ... mr r3, sp # the 1st argument is the value of sp without the extra space stdu sp, -64(sp) # decrement sp again; 64 should be enough ...call g_save_state... addi sp, sp, 64 # restore sp ... A bientôt, Armin. _______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev