| 94 | return 0; |
| 95 | } |
| 96 | int 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__) |
| 115 | int coctx_make( coctx_t *ctx,coctx_pfn_t pfn,const void *s,const void *s1 ) |
| 116 | { |