Skip to content

Commit 00b7877

Browse files
authored
Merge pull request #230 from lewiszlw/patch-14
Update ch8 1thread.rst
2 parents 0e2a30f + 8fa49e1 commit 00b7877

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

source/chapter8/1thread.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@
235235
236236
available.ctx.x1 = guard as u64; //ctx.x1 is old return address
237237
available.ctx.nx1 = f as u64; //ctx.nx1 is new return address
238-
available.ctx.x2 = s_ptr.offset(32) as u64; //cxt.x2 is sp
238+
available.ctx.x2 = s_ptr.offset(-32) as u64; //cxt.x2 is sp
239239
240240
}
241241
available.state = State::Ready;
@@ -327,7 +327,7 @@
327327
#[inline(never)]
328328
unsafe fn switch(old: *mut TaskContext, new: *const TaskContext) {
329329
// a0: old, a1: new
330-
llvm_asm!("
330+
asm!("
331331
//if comment below lines: sd x1..., ld x1..., TASK2 can not finish, and will segment fault
332332
sd x1, 0x00(a0)
333333
sd x2, 0x08(a0)
@@ -348,8 +348,8 @@
348348
ld t0, 0x70(a1)
349349
350350
jr t0
351-
"
352-
: : : : "volatile", "alignstack"
351+
",
352+
options(noreturn)
353353
);
354354
}
355355
@@ -388,4 +388,4 @@
388388

389389
.. [#explain_green_thread] https://cfsamson.gitbook.io/green-threads-explained-in-200-lines-of-rust/
390390
391-
.. [#code_green_thread] https://github.com/cfsamson/example-greenthreads
391+
.. [#code_green_thread] https://github.com/cfsamson/example-greenthreads

0 commit comments

Comments
 (0)