This commit is contained in:
Bung 2022-12-16 15:01:15 +08:00 • committed by GitHub
commit a9bd78d579
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 140 additions and 140 deletions

View file

@ -281,8 +281,8 @@ proc start*(c: proc(), stacksize: int = defaultStackSize): CoroutineRef {.discar
(proc(p: pointer) {.stdcall.} = runCurrentTask()), nil)
else:
coro = cast[CoroutinePtr](alloc0(sizeof(Coroutine) + stacksize))
coro.stack.top = cast[pointer](cast[ByteAddress](coro) + sizeof(Coroutine))
coro.stack.bottom = cast[pointer](cast[ByteAddress](coro.stack.top) + stacksize)
coro.stack.top = cast[pointer](cast[int](coro) + sizeof(Coroutine))
coro.stack.bottom = cast[pointer](cast[int](coro.stack.top) + stacksize)
when coroBackend == CORO_BACKEND_UCONTEXT:
discard getcontext(coro.execContext)
coro.execContext.uc_stack.ss_sp = coro.stack.top