Commit 0bf9d336 authored by Andrew Boie's avatar Andrew Boie Committed by Andrew Boie
Browse files

mem_domain: inherit from parent thread



New threads inherit any memory domain membership held by the
parent thread.

Signed-off-by: default avatarAndrew Boie <andrew.p.boie@intel.com>
parent fb4dfa9d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -23,7 +23,8 @@ Memory partitions are defined by a set of underlying MPU regions
or MMU tables. A thread belongs to a single memory domain at
any point in time but a memory domain may contain multiple threads.
Threads in the same memory domain have the same access permissions
to the memory partitions belong to the memory domain.
to the memory partitions belonging to the memory domain. New threads
will inherit any memory domain configuration from the parent thread.

Implementation
**************
+6 −0
Original line number Diff line number Diff line
@@ -273,6 +273,12 @@ void _setup_new_thread(struct k_thread *new_thread,
	/* Any given thread has access to itself */
	k_object_access_grant(new_thread, new_thread);

	/* New threads inherit any memory domain membership by the parent */
	if (_current->mem_domain_info.mem_domain) {
		k_mem_domain_add_thread(_current->mem_domain_info.mem_domain,
					new_thread);
	}

	if (options & K_INHERIT_PERMS) {
		_thread_perms_inherit(_current, new_thread);
	}