[Stackless-checkins] r55338 - stackless/branches/release25-maint/Stackless/platf/switch_amd64_unix_gas.s

richard.tew python-checkins at python.org
Tue May 15 11:59:13 CEST 2007


Author: richard.tew
Date: Tue May 15 11:59:10 2007
New Revision: 55338

Added:
   stackless/branches/release25-maint/Stackless/platf/switch_amd64_unix_gas.s
Log:
Most of the work towards assembler based hard switching code for gcc based AMD64 code.  Last I checked it still caused crashes, requires further work and is not hooked into the build process.

Added: stackless/branches/release25-maint/Stackless/platf/switch_amd64_unix_gas.s
==============================================================================
--- (empty file)
+++ stackless/branches/release25-maint/Stackless/platf/switch_amd64_unix_gas.s	Tue May 15 11:59:10 2007
@@ -0,0 +1,56 @@
+# NOTE: This is not yet safe to use.  Checked in for the same of reference.
+#
+# (int) slp_switch (void);
+
+       .text
+       .type   slp_switch, @function
+       # This next line is required to the C code can find and
+       # link against this function.
+       .global slp_switch
+slp_switch:
+       pushq   %rbp
+       pushq   %r15
+       pushq   %r14
+       pushq   %r13
+       pushq   %r12
+       pushq   %rbx
+
+       # Disabled for now, which should ideally give us identical
+       # behaviour to the inline C version.  Can add this when we
+       # are ready for it.
+       #subq    $8, %rsp
+       #stmxcsr (%rsp)
+
+       movq    %rsp, %rdi
+
+       call slp_save_state             # diff = slp_save_state([?]stackref)
+
+       cmp     $-1, %eax               # if (diff == -1)
+       je      .exit                   #     return -1;
+
+       cmp     $1, %eax                # if (diff ==  1)
+       je      .no_restore             #     return 0;
+
+.restore:
+       add    %eax, %esp               # Adjust the stack pointer for the state we are restoring.
+
+       call slp_restore_state          # slp_restore_state()
+
+.no_restore:
+       xor     %rax, %rax              # Switch successful (whether we restored or not).
+
+.exit:
+       #ldmxcsr (%rsp)
+       #addq    $8, %rsp
+
+       popq    %rbx
+       popq    %r12
+       popq    %r13
+       popq    %r14
+       popq    %r15
+       # rbp gets popped by the leave statement
+
+       leave
+       ret
+.LFE11:
+       .size   slp_switch, .-slp_switch

_______________________________________________
Stackless-checkins mailing list
Stackless-checkins at stackless.com
http://www.stackless.com/mailman/listinfo/stackless-checkins



More information about the Stackless-checkins mailing list