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/internal/syscall_handler.h>
#include <zephyr/ztest.h>
#include <zephyr/linker/linker-defs.h>
#include "test_syscalls.h"
#include <mmu.h>
#include <zephyr/syscalls/string_nlen_mrsh.c>
#include <zephyr/syscalls/string_alloc_copy_mrsh.c>
#include <zephyr/syscalls/string_copy_mrsh.c>
#include <zephyr/syscalls/to_copy_mrsh.c>
#include <zephyr/syscalls/syscall_arg64_mrsh.c>
#include <zephyr/syscalls/syscall_arg64_big_mrsh.c>
#include <zephyr/syscalls/more_args_mrsh.c>
#include <zephyr/syscalls/syscall_context_mrsh.c>

Macros

#define BUF_SIZE   32
 
#define SLEEP_MS_LONG   15000
 
#define FAULTY_ADDRESS   K_MEM_VM_FREE_START
 
#define NR_THREADS   (arch_num_cpus() * 4)
 
#define MAX_NR_THREADS   (CONFIG_MP_MAX_NUM_CPUS * 4)
 
#define STACK_SZ   (1024 + CONFIG_TEST_EXTRA_STACK_SIZE)
 

Functions

void k_sys_fatal_error_handler (unsigned int reason, const struct arch_esf *pEsf)
 Fatal error policy handler.
 
 ZTEST_USER (syscalls, test_string_nlen)
 Test to demonstrate usage of k_usermode_string_nlen()
 
 ZTEST_USER (syscalls, test_user_string_alloc_copy)
 Test to verify syscall for string alloc copy.
 
 ZTEST_USER (syscalls, test_user_string_copy)
 Test sys_call for string copy.
 
 ZTEST_USER (syscalls, test_to_copy)
 Test to demonstrate system call for copy.
 
void run_test_arg64 (void)
 
 ZTEST_USER (syscalls, test_arg64)
 
 ZTEST_USER (syscalls, test_more_args)
 
 K_THREAD_STACK_ARRAY_DEFINE (torture_stacks,(CONFIG_MP_MAX_NUM_CPUS *4),(1024+CONFIG_TEST_EXTRA_STACK_SIZE))
 
void syscall_torture (void *arg1, void *arg2, void *arg3)
 
 ZTEST (syscalls, test_syscall_torture)
 
void test_syscall_context_user (void *p1, void *p2, void *p3)
 
 ZTEST (syscalls, test_syscall_context)
 
 K_HEAP_DEFINE (test_heap, 32 *(4 *(CONFIG_MP_MAX_NUM_CPUS *4)))
 
void * syscalls_setup (void)
 
 ZTEST_SUITE (syscalls, NULL, syscalls_setup, NULL, NULL, NULL)
 

Variables

char kernel_string [32]
 
char kernel_buf [32]
 
ZTEST_BMEM char user_string [32]
 
struct k_thread torture_threads [(CONFIG_MP_MAX_NUM_CPUS *4)]
 

Macro Definition Documentation

◆ BUF_SIZE

#define BUF_SIZE   32

◆ FAULTY_ADDRESS

#define FAULTY_ADDRESS   K_MEM_VM_FREE_START

◆ MAX_NR_THREADS

#define MAX_NR_THREADS   (CONFIG_MP_MAX_NUM_CPUS * 4)

◆ NR_THREADS

#define NR_THREADS   (arch_num_cpus() * 4)

◆ SLEEP_MS_LONG

#define SLEEP_MS_LONG   15000

◆ STACK_SZ

#define STACK_SZ   (1024 + CONFIG_TEST_EXTRA_STACK_SIZE)

Function Documentation

◆ K_HEAP_DEFINE()

K_HEAP_DEFINE ( test_heap  ,
32 *  4 *(CONFIG_MP_MAX_NUM_CPUS *4) 
)

◆ K_THREAD_STACK_ARRAY_DEFINE()

K_THREAD_STACK_ARRAY_DEFINE ( torture_stacks  ,
(CONFIG_MP_MAX_NUM_CPUS *4)  ,
(1024+CONFIG_TEST_EXTRA_STACK_SIZE)   
)

◆ run_test_arg64()

void run_test_arg64 ( void  )

◆ syscall_torture()

void syscall_torture ( void *  arg1,
void *  arg2,
void *  arg3 
)

◆ syscalls_setup()

void * syscalls_setup ( void  )

◆ test_syscall_context_user()

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

◆ ZTEST() [1/2]

ZTEST ( syscalls  ,
test_syscall_context   
)

◆ ZTEST() [2/2]

ZTEST ( syscalls  ,
test_syscall_torture   
)

◆ ZTEST_SUITE()

ZTEST_SUITE ( syscalls  ,
NULL  ,
syscalls_setup  ,
NULL  ,
NULL  ,
NULL   
)

◆ ZTEST_USER() [1/6]

ZTEST_USER ( syscalls  ,
test_arg64   
)

◆ ZTEST_USER() [2/6]

ZTEST_USER ( syscalls  ,
test_more_args   
)

◆ ZTEST_USER() [3/6]

ZTEST_USER ( syscalls  ,
test_string_nlen   
)

Test to demonstrate usage of k_usermode_string_nlen()

The test will be called from user mode and kernel mode to check the behavior of k_usermode_string_nlen()

See also
k_usermode_string_nlen()

◆ ZTEST_USER() [4/6]

ZTEST_USER ( syscalls  ,
test_to_copy   
)

Test to demonstrate system call for copy.

See also
memcpy(), k_usermode_to_copy()

◆ ZTEST_USER() [5/6]

ZTEST_USER ( syscalls  ,
test_user_string_alloc_copy   
)

Test to verify syscall for string alloc copy.

See also
k_usermode_string_alloc_copy(), strcmp()

◆ ZTEST_USER() [6/6]

ZTEST_USER ( syscalls  ,
test_user_string_copy   
)

Test sys_call for string copy.

See also
k_usermode_string_copy(), strcmp()

Variable Documentation

◆ kernel_buf

char kernel_buf[32]

◆ kernel_string

char kernel_string[32]

◆ torture_threads

struct k_thread torture_threads[(CONFIG_MP_MAX_NUM_CPUS *4)]

◆ user_string

ZTEST_BMEM char user_string[32]