1 /*
2  * Copyright (c) 2024 Intel Corporation.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 /*
8  * This code demonstrates syscall support.
9  */
10 
11  /* This include directive must appear first in the file.
12   *
13   * On x86 platforms with demand paging on, Zephyr generates a
14   * .pinned_text section containing syscalls. The LLEXT loader
15   * requires .text-like sections to appear close to .text at the
16   * start of the object file, before .rodata, so they can be
17   * grouped into a contiguous text region.
18   *
19   * Including syscalls_ext.h first ensures the first instance of
20   * data to be placed in .pinned_text appears before the first instance
21   * of data for .rodata. As a result, .pinned_text will appear
22   * before .rodata.
23   */
24 #include "syscalls_ext.h"
25 
26 #include <zephyr/llext/symbol.h>
27 #include <zephyr/sys/printk.h>
28 #include <zephyr/ztest_assert.h>
29 
test_entry(void)30 void test_entry(void)
31 {
32 	int input = 41;
33 	int output = ext_syscall_ok(input);
34 
35 	printk("Input: %d Expected output: %d Actual output: %d\n",
36 	       input, input + 1, output);
37 	zassert_equal(output, input + 1);
38 }
39 EXPORT_SYMBOL(test_entry);
40