1
0
mirror of https://github.com/Tencent/libco.git synced 2025-05-08 19:51:15 +08:00

Make stack sp aligned

This commit is contained in:
princewen 2019-12-09 19:08:10 +08:00
parent c79e3e8869
commit 58651e99e8

View File

@ -108,8 +108,8 @@ int coctx_make(coctx_t* ctx, coctx_pfn_t pfn, const void* s, const void* s1) {
}
#elif defined(__x86_64__)
int coctx_make(coctx_t* ctx, coctx_pfn_t pfn, const void* s, const void* s1) {
char* sp = ctx->ss_sp + ctx->ss_size;
sp = (char*)((unsigned long)sp & -16LL) - sizeof(void*);
char* sp = ctx->ss_sp + ctx->ss_size - sizeof(void*);
sp = (char*)((unsigned long)sp & -16LL);
memset(ctx->regs, 0, sizeof(ctx->regs));
void** ret_addr = (void**)(sp);