Commit 1a9f4903 authored by Andrew Boie's avatar Andrew Boie Committed by Anas Nashif
Browse files

userspace: deprecate k_mem_domain_destroy()



We don't have use-cases and it introduces complexities with
allocating page tables on MMU systems.

Signed-off-by: default avatarAndrew Boie <andrew.p.boie@intel.com>
parent 99f24aea
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
#include <stdint.h>
#include <stddef.h>
#include <sys/dlist.h>
#include <toolchain.h>

/* Forward declaration */
struct k_thread;
@@ -118,6 +119,7 @@ extern void k_mem_domain_init(struct k_mem_domain *domain, uint8_t num_parts,
 *
 * @param domain The memory domain to be destroyed.
 */
__deprecated
extern void k_mem_domain_destroy(struct k_mem_domain *domain);

/**
+0 −32
Original line number Diff line number Diff line
@@ -565,35 +565,3 @@ void test_mem_domain_remove_thread(void *p1, void *p2, void *p3)
				 NULL, NULL, NULL);

}
/****************************************************************************/

/**
 * @brief Test memory domain destroy, which removes all thread assignments to it
 *
 * @details Test k_mem_domain_destroy API
 *
 * @ingroup kernel_memprotect_tests
 *
 * @see k_mem_domain_add_thread(), k_mem_domain_destroy()
 * */
void test_mem_domain_destroy(void)
{
	k_mem_domain_init(&mem_domain1,
			  ARRAY_SIZE(mem_domain_memory_partition_array1),
			  mem_domain_memory_partition_array1);
	k_mem_domain_remove_thread(k_current_get());

	k_mem_domain_add_thread(&mem_domain1, k_current_get());

	k_tid_t tid = k_current_get();

	if (tid->mem_domain_info.mem_domain == &mem_domain1) {
		k_mem_domain_destroy(&mem_domain1);

		zassert_true(tid->mem_domain_info.mem_domain !=
			     &mem_domain1, "The thread has reference to"
			     " memory domain which is already destroyed");
	} else {
		zassert_unreachable("k_mem_domain_add_thread() failed");
	}
}