On 7/1/2023 11:38 PM, Abdlerhman Abotaleb via gem5-users wrote:
How can I share a variable between multicores in GEM5. (I'm simulating RISCV-
Cores)
I can see that each core allocates different VPN to PFN translation.
So even if I explicitly assign a memory address to a variable (i.e. char*arr = 0x20010 then
dereference it later) it will be in different physical memory location for each core.
Do you have an idea how to do it from the source code?
Thank you.
My thinking is that it's no different under gem5 than under Linux. Ways
I can think of:
- Map a file of appropriate size shared; put the variable at a fixed offset
in the mapped region.
- Similarly for shared memory (shmem).
If you care, the file might be from a file system that is actually kept
in a chunk of physical memory.
The only other thing I can imagine is setting up a new device for which
you write a driver, and that driver maps a kernel and gives access to it,
allowing it to be mapped. But that's more complicated and more work than
just sharing an ordinary page.
Regards - Eliot Moss
_______________________________________________
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org