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

ecall check fails in CLIC mode #440

Open
silabs-kjetil opened this issue Mar 11, 2024 · 5 comments
Open

ecall check fails in CLIC mode #440

silabs-kjetil opened this issue Mar 11, 2024 · 5 comments

Comments

@silabs-kjetil
Copy link

This issue is only seen when using CLIC mode trap handling

https://github.com/riscv-non-isa/riscv-arch-test/blob/main/riscv-test-suite/env/arch_test.h#L1160

This code is supposed to check for ecall, and exit early when it is detected. However the way the code is doing this does not work correctly when mcause contains extra bits like in the case when CLIC is used. Typically bits 29:28 will contain 0b11 so mcause will somtimes have the value 0x3000000B when read by the handler and the code will not detect that this is actually an ecall with exception code = 0xB.

This issue has also been discussed in the following PR: #436 (comment)

@allenjbaum
Copy link
Collaborator

allenjbaum commented Mar 20, 2024 via email

@allenjbaum
Copy link
Collaborator

allenjbaum commented Mar 20, 2024 via email

@allenjbaum
Copy link
Collaborator

allenjbaum commented Mar 20, 2024 via email

@silabs-kjetil
Copy link
Author

Yes there might be other bits that are set, so in the case when CLIC is used we have to only look at bits 11:0 to inspect the exception/interrupt code. Here is a picture of the changes done to xcause for CLIC mode.

bilde

It looks like the arch_test.h file already contains a mask to extract the exception cause bits, however this is not used when checking for an ecall.

exception mask: https://github.com/riscv-non-isa/riscv-arch-test/blob/main/riscv-test-suite/env/arch_test.h#L157

@allenjbaum
Copy link
Collaborator

allenjbaum commented Mar 22, 2024 via email

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