summaryrefslogtreecommitdiff
path: root/libcr/coroutine.c
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-11-22 00:53:28 -0700
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-11-23 13:56:51 -0700
commita6847b4fb9fe01d551facf70ca9e360234851f46 (patch)
tree837f5d18ef31fdef5e1e6573830cc5a52a40f02b /libcr/coroutine.c
parentca8d254d39e84cbe3374cbc76a5e21efae88e7a0 (diff)
libcr: Fix cr_cid_info if coroutine_add is running
Diffstat (limited to 'libcr/coroutine.c')
-rw-r--r--libcr/coroutine.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libcr/coroutine.c b/libcr/coroutine.c
index 45dcb39..726b732 100644
--- a/libcr/coroutine.c
+++ b/libcr/coroutine.c
@@ -721,6 +721,8 @@ void cr_cid_info(cid_t cid, struct cr_cid_info *ret) {
uintptr_t sp;
if (cid == coroutine_running)
sp = cr_plat_get_sp();
+ else if (coroutine_table[cid-1].state == CR_RUNNING)
+ sp = coroutine_add_env.sp;
else
sp = coroutine_table[cid-1].env.sp;
assert(sp);