Skip to content

Commit 8d910b3

Browse files
AdithyaBaglodyandrewboie
authored andcommitted
kernel: Arch specific memory domain APIs added
Added arch specific calls to handle memory domain destroy and removal of partition. GH-3852 Signed-off-by: Adithya Baglody <[email protected]>
1 parent a8b9353 commit 8d910b3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

kernel/mem_domain.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
static u8_t max_partitions;
1414

15-
1615
void k_mem_domain_init(struct k_mem_domain *domain, u32_t num_parts,
1716
struct k_mem_partition *parts[])
1817
{
@@ -49,6 +48,11 @@ void k_mem_domain_destroy(struct k_mem_domain *domain)
4948

5049
key = irq_lock();
5150

51+
/* Handle architecture specifc destroy only if it is the current thread*/
52+
if (_current->mem_domain_info.mem_domain == domain) {
53+
_arch_mem_domain_destroy(domain);
54+
}
55+
5256
SYS_DLIST_FOR_EACH_NODE_SAFE(&domain->mem_domain_q, node, next_node) {
5357
struct k_thread *thread =
5458
CONTAINER_OF(node, struct k_thread, mem_domain_info);
@@ -111,6 +115,11 @@ void k_mem_domain_remove_partition(struct k_mem_domain *domain,
111115
/* Assert if not found */
112116
__ASSERT(p_idx < max_partitions, "");
113117

118+
/* Handle architecture specifc remove only if it is the current thread*/
119+
if (_current->mem_domain_info.mem_domain == domain) {
120+
_arch_mem_domain_remove_partition(domain, p_idx);
121+
}
122+
114123
domain->partitions[p_idx].start = 0;
115124
domain->partitions[p_idx].size = 0;
116125
domain->partitions[p_idx].attr = 0;

0 commit comments

Comments
 (0)