platform_drv: move add_range calls from base class

The virtual add_range()-method must not be called from the base-class
constructor since the derived class is not be fully initialized at
this point.

This commit is contained in:
Johannes Schlatow 2023-09-07 16:58:24 +02:00
parent 022762605b
commit d7b9cd0654
2 changed files with 5 additions and 7 deletions
repos/os/src/drivers/platform

@ -154,4 +154,7 @@ Device_pd::Device_pd(Env & env,
_address_space(env, _pd, ram_guard, cap_guard)
{
_pd.ref_account(env.pd_session_cap());
buffer_registry.for_each([&] (Dma_buffer const & buf) {
add_range({ buf.dma_addr, buf.size }, buf.cap); });
}

@ -88,15 +88,10 @@ class Driver::Io_mmu : private Io_mmu_devices::Element
virtual void remove_range(Range const &) = 0;
Domain(Io_mmu & io_mmu,
Allocator & md_alloc,
Registry<Dma_buffer> const & buffer_registry)
Allocator & md_alloc)
: Registry<Domain>::Element(io_mmu._domains, *this),
_io_mmu(io_mmu), _md_alloc(md_alloc)
{
/* we always need to add existing buffers when creating a new domain */
buffer_registry.for_each([&] (Dma_buffer const & buf) {
add_range({ buf.dma_addr, buf.size }, buf.cap); });
}
{ }
virtual ~Domain() { }
};