seL4 icon indicating copy to clipboard operation
seL4 copied to clipboard

risc-v: remove K constraint in fcsr access wrapper

Open axel-h opened this issue 3 years ago • 0 comments

The 'K' constraint is for 5-bit unsigned integer immediate operands only in both GCC and LLVM. It does not apply to the value written.

See manuals:

  • https://llvm.org/docs/LangRef.html#supported-constraint-code-list
  • https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html

In the Linux kernel there is this the commit https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/riscv/include/asm/csr.h?id=5d8544e2d0075a5f3c9a2cf27152354d54360da1 that adds the 'K' constraint, which might explain the origin. Even if this has never been change, I still think this is incorrect usage.

axel-h avatar Oct 16 '22 20:10 axel-h