You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This will write the value 5 into the u64 variable x. You can see that the string literal we use to specify instructions is actually a template string. It is governed by the same rules as Rust [format strings][format-syntax]. The arguments that are inserted into the template however look a bit different than you may be familiar with. First we need to specify if the variable is an input or an output of the inline assembly. In this case it is an output. We declared this by writing out. We also need to specify in what kind of register the assembly expects the variable. In this case we put it in an arbitrary general purpose register by specifying reg. The compiler will choose an appropriate register to insert into the template and will read the variable from there after the inline assembly finishes executing.
The text in bold was meant to be a link but is broken. I don't know what should be the link target.
https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#inputs-and-outputs
The text in bold was meant to be a link but is broken. I don't know what should be the link target.
CC @Amanieu (you wrote this in ebbc1ab).
The text was updated successfully, but these errors were encountered: