Write to specific memory address

Stefan Kalkowski stefan.kalkowski at ...1...
Mon Mar 23 09:27:00 CET 2015


Hello Vincent,

On 03/20/2015 11:40 AM, Vincent Raes wrote:
> Hello,
> 
> I am working with TrustZone using Genode and I am trying to pass data
> from the secure world to the normal world and vice versa. The problem
> lies with the fact that the normal world can only access a certain part
> of the RAM memory the board has to offer so all the data I want to give
> to the normal world has to be placed somewhere it can access. And I
> can't seem to figure out how to place data at a specific address using
> Genode.
> 
> When I try to use pointers to the wanted memory location, the error "No
> RM attachment" keeps popping up. This may very well be caused by the
> fact I am using a pointer to a place that does not yet has a valid data
> object in it. I believe the correct answer has something to do with the
> use of dataspaces but am not sure how or what kind of dataspace I need
> to use for random data I generate myself.

To me it seems you first have to understand the difference between
virtual memory and physical memory. When using memory addresses in a
normal application (and even mostly in the kernel) you are dealing with
virtual memory addresses that are translated in hardware via the MMU to
physical memory addresses. If you target a memory region that does not
relate to a valid translation entry in the translation table of the
process, you will get a translation fault. That is what you see with the
message "No RM attachment". In Genode the RM session is used to
administrate the virtual memory address space of a process.

In contrast to that: the bus system, and the memory controller are
dealing with physical memory addresses, and probably the TrustZone
component that splits the memory in normal and secure one too. If you
say that the normal world can access only a specific portion of RAM, you
speak about a physical address range.

Your intuition was right: in Genode a portion of RAM is abstracted by a
dataspace. In general a RAM dataspace is just an anonymous amount of
RAM, where you do cannot determine its location in physical memory when
allocating it. In contrast to a RAM dataspace, you can also use an IOMEM
session to request a specific dataspace, normally used for memory-mapped
I/O regions of devices. When allocating an IOMEM region of course you
can and have to specify the actual physical location. So in your case,
the only possibility to deposit data at a specific RAM location for the
normal world is to open up an IOMEM session, and attach its dataspace to
the RM session of your application.

BTW: the same was done in our TrustZone example virtual machine monitor
implmentation (repos/os/src/server/tz_vmm).

Regards
Stefan

> 
> Thanks in advance for any advice.
> 
> Best regards,
> Vincent
> 
> 
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website, sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for all
> things parallel software development, from weekly thought leadership blogs to
> news, videos, case studies, tutorials and more. Take a look and join the 
> conversation now. http://goparallel.sourceforge.net/
> 
> 
> 
> _______________________________________________
> genode-main mailing list
> genode-main at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/genode-main
> 

-- 
Stefan Kalkowski
Genode Labs

http://www.genode-labs.com/ ยท http://genode.org/




More information about the users mailing list