diff --git a/repos/os/include/spec/arm/platform_session/device.h b/repos/os/include/spec/arm/platform_session/device.h index aa17d16e83..84ea085b4f 100644 --- a/repos/os/include/spec/arm/platform_session/device.h +++ b/repos/os/include/spec/arm/platform_session/device.h @@ -86,6 +86,11 @@ class Platform::Device::Mmio : Range, Attached_dataspace, public Genode::Mmio return io_mem.dataspace(); } + addr_t _local_addr() + { + return (addr_t)Attached_dataspace::local_addr() + Range::start; + } + public: struct Index { unsigned value; }; @@ -93,7 +98,7 @@ class Platform::Device::Mmio : Range, Attached_dataspace, public Genode::Mmio Mmio(Device &device, Index index) : Attached_dataspace(device._rm(), _ds_cap(device, index.value)), - Genode::Mmio((addr_t)(local_addr() + Range::start)) + Genode::Mmio(_local_addr()) { } explicit Mmio(Device &device) : Mmio(device, Index { 0 }) { } @@ -101,11 +106,7 @@ class Platform::Device::Mmio : Range, Attached_dataspace, public Genode::Mmio size_t size() const { return Range::size; } template - T *local_addr() - { - void *ptr = Attached_dataspace::local_addr() + Range::start; - return reinterpret_cast(ptr); - } + T *local_addr() { return reinterpret_cast(_local_addr()); } };