Zephyr Project API 3.7.0
A Scalable Open Source RTOS
|
#include "mem_protect.h"
#include <zephyr/internal/syscall_handler.h>
#include <zephyr/sys/libc-hooks.h>
#include <zephyr/syscalls/ret_resource_pool_ptr_mrsh.c>
Functions | |
static void | dummy_start (struct k_timer *timer) |
static void | dummy_end (struct k_timer *timer) |
K_THREAD_STACK_DEFINE (test_1_stack, CONFIG_MAIN_STACK_SIZE) | |
K_THREAD_STACK_DEFINE (parent_thr_stack,(512+CONFIG_TEST_EXTRA_STACK_SIZE)) | |
K_THREAD_STACK_DEFINE (child_thr_stack,(512+CONFIG_TEST_EXTRA_STACK_SIZE)) | |
K_HEAP_DEFINE (heap_mem, 64 *2) | |
K_SEM_DEFINE (inherit_sem,(0),(10)) | |
K_SEM_DEFINE (sync_sem,(0U),(1U)) | |
K_MUTEX_DEFINE (inherit_mutex) | |
K_TIMER_DEFINE (inherit_timer, dummy_start, dummy_end) | |
K_MSGQ_DEFINE (inherit_msgq,(10),(10),(2)) | |
K_MEM_PARTITION_DEFINE (inherit_memory_partition, inherit_buf, sizeof(inherit_buf), K_MEM_PARTITION_P_RW_U_RW) | |
static void | access_test (void) |
static void | test_thread_1_for_user (void *p1, void *p2, void *p3) |
static void | test_thread_1_for_SU (void *p1, void *p2, void *p3) |
ZTEST (mem_protect, test_permission_inheritance) | |
Test object permission inheritance except of the parent thread object. | |
void | child_handler (void *p1, void *p2, void *p3) |
void | parent_handler (void *p1, void *p2, void *p3) |
ZTEST (mem_protect, test_inherit_resource_pool) | |
Test child thread inherits parent's thread resource pool. | |
void | mem_protect_inhert_setup (void) |
K_HEAP_DEFINE (test_mem_heap,(2<< CONFIG_MAX_THREAD_BYTES) *256) | |
void * | mem_protect_setup (void) |
ZTEST_SUITE (mem_protect, NULL, mem_protect_setup, NULL, NULL, NULL) | |
Variables | |
struct k_thread test_1_tid parent_thr | child_thr |
k_tid_t | parent_tid |
uint8_t | inherit_buf [MEM_REGION_ALLOC] |
struct k_mem_partition * | inherit_memory_partition_array [] |
struct k_mem_domain | inherit_mem_domain |
struct k_heap * | child_heap_mem_ptr |
struct k_heap * | parent_heap_mem_ptr |
|
static |
void child_handler | ( | void * | p1, |
void * | p2, | ||
void * | p3 | ||
) |
|
inlinestatic |
|
inlinestatic |
K_HEAP_DEFINE | ( | heap_mem | , |
64 * | 2 | ||
) |
K_HEAP_DEFINE | ( | test_mem_heap | , |
(2<< CONFIG_MAX_THREAD_BYTES) * | 256 | ||
) |
K_MEM_PARTITION_DEFINE | ( | inherit_memory_partition | , |
inherit_buf | , | ||
sizeof(inherit_buf) | , | ||
K_MEM_PARTITION_P_RW_U_RW | |||
) |
K_MSGQ_DEFINE | ( | inherit_msgq | , |
(10) | , | ||
(10) | , | ||
(2) | |||
) |
K_MUTEX_DEFINE | ( | inherit_mutex | ) |
K_SEM_DEFINE | ( | inherit_sem | , |
(0) | , | ||
(10) | |||
) |
K_SEM_DEFINE | ( | sync_sem | , |
(0U) | , | ||
(1U) | |||
) |
K_THREAD_STACK_DEFINE | ( | child_thr_stack | , |
(512+CONFIG_TEST_EXTRA_STACK_SIZE) | |||
) |
K_THREAD_STACK_DEFINE | ( | parent_thr_stack | , |
(512+CONFIG_TEST_EXTRA_STACK_SIZE) | |||
) |
K_THREAD_STACK_DEFINE | ( | test_1_stack | , |
CONFIG_MAIN_STACK_SIZE | |||
) |
K_TIMER_DEFINE | ( | inherit_timer | , |
dummy_start | , | ||
dummy_end | |||
) |
void mem_protect_inhert_setup | ( | void | ) |
void * mem_protect_setup | ( | void | ) |
void parent_handler | ( | void * | p1, |
void * | p2, | ||
void * | p3 | ||
) |
|
static |
|
static |
ZTEST | ( | mem_protect | , |
test_inherit_resource_pool | |||
) |
Test child thread inherits parent's thread resource pool.
ZTEST | ( | mem_protect | , |
test_permission_inheritance | |||
) |
Test object permission inheritance except of the parent thread object.
ZTEST_SUITE | ( | mem_protect | , |
NULL | , | ||
mem_protect_setup | , | ||
NULL | , | ||
NULL | , | ||
NULL | |||
) |
struct k_heap* child_heap_mem_ptr |
struct k_thread test_1_tid parent_thr child_thr |
uint8_t inherit_buf[MEM_REGION_ALLOC] |
struct k_mem_domain inherit_mem_domain |
struct k_mem_partition* inherit_memory_partition_array[] |
struct k_heap* parent_heap_mem_ptr |
k_tid_t parent_tid |