Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sbi_cppc_write is never passed the full 64-bit value when __riscv_xlen == 32 #334

Open
repnop opened this issue Nov 25, 2023 · 1 comment

Comments

@repnop
Copy link

repnop commented Nov 25, 2023

ret = sbi_cppc_write(regs->a0, regs->a1);

Unless there's something I've missed in the SBI specification about CPPC register values never exceeding 32-bits when XLEN is 32, this line is wrong whenever the code is compiled for __riscv_xlen == 32, as it implicitly promotes the unsigned long (32-bits) to a uint64_t instead of reading the full 64-bit value out of a1 and a2 and combining them into a 64-bit value.

@avpatel
Copy link
Collaborator

avpatel commented Nov 26, 2023

Yes, this line needs to be fixed for RV32. Please send a patch to the OpenSBI mailing list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants