From 75c62c4f9cc49702ce6f0d8170f34a493caef2ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9E=97=E4=BC=9F?= Date: Fri, 25 Oct 2024 23:52:20 +0800 Subject: [PATCH 1/3] Update ch8 1thread.rst --- source/chapter8/1thread.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/chapter8/1thread.rst b/source/chapter8/1thread.rst index 28a7e6723..e1c078550 100644 --- a/source/chapter8/1thread.rst +++ b/source/chapter8/1thread.rst @@ -327,7 +327,7 @@ #[inline(never)] unsafe fn switch(old: *mut TaskContext, new: *const TaskContext) { // a0: old, a1: new - llvm_asm!(" + asm!(" //if comment below lines: sd x1..., ld x1..., TASK2 can not finish, and will segment fault sd x1, 0x00(a0) sd x2, 0x08(a0) @@ -388,4 +388,4 @@ .. [#explain_green_thread] https://cfsamson.gitbook.io/green-threads-explained-in-200-lines-of-rust/ -.. [#code_green_thread] https://github.com/cfsamson/example-greenthreads \ No newline at end of file +.. [#code_green_thread] https://github.com/cfsamson/example-greenthreads From 81f0743d62a7379b4f0d4b1a257fbac18218b971 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9E=97=E4=BC=9F?= Date: Sat, 26 Oct 2024 00:07:29 +0800 Subject: [PATCH 2/3] Update ch8 1thread.rst --- source/chapter8/1thread.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/chapter8/1thread.rst b/source/chapter8/1thread.rst index e1c078550..0cf259773 100644 --- a/source/chapter8/1thread.rst +++ b/source/chapter8/1thread.rst @@ -235,7 +235,7 @@ available.ctx.x1 = guard as u64; //ctx.x1 is old return address available.ctx.nx1 = f as u64; //ctx.nx1 is new return address - available.ctx.x2 = s_ptr.offset(32) as u64; //cxt.x2 is sp + available.ctx.x2 = s_ptr.offset(-32) as u64; //cxt.x2 is sp } available.state = State::Ready; From 8fa49e10c149482564a099642463cfee5b5b9369 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9E=97=E4=BC=9F?= Date: Sat, 26 Oct 2024 00:16:59 +0800 Subject: [PATCH 3/3] Update ch8 1thread.rst --- source/chapter8/1thread.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/chapter8/1thread.rst b/source/chapter8/1thread.rst index 0cf259773..b48fe4277 100644 --- a/source/chapter8/1thread.rst +++ b/source/chapter8/1thread.rst @@ -348,8 +348,8 @@ ld t0, 0x70(a1) jr t0 - " - : : : : "volatile", "alignstack" + ", + options(noreturn) ); }