From 5d9d3bff119c6946f31f6332be15986a3f576518 Mon Sep 17 00:00:00 2001 From: Christian Prochaska Date: Thu, 9 Nov 2023 20:48:12 +0100 Subject: [PATCH] acpi_drv: detach dataspaces in 'Acpi::Memory' Issue #5046 --- repos/os/src/drivers/acpi/memory.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/repos/os/src/drivers/acpi/memory.h b/repos/os/src/drivers/acpi/memory.h index 01e8f09d5e..63b66e8a7e 100644 --- a/repos/os/src/drivers/acpi/memory.h +++ b/repos/os/src/drivers/acpi/memory.h @@ -91,9 +91,10 @@ class Acpi::Memory Env &_env; Allocator &_heap; - Rm_connection _rm { _env }; - Region_map_client _acpi_window { _rm.create(ACPI_REGION_SIZE) }; - addr_t const _acpi_base { _env.rm().attach(_acpi_window.dataspace()) }; + Rm_connection _rm { _env }; + Region_map_client _acpi_window { _rm.create(ACPI_REGION_SIZE) }; + Attached_dataspace _acpi_window_ds { _env.rm(), _acpi_window.dataspace() }; + addr_t const _acpi_base { (addr_t)_acpi_window_ds.local_addr()}; Constructible _io_region { }; @@ -162,6 +163,7 @@ class Acpi::Memory addr_t const compound_end = max(loop_region.base() + loop_region.size(), region_base + region_size); + _acpi_window.detach(region_base - _io_region->base()); m->~Io_mem(); _range.free((void *)region_base); @@ -194,6 +196,7 @@ class Acpi::Memory { addr_t out_addr = 0; while (_range.any_block_addr(&out_addr)) { + _acpi_window.detach(out_addr - _io_region->base()); _range.metadata((void *)out_addr)->~Io_mem(); _range.free((void *)out_addr); }