Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
mem_protect.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017, 2020 Intel Corporation
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#include <zephyr/kernel.h>
8#include <zephyr/ztest.h>
10#include <string.h>
11#include <stdlib.h>
12
13/* Flag needed to figure out if the fault was expected or not. */
14extern volatile bool valid_fault;
15
16static inline void set_fault_valid(bool valid)
17{
18 valid_fault = valid;
19 /* Put a barrier here, such that no instructions get ordered by the
20 * compiler before we set valid_fault. This can happen with expansion
21 * of inline syscall invocation functions.
22 */
23 compiler_barrier();
24}
25
26/* For inherit.c */
27#define INHERIT_STACK_SIZE CONFIG_MAIN_STACK_SIZE
28#define SEMAPHORE_MAX_COUNT (10)
29#define SEMAPHORE_INIT_COUNT (0)
30#define SYNC_SEM_MAX_COUNT (1)
31#define SYNC_SEM_INIT_COUNT (0)
32#define MSG_Q_SIZE (10)
33#define MSG_Q_MAX_NUM_MSGS (10)
34#define MSG_Q_ALIGN (2)
35#define PRIORITY 5
36#define STACK_SIZE (512 + CONFIG_TEST_EXTRA_STACK_SIZE)
37#define BLK_SIZE_MIN 16
38#define BLK_SIZE_MAX 64
39#define BLK_NUM_MIN 8
40#define BLK_NUM_MAX 2
41#define BLK_ALIGN BLK_SIZE_MIN
42#define SEM_INIT_VAL (0U)
43#define SEM_MAX_VAL (1U)
44
45/* For mem_domain.c */
46#define MEM_DOMAIN_STACK_SIZE CONFIG_MAIN_STACK_SIZE
47#define MEM_PARTITION_INIT_NUM (1)
48#define BLK_SIZE_MIN_MD 8
49#define BLK_SIZE_MAX_MD 16
50#define BLK_NUM_MAX_MD 4
51#define BLK_ALIGN_MD BLK_SIZE_MIN_MD
52#define DESC_SIZE sizeof(struct sys_mem_pool_block)
53#define STACK_SIZE_MD (512 + CONFIG_TEST_EXTRA_STACK_SIZE)
54#define PRIORITY_MD 5
55
56#if defined(CONFIG_X86)
57#define MEM_REGION_ALLOC (4096)
58#elif defined(CONFIG_ARC)
59#define MEM_REGION_ALLOC (Z_ARC_MPU_ALIGN)
60#elif defined(CONFIG_ARM64)
61#define MEM_REGION_ALLOC (4096)
62#elif defined(CONFIG_ARM)
63#define MEM_REGION_ALLOC (Z_THREAD_MIN_STACK_ALIGN)
64#elif defined(CONFIG_RISCV)
65#if defined(CONFIG_RISCV_PMP)
66#define MEM_REGION_ALLOC (CONFIG_PMP_GRANULARITY)
67#else
68#define MEM_REGION_ALLOC (4)
69#endif
70#elif defined(CONFIG_XTENSA)
71#define MEM_REGION_ALLOC (4096)
72#else
73#error "Test suite not compatible for the given architecture"
74#endif
75#define MEM_DOMAIN_ALIGNMENT __aligned(MEM_REGION_ALLOC)
76
77/* for kobject.c */
78#define KOBJECT_STACK_SIZE (512 + CONFIG_TEST_EXTRA_STACK_SIZE)
79
80
81
82#if (defined(CONFIG_X86_64) || defined(CONFIG_ARM64) || \
83 (defined(CONFIG_RISCV) && defined(CONFIG_64BIT)))
84#define TEST_HEAP_SIZE (2 << CONFIG_MAX_THREAD_BYTES) * 1024
85#define MAX_OBJ 512
86#else
87#define TEST_HEAP_SIZE (2 << CONFIG_MAX_THREAD_BYTES) * 256
88#define MAX_OBJ 256
89#endif
90
91#ifndef _TEST_SYSCALLS_H_
92#define _TEST_SYSCALLS_H_
93
94__syscall struct k_heap *ret_resource_pool_ptr(void);
95
96#include <zephyr/syscalls/mem_protect.h>
97
98#endif /* _TEST_SYSCALLS_H_ */
Public kernel APIs.
static void set_fault_valid(bool valid)
Definition mem_protect.h:16
volatile bool valid_fault
Definition common.c:9
struct k_heap * ret_resource_pool_ptr(void)
Definition kernel.h:5320
Zephyr Testsuite.