• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

boards/03-Aug-2024-6452

src/03-Aug-2024-575347

CMakeLists.txtD03-Aug-2024281 118

README.rstD03-Aug-20242.2 KiB6048

prj.confD03-Aug-202433 32

sample.yamlD03-Aug-2024555 2625

README.rst

1.. _userspace_protected_memory:
2
3Userspace Protected Memory
4##########################
5
6Overview
7********
8This sample is an example of running multiple threads assigned
9unique memory domains with protected partitions.  The
10application uses memory partitioning with a sample algorithm
11simulating an enigma-like machine, but the implementation of the
12machine has not been validated and should not be used for any
13actual security purposes.
14
15Requirements
16************
17
18The sample is dependent on the subsystem app_memory, and it will
19not run on boards that do not support the subsystem.  The sample
20was tested on the following boards qemu_x86,frdm_k64, and ``96b_carbon/stm32f401xe``.
21
22Building and Running
23********************
24
25This example will only cover the qemu_x86 board, since the sample
26just prints text to a console.
27
28.. zephyr-app-commands::
29   :zephyr-app: samples/userspace/shared_mem
30   :board: qemu_x86
31   :goals: build run
32   :compact:
33
34After starting, the console will display multiple starting messages
35followed by two series of repeating messages.  The repeating messages
36are the input and output of the enigma-like machine.  The second
37message is the output of the first message, and the resulting
38output is the first message without spaces.  The two messages are
39marked as 1 and 1' respectively.
40
41Exit QEMU by pressing :kbd:`CTRL+A` :kbd:`x`.
42
43Two definitions can be inserted to change the wheel settings and print
44the state information.  To enable the definitions uncomment the last
45two lines in CMakeLists.txt.
46
47Functionality
48*************
49The PT thread sends a message followed by the encrypted version of the
50message after sleeping.  To send the message the PT thread checks a
51flag, and if it is clear, writes the message to a buffer shared with
52the encrypt thread.  After writing the buffer, the flag is set. The
53encrypt thread copies the memory from the common buffer into the
54encrypted thread's private memory when the flag is set and then clears
55the flag.  Once the encrypted thread receives the text string, it
56performs a simulation of the enigma machine to produce cypher text(CT).
57The CT is copied to a shared memory partition connecting to the third
58thread. The third thread prints the CT to the console with a banner
59denoting the content as CYPHER TEXT.
60