Skip to content

Broken link on https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html #1507

Closed
@ChayimFriedman2

Description

@ChayimFriedman2

https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#inputs-and-outputs

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.

CC @Amanieu (you wrote this in ebbc1ab).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions