vmm: ARMv8 add 'local_address' to Ram_allocator

Ref #3620
This commit is contained in:
Sebastian Sumpf 2019-10-21 14:17:17 +02:00 committed by Christian Helmuth
parent 7780ee6a34
commit c8b3b060aa
1 changed files with 11 additions and 0 deletions

View File

@ -15,6 +15,7 @@
#define _SRC__SERVER__VMM__RAM_H_
#include <base/stdint.h>
#include <exception.h>
class Ram {
@ -34,6 +35,16 @@ class Ram {
Genode::addr_t base() const { return _base; }
Genode::size_t size() const { return _size; }
Genode::addr_t local() const { return _local; }
Genode::addr_t local_address(Genode::addr_t guest, Genode::size_t size)
{
if (guest < _base || guest >= _base + _size ||
size == 0 || guest + size >= _base + _size)
throw Vmm::Exception("Invalid guest physical address: ",
Genode::Hex(guest), " size: ", Genode::Hex(size));
return _local + (guest - _base);
}
};
#endif /* _SRC__SERVER__VMM__RAM_H_ */