On Tue, Feb 25, 2020 at 5:27 PM Gregory Nutt <spudan...@gmail.com> wrote:

>
> > ... How are syscalls dealt in other RTOS using MPU?
>
> For the case of the MPU, there is no general answer to that.  I don't
> think that there is any standard model for the use of the MPU in a
> Unix-like system.
>
> NuttX uses the MPU to create a Kernel space with the OS and critical
> board logic in it and a separate user space for applications.  That is
> inspired by the standard Unix kernel + applications model.
>
> But every use of the MPU that I am familiar with in deeply embedded
> bare-metal or tiny RTOS systems are totally custom solutions.
>
> For the MMU (which you might think of as an MPU with address mapping),
> the Unix model is the only one I am familiar with.  As in Linux, a
> kernel blob and applications loaded into RAM from a file system.
>
> Greg
>
>
Thanks for the info. I did a quick search and find some examples:

*Zephyr*:
https://docs.zephyrproject.org/1.13.0/kernel/usermode/mpu_userspace.html
(emphasis added by me):

"During system calls, the user mode thread’s access to the system call and
the *passed-in parameters are all validated*. The user mode thread is then
elevated to privileged mode, the stack is switched to use the privileged
stack, and the call is made to the specified kernel API. On return from the
kernel API, the thread is set back to user mode and the stack is restored
to the user stack."

Not sure what kind of validation is done though.

*FreeRTOS*: some documentation related to MPU memory regions (but nothing
said about syscall params):

https://freertos.org/FreeRTOS-MPU-memory-protection-unit.html

I would like to check the code, but if someone already know about it would
be great :)
Cheers,
Miguel

Reply via email to