Closed msingla403 closed 2 years ago
There's nothing like SUM needed in this case. My best guess is that the physical address is incorrect. (0x408001f480
is very large; it suggests you've configured Spike to use more than 512 GiB of memory.)
Yes, the physical address is wrong. I used kva2pa
to convert the user-space virtual address to the physical address. As the kernel and user-space are present in the same virtual address space, I assumed kva2pa
should work.
I will have to use walk
on page tables to get the correct physical address. Is there any other way? kva2pa
works for kernel-space virtual address as the kernel is present at constant offset.
kva2pa
only works on kernel virtual addresses. walk
is the way to go.
I am able to access user space contents. Used walk
to retrieve physical address.
I am trying to print a string from machine mode. The string is stored in user mode space.
In user space:
buff : "Hello World\n" &buff (virtual address in user space)=
0x000000000001f480
In machine mode:
addr = Physical address of buff =
0x000000408001f480
printm("%s"\n", addr);
leads to exception trap_load_access_faultPMP entries:
By default in
PK
, PMP are set to permit access to all of memory.Does anyone know of the issue? To access user space from Supervisor mode, we need to set
SUM
bit inmstatus
. Are there any similar permission settings that I need to set? Or is there any another way to do this?Thanks in advance