我想让这个函数能操作指定名称的寄存器,但是似乎asm!宏不支持?
pub fn csr_swap(csr: &str,val:u64) -> u64 {
let value: u64 = 0;
unsafe {
asm!(
"csrrw {0},{1},{2}",
out(reg) value,
csr,
in(reg) val
);
}
value
}
expected one of clobber_abi
, const
, in
, inlateout
, inout
, lateout
, options
, out
, or sym
, found csr
1
共 1 条评论, 1 页
评论区
写评论cannot use value of type
&str
for inline assembly only integers, floats, SIMD vectors, pointers and function pointers can be used as arguments for inline assemblyrustcClick for full compiler diagnostic