Is pk preventing me from accessing certain address in simulation by Spike?
Z-KN opened this issue · 1 comments
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?
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.