add comments about inline asm in usr/src/bin/stackful_coroutine.rs

This commit is contained in:
Yu Chen 2022-04-29 12:02:06 +08:00
parent f0a11d1444
commit 253f5a4982

View File

@ -261,10 +261,11 @@ pub fn yield_task() {
/// to as saved context and in general our assembly will not work as expected.
///
/// see: https://github.com/rust-lang/rfcs/blob/master/text/1201-naked-fns.md
/// see: https://doc.rust-lang.org/nightly/reference/inline-assembly.html
/// see: https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html
#[naked]
#[no_mangle]
unsafe fn switch(old: *mut TaskContext, new: *const TaskContext) {
//unsafe extern "C" fn switch() {
// a0: _old, a1: _new
asm!("
sd x1, 0x00(a0)