[py-svn] r11403 - py/dist/py/c-extension/greenlet
arigo at codespeak.net
arigo at codespeak.net
Sun Apr 24 14:12:54 CEST 2005
Author: arigo
Date: Sun Apr 24 14:12:53 2005
New Revision: 11403
Added:
py/dist/py/c-extension/greenlet/switch_amd64_unix.h
- copied, changed from r11401, py/dist/py/c-extension/greenlet/switch_x86_unix.h
Modified:
py/dist/py/c-extension/greenlet/slp_platformselect.h
Log:
X86-64 support code. This code has been posted as a patch for Stackless
by Hye-Shik Chang on the stackless mailing list.
Modified: py/dist/py/c-extension/greenlet/slp_platformselect.h
==============================================================================
--- py/dist/py/c-extension/greenlet/slp_platformselect.h (original)
+++ py/dist/py/c-extension/greenlet/slp_platformselect.h Sun Apr 24 14:12:53 2005
@@ -6,6 +6,8 @@
#include "switch_x86_msvc.h" /* MS Visual Studio on X86 */
#elif defined(__GNUC__) && defined(__i386__)
#include "switch_x86_unix.h" /* gcc on X86 */
+#elif defined(__GNUC__) && defined(__amd64__)
+#include "switch_amd64_unix.h" /* gcc on amd64 */
#elif defined(__GNUC__) && defined(__PPC__) && defined(__linux__)
#include "switch_ppc_unix.h" /* gcc on PowerPC */
#elif defined(__GNUC__) && defined(__ppc__) && defined(__APPLE__)
Copied: py/dist/py/c-extension/greenlet/switch_amd64_unix.h (from r11401, py/dist/py/c-extension/greenlet/switch_x86_unix.h)
==============================================================================
--- py/dist/py/c-extension/greenlet/switch_x86_unix.h (original)
+++ py/dist/py/c-extension/greenlet/switch_amd64_unix.h Sun Apr 24 14:12:53 2005
@@ -2,6 +2,8 @@
* this is the internal transfer function.
*
* HISTORY
+ * 01-Apr-04 Hye-Shik Chang <perky at FreeBSD.org>
+ * Ported from i386 to amd64.
* 24-Nov-02 Christian Tismer <tismer at tismer.com>
* needed to add another magic constant to insure
* that f in slp_eval_frame(PyFrameObject *f)
@@ -27,24 +29,27 @@
/* the above works fine with gcc 2.96, but 2.95.3 wants this */
#define STACK_MAGIC 0
+#define REGS_TO_SAVE "rdx", "rbx", "r12", "r13", "r14", "r15"
+
+
static int
slp_switch(void)
{
- register int *stackref, stsizediff;
- __asm__ volatile ("" : : : "ebx", "esi", "edi");
- __asm__ ("movl %%esp, %0" : "=g" (stackref));
+ register long *stackref, stsizediff;
+ __asm__ volatile ("" : : : REGS_TO_SAVE);
+ __asm__ ("movq %%rsp, %0" : "=g" (stackref));
{
SLP_SAVE_STATE(stackref, stsizediff);
__asm__ volatile (
- "addl %0, %%esp\n"
- "addl %0, %%ebp\n"
+ "addq %0, %%rsp\n"
+ "addq %0, %%rbp\n"
:
: "r" (stsizediff)
);
SLP_RESTORE_STATE();
return 0;
}
- __asm__ volatile ("" : : : "ebx", "esi", "edi");
+ __asm__ volatile ("" : : : REGS_TO_SAVE);
}
#endif
More information about the pytest-commit
mailing list