mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-10 19:31:48 +00:00
Disambiguate Mmio::local_addr
This is a follow-up fix for "Streamline platform-device API on ARM". There is an ambiguity of the 'local_addr' method between the inherited 'Attached_dataspace' and the local declaration, which results in the double application of the sub-page Range::start. Issue #4075
This commit is contained in:
parent
173264ed1e
commit
ace7c9172b
@ -86,6 +86,11 @@ class Platform::Device::Mmio : Range, Attached_dataspace, public Genode::Mmio
|
|||||||
return io_mem.dataspace();
|
return io_mem.dataspace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addr_t _local_addr()
|
||||||
|
{
|
||||||
|
return (addr_t)Attached_dataspace::local_addr<char>() + Range::start;
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
struct Index { unsigned value; };
|
struct Index { unsigned value; };
|
||||||
@ -93,7 +98,7 @@ class Platform::Device::Mmio : Range, Attached_dataspace, public Genode::Mmio
|
|||||||
Mmio(Device &device, Index index)
|
Mmio(Device &device, Index index)
|
||||||
:
|
:
|
||||||
Attached_dataspace(device._rm(), _ds_cap(device, index.value)),
|
Attached_dataspace(device._rm(), _ds_cap(device, index.value)),
|
||||||
Genode::Mmio((addr_t)(local_addr<char>() + Range::start))
|
Genode::Mmio(_local_addr())
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
explicit Mmio(Device &device) : Mmio(device, Index { 0 }) { }
|
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; }
|
size_t size() const { return Range::size; }
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T *local_addr()
|
T *local_addr() { return reinterpret_cast<T *>(_local_addr()); }
|
||||||
{
|
|
||||||
void *ptr = Attached_dataspace::local_addr<char>() + Range::start;
|
|
||||||
return reinterpret_cast<T *>(ptr);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user