Re: [PATCH 1/7] rust: file: add Rust abstraction for `struct file`

From: Boqun Feng
Date: Fri Dec 01 2023 - 04:52:36 EST


On Fri, Dec 01, 2023 at 10:00:39AM +0100, Peter Zijlstra wrote:
> On Thu, Nov 30, 2023 at 07:25:01AM -0800, Boqun Feng wrote:
>
> > seems to me, the plan for this is something like below:
> >
> > asm!(
> > "cmp {}, 42",
> > "jeq {}",
> > in(reg) val,
> > label { println!("a"); },
> > fallthrough { println!("b"); }
> > );
>
> Because rust has horrible syntax I can't parse, I can't tell if this is
> useful or not :/ Can this be used to implement arch_static_branch*() ?

I should think so:

asm!("jmp {l_yes}", // jump to l_yes
"..." // directives are supported
l_yes { return true; } // label "l_yes"
fallthrough { return false; } // otherwise return false
)

Rust uses LLVM backend, so the inline asm should have the same ability
of clang.

But as I said, AFAIK jumping to label hasn't been implemented yet.

Regards,
Boqun