MCPcopy Create free account
hub / github.com/Tencent/libco / coctx_make

Function coctx_make

coctx.cpp:96–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94 return 0;
95}
96int coctx_make( coctx_t *ctx,coctx_pfn_t pfn,const void *s,const void *s1 )
97{
98 //make room for coctx_param
99 char *sp = ctx->ss_sp + ctx->ss_size - sizeof(coctx_param_t);
100 sp = (char*)((unsigned long)sp & -16L);
101
102
103 coctx_param_t* param = (coctx_param_t*)sp ;
104 param->s1 = s;
105 param->s2 = s1;
106
107 memset(ctx->regs, 0, sizeof(ctx->regs));
108
109 ctx->regs[ kESP ] = (char*)(sp) - sizeof(void*);
110 ctx->regs[ kEIP ] = (char*)pfn;
111
112 return 0;
113}
114#elif defined(__x86_64__)
115int coctx_make( coctx_t *ctx,coctx_pfn_t pfn,const void *s,const void *s1 )
116{

Callers 1

co_resumeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected