[PATCH v2] lib: sbi: Improve csr read and write

Jan Remeš jan.remes at codasip.com
Thu May 26 07:31:07 PDT 2022


On Thu, May 26, 2022 at 4:19 PM Xiang W <wxjstz at 126.com> wrote:
>
> +       uint32_t opcode_buff[2];
> +       typedef unsigned long (*read_f)(void);
> +       opcode_buff[0] = (csr_num << 20) | 0x00002573; /* csrr a0, csr */
> +       opcode_buff[1] = 0x00008067; /* ret */
> +       return ((read_f)opcode_buff)();
I am not completely sure here, but doesn't this need a FENCE.I before
the opcode is executed?

Best regards,
  Jan



More information about the opensbi mailing list