[Stackless] Stackless platform switch

Jochen Roth roth at new-light.de
Mon Mar 16 11:28:31 CET 2009


Hi all,

I'm trying to solve some platform related problems on s390 and ppc64.

I think that I could isolate the problems I have to the platform  
switch code which is the following file for the x86_unix case:

Stackless/platf/switch_x86_unix.h

I don't understand what exactly the following code does or why this  
#ifdef is needed for the stackless case?

static int
slp_switch(void)
{
         register int *stackref, stsizediff;
#if STACKLESS_FRHACK
         __asm__ volatile ("" : : : "esi", "edi");
#else
         __asm__ volatile ("" : : : "ebx", "esi", "edi");
#endif
         __asm__ ("movl %%esp, %0" : "=g" (stackref));
         {
                 SLP_SAVE_STATE(stackref, stsizediff);
                 __asm__ volatile (
                     "addl %0, %%esp\n"
                     "addl %0, %%ebp\n"
                     :
                     : "r" (stsizediff)
                     );
                 SLP_RESTORE_STATE();
                 return 0;
         }
#if STACKLESS_FRHACK
         __asm__ volatile ("" : : : "esi", "edi");
#else
         __asm__ volatile ("" : : : "ebx", "esi", "edi");
#endif
}

These #ifdefs don't exist for the s390 and ppc case and therefore I  
thought that it might be root cause for the problems I'm facing with.

It would be great if someone on the list could explain this function  
such that I could transform it to the s390 and ppc case.

Thanks for your help.





More information about the Stackless mailing list