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

Incorrect behaviour with INT_MAX pmpaddr #739

Open
Timmmm opened this issue Feb 14, 2025 · 0 comments · May be fixed by #773
Open

Incorrect behaviour with INT_MAX pmpaddr #739

Timmmm opened this issue Feb 14, 2025 · 0 comments · May be fixed by #773
Labels
bug Something isn't working

Comments

@Timmmm
Copy link
Collaborator

Timmmm commented Feb 14, 2025

If you set pmpaddr to ones() then it will misbehave. For NAPOT it will return (zeros(), zeros()). For NA4 it will return (ones(), zeros()). In both cases it will match no addresses, whereas it should match all memory, or the top 4 bytes respectively.

I have a fix for this, and a test (I know!). The test is written in Zig... I was experimenting with that. I'll demo it in the next meeting I'm at (24th).

Timmmm added a commit to Timmmm/sail-riscv that referenced this issue Mar 7, 2025
This fixes a bug if you set `pmpaddr` to `ones()`. For NAPOT it would return `(zeros(), zeros())`. For NA4 it would return `(ones(), zeros())`. In both cases it will match no addresses, whereas it should match all memory, or the top 4 bytes respectively.

A test is included for NAPOT that fails before and passes afterwards.

Fixes riscv#739
@Timmmm Timmmm linked a pull request Mar 7, 2025 that will close this issue
@jordancarlin jordancarlin added the bug Something isn't working label Mar 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants