Use z_user_to_copy() instead of directly writing to the user provided
pointer to validate that the user has write permission to underlying
memory location.
It is important to verify the memory not only for reads, but also for
writes, as otherwise the function can be abused by usermode code to
write to privileged read/write, unprivileged read-only memory partition.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
Kconfig options have to be prefixed with :kconfig:option: in order to
appear as links in generated html output.
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
The `ARCH` init level was added to solve a specific problem, call init
code (SYS_INIT/devices) before `z_cstart` in the `intel_adsp` platform.
The documentation claims it runs before `z_cstart`, but this is only
true if the SoC/arch takes care of calling:
```c
z_sys_init_run_level(_SYS_INIT_LEVEL_ARCH);
```
Which is only true for `intel_adsp` nowadays. So in practice, we now
have a platform specific init level. This patch proposes to do things in
a slightly different way. First, level name is renamed to `EARLY`, to
emphasize it runs in the early stage of the boot process. Then, it is
handled by the Kernel (inside `z_cstart()` before calling
`arch_kernel_init()`). This means that any platform can now use this
level. For `intel_adsp`, there should be no changes, other than
`gcov_static_init()` will be called before (I assume this will allow to
obtain coverage for code called in EARLY?).
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
document new initialization level ARCH, used to init drivers/services
very early in the ARCH code and before z_cstart().
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
If a semaphore is contested, it is possible that the semaphore will no
longer be available when k_sem_take() is called, not k_sem_give().
Fix few typos and explicitly mention poll events instead of "they".
Signed-off-by: Tomasz Moń <tomasz.mon@nordicsemi.no>
The commit c844bd87b3 removed the support
for passing a memory block (allocated in a memory pool) as message
data, but did not update the relevant documentation.
This commit removes any references to the memory block support, which
was removed in the v2.5.0 release, in the mailbox API documentation.
Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
Currently, to compute the 'item' size in a ring buffer, we have
`SIZE32_OF`.
Several issues with this:
- `SIZE32_OF` only works on variables, not types, due to an extra
parenthesis pair. Indeed, `sizeof((int))` is not valid C, whereas
`sizeof((my_var))` is.
- `SIZE32_OF` is not a proper public API
- `SIZE32_OF` rounds down if the argument size is not a multiple
of 4 bytes.
Thus, we introduce a proper `RING_BUF_ITEM_SIZEOF`, fixing the
aforementioned issues.
Signed-off-by: Henri Xavier <datacomos@huawei.com>
The pipes implementation has been updated to allow ISRs to both
send and receive data to/from pipes provided the K_NO_WAIT timeout
option is used.
Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
Updates the priority inheritance description to better explain what
happens during priority inheritance and warn of the consequences of
not following best-practices.
Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
Move scripts needed by the build system and not designed to be run
individually or standalone into the build subfolder.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Move scripts needed by the build system and not designed to be run
individually or standalone into the build subfolder.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Currently the device MMIO APIs is only able to map single DT-defined
regions and also the _NAMED variant is assuming that each DT-defined
device has only one single region to map.
This is a limitation and a problem when in the DT are defined devices
with multiple regions that need to be mapped.
This patch is trying to overcome this limitation by introducing the
DEVICE_MMIO_NAMED_ROM_INIT_BY_NAME macro that leveraged the 'reg-names'
DT property to map multiple regions defined by a single device.
So for example in the DT we can have a device like:
driver@c4000000 {
reg = <0xc4000000 0x1000>, <0xc4001000 0x1000>;
reg-names = "region0", "region1";
};
and then we can use DEVICE_MMIO_NAMED_ROM_INIT_BY_NAME doing:
struct driver_config config = {
DEVICE_MMIO_NAMED_ROM_INIT_BY_NAME(region0, DT_DRV_INST(0)),
DEVICE_MMIO_NAMED_ROM_INIT_BY_NAME(region1, DT_DRV_INST(0)),
};
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
This commit adds the sections describing how the dynamic memory
management is handled to the C language support and standard library
documentations.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
The kernel documentation listed the memory management API pages under
two different sections: 'Kernel/Kernel Services' and
'Kernel/Memory Management' -- this creates unnecessary confusion and
makes it hard to look up all supported kernel memory management APIs.
This commit relocates the memory management API pages under
'Kernel/Kernel Services' to 'Kernel/Memory Management' so that all
memory management APIs provided by the kernel are described in one
unified section.
The link to the 'Kernel/Memory Management' index page is still left in
the 'Kernel Services' page because it may still be helpful to look at
it as part of the services provided by the Zephyr kernel -- it is just
more substantial than the rest and deserves more visibility.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit adds the 'Language Support' sub-category under the
'Developing with Zephyr' category with programming language support-
related documentations.
The contents of the 'C standard library' page have been relocated to
the 'C Language Support' page, and the contents of the 'C++ Support for
Applications' page have been relocated to the 'C++ Language Support'
page.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
This commit adds a dedicated page for the Zephyr SDK under the
'Toolchains' sub-category under 'Developing with Zephyr'.
The content of this page is based on the Zephyr SDK installation
instruction from the 'Getting Started Guide'.
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Moves the 'Flushing a Pipe' code example to the correct location
and section and re-adds the 'Suggested Uses' text missing
compared to v2.7.
Signed-off-by: Archie Atkinson <archie.atkinson@chiaro.co.uk>
At some recent point, directory <zephyr-root>/include was moved to
<zephyr-root>/include/zephyr. However, links from documentation to
Zephyr source on Github were not updated. Update them now.
Signed-off-by: Aleksandar Markovic <aleksandar.markovic.sa@gmail.com>
Updates the threads documentation to clarify the distinction between
ready and running states.
Fixes 44255
Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
Move this section under the kernel and alongside other core and low
level features that are tied to the kernel.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Move this section under the kernel and alongside other core and low
level features that are tied to the kernel.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Move this section under the kernel and alongside other core and low
level features that are tied to the kernel.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Move this section under the kernel and alongside other core and low
level features that are tied to the kernel.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Move this section under the kernel and alongside other core and low
level features that are tied to the kernel.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Move this section under the kernel and alongside other core and low
level features that are tied to the kernel.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Move the kernel documentation up and make it a main chapter. Right now
it is hidden very low in the structure under references.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Move guides and APIs into separate directories and cleanup naming
introducing index files rather than named section files.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
There are no longer per-partition initialization functions.
Instead, we iterate over all of them at boot to set up the
derived k_mem_partitions properly.
Some ARC-specific hacks that should never have been applied
have been removed from the userspace test.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
The public APIs for application shared memory are now
properly documented and conform to zephyr naming
conventions.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
The app shared memory macros for declaring domains provide
no value, despite the stated intentions.
Just declare memory domains using the standard APIs for it.
To support this, symbols declared for app shared memory
partitions now are struct k_mem_partition, which can be
passed to the k_mem_domain APIs as normal, instead of the
app_region structs which are of no interest to the end
user.
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Instead of having kernel APIs documentated in a separate page, move the
API references to the object pages and have everything in one place.
Remove the intermediate category page and list all section under the
kernel directly.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Put the kernel overview at the top level of the kernel documentation and
make it visible immediatly when browsing the kernel docs.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>