Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
main.c File Reference
#include <zephyr/kernel.h>
#include <zephyr/ztest.h>
#include <zephyr/internal/syscall_handler.h>
#include <kernel_internal.h>
#include "test_syscall.h"
#include <zephyr/syscalls/stack_info_get_mrsh.c>
#include <zephyr/syscalls/check_perms_mrsh.c>

Data Structures

struct  foo
 
struct  scenario_data
 

Macros

#define NUM_STACKS   3
 
#define STEST_STACKSIZE   (512 + CONFIG_TEST_EXTRA_STACK_SIZE)
 

Functions

 K_THREAD_STACK_DEFINE (user_stack,(512+CONFIG_TEST_EXTRA_STACK_SIZE))
 
 K_THREAD_STACK_ARRAY_DEFINE (user_stack_array, 3,(512+CONFIG_TEST_EXTRA_STACK_SIZE))
 
 K_KERNEL_STACK_DEFINE (kern_stack,(512+CONFIG_TEST_EXTRA_STACK_SIZE))
 
 K_KERNEL_STACK_ARRAY_DEFINE (kern_stack_array, 3,(512+CONFIG_TEST_EXTRA_STACK_SIZE))
 
void stack_buffer_scenarios (void)
 
void stest_thread_entry (void *p1, void *p2, void *p3)
 
void stest_thread_launch (uint32_t flags, bool drop)
 
void scenario_entry (void *stack_obj, size_t obj_size, size_t reported_size, size_t declared_size, bool is_array)
 
 ZTEST (userspace_thread_stack, test_stack_buffer)
 Test kernel provides user thread read/write access to its own stack memory buffer.
 
void no_op_entry (void *p1, void *p2, void *p3)
 
 ZTEST (userspace_thread_stack, test_idle_stack)
 Show that the idle thread stack size is correct.
 
void * thread_setup (void)
 
 ZTEST_SUITE (userspace_thread_stack, NULL, thread_setup, ztest_simple_1cpu_before, ztest_simple_1cpu_after, NULL)
 

Variables

struct k_thread test_thread
 
__kstackmem struct foo stest_member_stack
 
ZTEST_BMEM struct scenario_data scenario_data
 

Macro Definition Documentation

◆ NUM_STACKS

#define NUM_STACKS   3

◆ STEST_STACKSIZE

#define STEST_STACKSIZE   (512 + CONFIG_TEST_EXTRA_STACK_SIZE)

Function Documentation

◆ K_KERNEL_STACK_ARRAY_DEFINE()

K_KERNEL_STACK_ARRAY_DEFINE ( kern_stack_array  ,
,
(512+CONFIG_TEST_EXTRA_STACK_SIZE)   
)

◆ K_KERNEL_STACK_DEFINE()

K_KERNEL_STACK_DEFINE ( kern_stack  ,
(512+CONFIG_TEST_EXTRA_STACK_SIZE)   
)

◆ K_THREAD_STACK_ARRAY_DEFINE()

K_THREAD_STACK_ARRAY_DEFINE ( user_stack_array  ,
,
(512+CONFIG_TEST_EXTRA_STACK_SIZE)   
)

◆ K_THREAD_STACK_DEFINE()

K_THREAD_STACK_DEFINE ( user_stack  ,
(512+CONFIG_TEST_EXTRA_STACK_SIZE)   
)

◆ no_op_entry()

void no_op_entry ( void *  p1,
void *  p2,
void *  p3 
)

◆ scenario_entry()

void scenario_entry ( void *  stack_obj,
size_t  obj_size,
size_t  reported_size,
size_t  declared_size,
bool  is_array 
)

◆ stack_buffer_scenarios()

void stack_buffer_scenarios ( void  )

◆ stest_thread_entry()

void stest_thread_entry ( void *  p1,
void *  p2,
void *  p3 
)

◆ stest_thread_launch()

void stest_thread_launch ( uint32_t  flags,
bool  drop 
)

◆ thread_setup()

void * thread_setup ( void  )

◆ ZTEST() [1/2]

ZTEST ( userspace_thread_stack  ,
test_idle_stack   
)

Show that the idle thread stack size is correct.

The idle thread has to occasionally clean up self-exiting threads. Exercise this and show that we didn't overflow, reporting out stack usage.

◆ ZTEST() [2/2]

ZTEST ( userspace_thread_stack  ,
test_stack_buffer   
)

Test kernel provides user thread read/write access to its own stack memory buffer.

Thread can access its own stack memory buffer and perform read/write operations.

◆ ZTEST_SUITE()

ZTEST_SUITE ( userspace_thread_stack  ,
NULL  ,
thread_setup  ,
ztest_simple_1cpu_before  ,
ztest_simple_1cpu_after  ,
NULL   
)

Variable Documentation

◆ scenario_data

◆ stest_member_stack

__kstackmem struct foo stest_member_stack

◆ test_thread

struct k_thread test_thread