CocytusDEDI
CocytusDEDI

Reputation: 160

Why must there be an instruction before out statements in Rust in-line assembly?

I just want to take the value in a1 and assign it to a variable, so why does it make me put an instruction before using an out, or in this case a lateout? I've written the following assembly, but I imagine there's a better way to do this:

unsafe {
    asm!(
        "mv t0, t0",
        lateout("a1") device_tree_pointer,
        clobber_abi("system")
    );
}

I wish I could have just written the following, but the compiler won't let me:

unsafe {
    asm!(
        lateout("a1") device_tree_pointer,
        clobber_abi("system")
    );
}

Is there a reason for this I'm not comprehending?

Upvotes: 1

Views: 56

Answers (0)

Related Questions