… | |
… | |
65 | |
65 | |
66 | static volatile coro_func coro_init_func; |
66 | static volatile coro_func coro_init_func; |
67 | static volatile void *coro_init_arg; |
67 | static volatile void *coro_init_arg; |
68 | static volatile coro_context *new_coro, *create_coro; |
68 | static volatile coro_context *new_coro, *create_coro; |
69 | |
69 | |
|
|
70 | /* what we really want to detect here is wether we use a new-enough version of GAS */ |
|
|
71 | /* instead, check for gcc 3 and ELF and hope for the best */ |
|
|
72 | #if __GNUC__ >= 3 && __ELF__ |
|
|
73 | # define HAVE_CFI 1 |
|
|
74 | #endif |
|
|
75 | |
70 | static void |
76 | static void |
71 | coro_init (void) |
77 | coro_init (void) |
72 | { |
78 | { |
73 | volatile coro_func func = coro_init_func; |
79 | volatile coro_func func = coro_init_func; |
74 | volatile void *arg = coro_init_arg; |
80 | volatile void *arg = coro_init_arg; |
75 | |
81 | |
76 | coro_transfer ((coro_context *)new_coro, (coro_context *)create_coro); |
82 | coro_transfer ((coro_context *)new_coro, (coro_context *)create_coro); |
77 | |
83 | |
|
|
84 | #if HAVE_CFI |
|
|
85 | asm (".cfi_startproc"); |
|
|
86 | #endif |
78 | func ((void *)arg); |
87 | func ((void *)arg); |
|
|
88 | #if HAVE_CFI |
|
|
89 | asm (".cfi_endproc"); |
|
|
90 | #endif |
79 | |
91 | |
80 | /* the new coro returned. bad. just abort() for now */ |
92 | /* the new coro returned. bad. just abort() for now */ |
81 | abort (); |
93 | abort (); |
82 | } |
94 | } |
83 | |
95 | |