Hm - I'm probably responsible for the #ifdef -- though perhaps not
the whole string of reasoning that led up to it.  I seem to
recall it has something to do with gcc on x86 and what version of
gcc you are using... (possibly searching the list archive would
provide more details)  basically it just un-preserves an extra register
and there is a configure flag to enable/disable STACKLESS_FRHACK.

It is sort of compiler/platform specific;
I doubt understanding exactly *why* it is there will help much
with problems on other (non-x86) platforms.


-Jas


On Mar 16, 2009, at 6:28 AM, Jochen Roth wrote:

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.


_______________________________________________
Stackless mailing list
[email protected]
http://www.stackless.com/mailman/listinfo/stackless



_______________________________________________
Stackless mailing list
[email protected]
http://www.stackless.com/mailman/listinfo/stackless

Reply via email to