Загрузить файлы в «venv/Lib/site-packages/greenlet/platform»
This commit is contained in:
79
venv/Lib/site-packages/greenlet/platform/switch_arm32_gcc.h
Normal file
79
venv/Lib/site-packages/greenlet/platform/switch_arm32_gcc.h
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
* this is the internal transfer function.
|
||||||
|
*
|
||||||
|
* HISTORY
|
||||||
|
* 14-Aug-06 File creation. Ported from Arm Thumb. Sylvain Baro
|
||||||
|
* 3-Sep-06 Commented out saving of r1-r3 (r4 already commented out) as I
|
||||||
|
* read that these do not need to be saved. Also added notes and
|
||||||
|
* errors related to the frame pointer. Richard Tew.
|
||||||
|
*
|
||||||
|
* NOTES
|
||||||
|
*
|
||||||
|
* It is not possible to detect if fp is used or not, so the supplied
|
||||||
|
* switch function needs to support it, so that you can remove it if
|
||||||
|
* it does not apply to you.
|
||||||
|
*
|
||||||
|
* POSSIBLE ERRORS
|
||||||
|
*
|
||||||
|
* "fp cannot be used in asm here"
|
||||||
|
*
|
||||||
|
* - Try commenting out "fp" in REGS_TO_SAVE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define STACK_REFPLUS 1
|
||||||
|
|
||||||
|
#ifdef SLP_EVAL
|
||||||
|
#define STACK_MAGIC 0
|
||||||
|
#define REG_SP "sp"
|
||||||
|
#define REG_SPSP "sp,sp"
|
||||||
|
#ifdef __thumb__
|
||||||
|
#define REG_FP "r7"
|
||||||
|
#define REG_FPFP "r7,r7"
|
||||||
|
#define REGS_TO_SAVE_GENERAL "r4", "r5", "r6", "r8", "r9", "r10", "r11", "lr"
|
||||||
|
#else
|
||||||
|
#define REG_FP "fp"
|
||||||
|
#define REG_FPFP "fp,fp"
|
||||||
|
#define REGS_TO_SAVE_GENERAL "r4", "r5", "r6", "r7", "r8", "r9", "r10", "lr"
|
||||||
|
#endif
|
||||||
|
#if defined(__SOFTFP__)
|
||||||
|
#define REGS_TO_SAVE REGS_TO_SAVE_GENERAL
|
||||||
|
#elif defined(__VFP_FP__)
|
||||||
|
#define REGS_TO_SAVE REGS_TO_SAVE_GENERAL, "d8", "d9", "d10", "d11", \
|
||||||
|
"d12", "d13", "d14", "d15"
|
||||||
|
#elif defined(__MAVERICK__)
|
||||||
|
#define REGS_TO_SAVE REGS_TO_SAVE_GENERAL, "mvf4", "mvf5", "mvf6", "mvf7", \
|
||||||
|
"mvf8", "mvf9", "mvf10", "mvf11", \
|
||||||
|
"mvf12", "mvf13", "mvf14", "mvf15"
|
||||||
|
#else
|
||||||
|
#define REGS_TO_SAVE REGS_TO_SAVE_GENERAL, "f4", "f5", "f6", "f7"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static int
|
||||||
|
#ifdef __GNUC__
|
||||||
|
__attribute__((optimize("no-omit-frame-pointer")))
|
||||||
|
#endif
|
||||||
|
slp_switch(void)
|
||||||
|
{
|
||||||
|
void *fp;
|
||||||
|
int *stackref, stsizediff;
|
||||||
|
int result;
|
||||||
|
__asm__ volatile ("" : : : REGS_TO_SAVE);
|
||||||
|
__asm__ volatile ("mov r0," REG_FP "\n\tstr r0,%0" : "=m" (fp) : : "r0");
|
||||||
|
__asm__ ("mov %0," REG_SP : "=r" (stackref));
|
||||||
|
{
|
||||||
|
SLP_SAVE_STATE(stackref, stsizediff);
|
||||||
|
__asm__ volatile (
|
||||||
|
"add " REG_SPSP ",%0\n"
|
||||||
|
"add " REG_FPFP ",%0\n"
|
||||||
|
:
|
||||||
|
: "r" (stsizediff)
|
||||||
|
);
|
||||||
|
SLP_RESTORE_STATE();
|
||||||
|
}
|
||||||
|
__asm__ volatile ("ldr r0,%1\n\tmov " REG_FP ",r0\n\tmov %0, #0" : "=r" (result) : "m" (fp) : "r0");
|
||||||
|
__asm__ volatile ("" : : : REGS_TO_SAVE);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
67
venv/Lib/site-packages/greenlet/platform/switch_arm32_ios.h
Normal file
67
venv/Lib/site-packages/greenlet/platform/switch_arm32_ios.h
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
* this is the internal transfer function.
|
||||||
|
*
|
||||||
|
* HISTORY
|
||||||
|
* 31-May-15 iOS support. Ported from arm32. Proton <feisuzhu@163.com>
|
||||||
|
*
|
||||||
|
* NOTES
|
||||||
|
*
|
||||||
|
* It is not possible to detect if fp is used or not, so the supplied
|
||||||
|
* switch function needs to support it, so that you can remove it if
|
||||||
|
* it does not apply to you.
|
||||||
|
*
|
||||||
|
* POSSIBLE ERRORS
|
||||||
|
*
|
||||||
|
* "fp cannot be used in asm here"
|
||||||
|
*
|
||||||
|
* - Try commenting out "fp" in REGS_TO_SAVE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define STACK_REFPLUS 1
|
||||||
|
|
||||||
|
#ifdef SLP_EVAL
|
||||||
|
|
||||||
|
#define STACK_MAGIC 0
|
||||||
|
#define REG_SP "sp"
|
||||||
|
#define REG_SPSP "sp,sp"
|
||||||
|
#define REG_FP "r7"
|
||||||
|
#define REG_FPFP "r7,r7"
|
||||||
|
#define REGS_TO_SAVE_GENERAL "r4", "r5", "r6", "r8", "r10", "r11", "lr"
|
||||||
|
#define REGS_TO_SAVE REGS_TO_SAVE_GENERAL, "d8", "d9", "d10", "d11", \
|
||||||
|
"d12", "d13", "d14", "d15"
|
||||||
|
|
||||||
|
static int
|
||||||
|
#ifdef __GNUC__
|
||||||
|
__attribute__((optimize("no-omit-frame-pointer")))
|
||||||
|
#endif
|
||||||
|
slp_switch(void)
|
||||||
|
{
|
||||||
|
void *fp;
|
||||||
|
int *stackref, stsizediff, result;
|
||||||
|
__asm__ volatile ("" : : : REGS_TO_SAVE);
|
||||||
|
__asm__ volatile ("str " REG_FP ",%0" : "=m" (fp));
|
||||||
|
__asm__ ("mov %0," REG_SP : "=r" (stackref));
|
||||||
|
{
|
||||||
|
SLP_SAVE_STATE(stackref, stsizediff);
|
||||||
|
__asm__ volatile (
|
||||||
|
"add " REG_SPSP ",%0\n"
|
||||||
|
"add " REG_FPFP ",%0\n"
|
||||||
|
:
|
||||||
|
: "r" (stsizediff)
|
||||||
|
: REGS_TO_SAVE /* Clobber registers, force compiler to
|
||||||
|
* recalculate address of void *fp from REG_SP or REG_FP */
|
||||||
|
);
|
||||||
|
SLP_RESTORE_STATE();
|
||||||
|
}
|
||||||
|
__asm__ volatile (
|
||||||
|
"ldr " REG_FP ", %1\n\t"
|
||||||
|
"mov %0, #0"
|
||||||
|
: "=r" (result)
|
||||||
|
: "m" (fp)
|
||||||
|
: REGS_TO_SAVE /* Force compiler to restore saved registers after this */
|
||||||
|
);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
AREA switch_arm64_masm, CODE, READONLY;
|
||||||
|
GLOBAL slp_switch [FUNC]
|
||||||
|
EXTERN slp_save_state_asm
|
||||||
|
EXTERN slp_restore_state_asm
|
||||||
|
|
||||||
|
slp_switch
|
||||||
|
; push callee saved registers to stack
|
||||||
|
stp x19, x20, [sp, #-16]!
|
||||||
|
stp x21, x22, [sp, #-16]!
|
||||||
|
stp x23, x24, [sp, #-16]!
|
||||||
|
stp x25, x26, [sp, #-16]!
|
||||||
|
stp x27, x28, [sp, #-16]!
|
||||||
|
stp x29, x30, [sp, #-16]!
|
||||||
|
stp d8, d9, [sp, #-16]!
|
||||||
|
stp d10, d11, [sp, #-16]!
|
||||||
|
stp d12, d13, [sp, #-16]!
|
||||||
|
stp d14, d15, [sp, #-16]!
|
||||||
|
|
||||||
|
; call slp_save_state_asm with stack pointer
|
||||||
|
mov x0, sp
|
||||||
|
bl slp_save_state_asm
|
||||||
|
|
||||||
|
; early return for return value of 1 and -1
|
||||||
|
cmp x0, #-1
|
||||||
|
b.eq RETURN
|
||||||
|
cmp x0, #1
|
||||||
|
b.eq RETURN
|
||||||
|
|
||||||
|
; increment stack and frame pointer
|
||||||
|
add sp, sp, x0
|
||||||
|
add x29, x29, x0
|
||||||
|
|
||||||
|
bl slp_restore_state_asm
|
||||||
|
|
||||||
|
; store return value for successful completion of routine
|
||||||
|
mov x0, #0
|
||||||
|
|
||||||
|
RETURN
|
||||||
|
; pop registers from stack
|
||||||
|
ldp d14, d15, [sp], #16
|
||||||
|
ldp d12, d13, [sp], #16
|
||||||
|
ldp d10, d11, [sp], #16
|
||||||
|
ldp d8, d9, [sp], #16
|
||||||
|
ldp x29, x30, [sp], #16
|
||||||
|
ldp x27, x28, [sp], #16
|
||||||
|
ldp x25, x26, [sp], #16
|
||||||
|
ldp x23, x24, [sp], #16
|
||||||
|
ldp x21, x22, [sp], #16
|
||||||
|
ldp x19, x20, [sp], #16
|
||||||
|
|
||||||
|
ret
|
||||||
|
|
||||||
|
END
|
||||||
BIN
venv/Lib/site-packages/greenlet/platform/switch_arm64_masm.obj
Normal file
BIN
venv/Lib/site-packages/greenlet/platform/switch_arm64_masm.obj
Normal file
Binary file not shown.
17
venv/Lib/site-packages/greenlet/platform/switch_arm64_msvc.h
Normal file
17
venv/Lib/site-packages/greenlet/platform/switch_arm64_msvc.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* this is the internal transfer function.
|
||||||
|
*
|
||||||
|
* HISTORY
|
||||||
|
* 21-Oct-21 Niyas Sait <niyas.sait@linaro.org>
|
||||||
|
* First version to enable win/arm64 support.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define STACK_REFPLUS 1
|
||||||
|
#define STACK_MAGIC 0
|
||||||
|
|
||||||
|
/* Use the generic support for an external assembly language slp_switch function. */
|
||||||
|
#define EXTERNAL_ASM
|
||||||
|
|
||||||
|
#ifdef SLP_EVAL
|
||||||
|
/* This always uses the external masm assembly file. */
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user