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

Is pk preventing me from accessing certain address in simulation by Spike? #289

Open
Z-KN opened this issue Jan 26, 2023 · 1 comment
Open

Comments

@Z-KN
Copy link

Z-KN commented Jan 26, 2023

When I write assembly code and C code for the same functionality that are simulated by spike, it turns out that assembly code can access MMIO device address but C code cannot. The source code is at riscv-software-src/riscv-isa-sim#1238.

I wonder if it is pk, that runs the RISCV program in a user mode, that prevents accesses of PMP and paticular address like external device's memory and registers. If it is, can I modify source code of pk to enable the access?

@aswaterman
Copy link
Collaborator

Correct, PK has a demand-paged virtual memory system, and so the addresses in the program don’t directly correspond to physical addresses. And only main memory can be accessed from the user program; there is no means to access MMIO.

If this restriction is a problem for your use case, you shouldn’t use PK.

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