Skip to content

Commit e1090ca

Browse files
authored
Merge pull request #5275 from alzix/upgrade-uvisor-v0.31.0
uVisor: Upgrade to v0.31.0
2 parents 0e1cc56 + fb9fd5b commit e1090ca

28 files changed

+73
-68
lines changed

features/FEATURE_UVISOR/AUTHORS.txt

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
600 Alessandro Angelino
22
592 Milosch Meriac
3-
190 Jaeden Amero
3+
213 Jaeden Amero
44
89 Niklas Hauser
5-
10 Fangyi Zhou
6-
6 Michael Schwarcz
7-
5 Irit Arkin
8-
5 Alexander Zilberkant
9-
4 Amir Cohen
10-
3 Hugo Vincent
5+
27 Fangyi Zhou
6+
14 Michael Schwarcz
7+
8 Alexander Zilberkant
8+
7 Irit Arkin
9+
6 Amir Cohen
10+
6 Roman Kuznetsov
11+
4 Amanda Butler
12+
4 Oren Cohen
1113
3 AnotherButler
12-
3 Roman Kuznetsov
14+
3 Danny Shavit
15+
3 Hugo Vincent
16+
3 Jan Jongboom
1317
3 JaredCJR
1418
3 Jim Huang
15-
2 tonyyanxuan
16-
2 Amanda Butler
17-
2 Jan Jongboom
19+
2 Jethro Hsu
1820
2 Nathan Chong
19-
2 Oren Cohen
2021
2 Vincenzo Frascino
2122
2 ccli8
22-
1 Russ Butler
23-
1 Jethro Hsu
23+
2 tonyyanxuan
2424
1 Aksel Skauge Mellbye
25-
1 Danny Shavit
25+
1 Michael Bartling
26+
1 Russ Butler

features/FEATURE_UVISOR/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ static void private_button_on_press(void)
248248
for (int i = 0; i < PRIVATE_BUTTON_BUFFER_COUNT; ++i) {
249249
uvisor_ctx->pc->printf("%lu ", uvisor_ctx->buffer[i]);
250250
}
251-
uvisor_ctx->pc->printf("\r\n");
251+
uvisor_ctx->pc->printf("\n");
252252
}
253253
254254
}
@@ -265,7 +265,7 @@ static void private_button_main_thread(const void *)
265265
/* Create the buffer and cache its pointer to the private static memory. */
266266
uvisor_ctx->buffer = (uint32_t *) malloc(PRIVATE_BUTTON_BUFFER_COUNT * sizeof(uint32_t));
267267
if (uvisor_ctx->buffer == NULL) {
268-
uvisor_ctx->pc->printf("ERROR: Failed to allocate memory for the button buffer\r\n");
268+
uvisor_ctx->pc->printf("ERROR: Failed to allocate memory for the button buffer\n");
269269
mbed_die();
270270
}
271271
uvisor_ctx->index = 0;
@@ -408,7 +408,7 @@ int main(void)
408408
{
409409
while (true) {
410410
led = !led;
411-
printf("Secure index is %d\r\n", secure_get_index());
411+
printf("Secure index is %d\n", secure_get_index());
412412
Thread::wait(500);
413413
}
414414
}
@@ -482,5 +482,6 @@ Repeat the process multiple times until all ACLs have been added to the list. Wh
482482

483483
- [uVisor API documentation](API.md).
484484
- [Debugging uVisor on mbed OS](DEBUGGING.md).
485+
- [Using nonvolatile storage from uVisor on mbed OS](manual/Flash.md).
485486

486487
If you found any bug or inconsistency in this guide, please [raise an issue](https://github.com/ARMmbed/uvisor/issues/new).

features/FEATURE_UVISOR/VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.30.0
1+
v0.31.0

features/FEATURE_UVISOR/includes/uvisor/api/inc/api.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ typedef struct {
6565
int (*box_namespace)(int box_id, char *box_namespace, size_t length);
6666
int (*box_id_for_namespace)(int * const box_id, const char * const box_namespace);
6767

68-
void (*debug_init)(const TUvisorDebugDriver * const driver);
6968
void (*error)(THaltUserError reason);
7069
void (*start)(void);
7170
void (*vmpu_mem_invalidate)(void);
@@ -74,8 +73,8 @@ typedef struct {
7473
int (*pool_queue_init)(uvisor_pool_queue_t *, uvisor_pool_t *, void *, size_t, size_t);
7574
uvisor_pool_slot_t (*pool_allocate)(uvisor_pool_t *);
7675
uvisor_pool_slot_t (*pool_try_allocate)(uvisor_pool_t *);
77-
void (*pool_queue_enqueue)(uvisor_pool_queue_t *, uvisor_pool_slot_t);
78-
int (*pool_queue_try_enqueue)(uvisor_pool_queue_t *, uvisor_pool_slot_t);
76+
uvisor_pool_slot_t (*pool_queue_enqueue)(uvisor_pool_queue_t *, uvisor_pool_slot_t);
77+
uvisor_pool_slot_t (*pool_queue_try_enqueue)(uvisor_pool_queue_t *, uvisor_pool_slot_t);
7978
uvisor_pool_slot_t (*pool_free)(uvisor_pool_t *, uvisor_pool_slot_t);
8079
uvisor_pool_slot_t (*pool_try_free)(uvisor_pool_t *, uvisor_pool_slot_t);
8180
uvisor_pool_slot_t (*pool_queue_dequeue)(uvisor_pool_queue_t *, uvisor_pool_slot_t);

features/FEATURE_UVISOR/includes/uvisor/api/inc/box_config.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#define __UVISOR_API_BOX_CONFIG_H__
1919

2020
#include "api/inc/uvisor_exports.h"
21+
#include "api/inc/debug_exports.h"
2122
#include "api/inc/page_allocator_exports.h"
2223
#include "api/inc/rpc_exports.h"
2324
#include <stddef.h>
@@ -169,4 +170,22 @@ UVISOR_EXTERN void const * const public_box_cfg_ptr;
169170

170171
#define __uvisor_ctx (((UvisorBoxIndex *) __uvisor_ps)->bss.address_of.context)
171172

173+
174+
/* Use this macro after calling the box configuration macro, in order to register your box as a debug box.
175+
* It will create a valid debug driver struct with the halt_error_func parameter as its halt_error() function */
176+
#define UVISOR_DEBUG_DRIVER(box_name, halt_error_func) \
177+
UVISOR_EXTERN TUvisorDebugDriver const __uvisor_debug_driver; \
178+
TUvisorDebugDriver const __uvisor_debug_driver = { \
179+
UVISOR_DEBUG_BOX_MAGIC, \
180+
UVISOR_DEBUG_BOX_VERSION, \
181+
&box_name ## _cfg, \
182+
halt_error_func \
183+
};
184+
185+
/* Use this macro after calling the box configuration macro, in order to
186+
* register the public box as a debug box. */
187+
#define UVISOR_PUBLIC_BOX_DEBUG_DRIVER(halt_error_func) \
188+
UVISOR_DEBUG_DRIVER(public_box, halt_error_func)
189+
190+
172191
#endif /* __UVISOR_API_BOX_CONFIG_H__ */

features/FEATURE_UVISOR/includes/uvisor/api/inc/debug.h

Lines changed: 0 additions & 32 deletions
This file was deleted.

features/FEATURE_UVISOR/includes/uvisor/api/inc/debug_exports.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,19 @@
1919

2020
#include "api/inc/halt_exports.h"
2121
#include <stdint.h>
22+
#include "api/inc/vmpu_exports.h"
2223

23-
/* Debug box driver -- Version 0
24+
25+
#define UVISOR_DEBUG_BOX_VERSION (1)
26+
27+
28+
/* Debug box driver
2429
* A constant instance of this struct must be instantiated by the unprivileged
2530
* code to setup a debug box.*/
2631
typedef struct TUvisorDebugDriver {
27-
uint32_t (*get_version)(void);
32+
const uint32_t magic;
33+
const uint32_t version;
34+
const UvisorBoxConfig * const box_cfg_ptr;
2835
void (*halt_error)(THaltError, const THaltInfo *);
2936
} TUvisorDebugDriver;
3037

features/FEATURE_UVISOR/includes/uvisor/api/inc/halt_exports.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#ifndef __UVISOR_API_HALT_EXPORTS_H__
1818
#define __UVISOR_API_HALT_EXPORTS_H__
1919

20+
#include "uvisor_exports.h"
21+
2022
#define UVISOR_ERROR_INVALID_BOX_ID (-2)
2123
#define UVISOR_ERROR_BUFFER_TOO_SMALL (-3)
2224
#define UVISOR_ERROR_BOX_NAMESPACE_ANONYMOUS (-4)

features/FEATURE_UVISOR/includes/uvisor/api/inc/ipc.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,12 @@ UVISOR_EXTERN int ipc_waitforall(uint32_t wait_tokens, uint32_t * done_tokens, u
5151

5252
/** Asynchronously send an IPC message
5353
*
54-
* @note The memory used for sending the message (pointed to by msg) must be
55-
* valid until after the send is complete.
54+
* @note The memory used for receiving the message (pointed to by msg) and the
55+
* IPC descriptor (pointed to by desc) must be valid until after the send is
56+
* complete. In addition, each IPC message should use its own IPC descriptor.
57+
* Reusing an IPC descriptor will lead to unpredictable behaviours.
5658
*
57-
* @param[in] desc an IPC descriptor for the message
59+
* @param[inout] desc an IPC descriptor for the message
5860
* @param[in] msg the message to send
5961
*
6062
* @return 0 on success, non-zero error code otherwise
@@ -63,8 +65,10 @@ UVISOR_EXTERN int ipc_send(uvisor_ipc_desc_t * desc, const void * msg);
6365

6466
/** Asynchronously receive an IPC message
6567
*
66-
* @note The memory used for receiving the message (pointed to by msg) must be
67-
* valid until after the receive is complete.
68+
* @note The memory used for receiving the message (pointed to by msg) and the
69+
* IPC descriptor (pointed to by desc) must be valid until after the receive is
70+
* complete. In addition, each IPC message should use its own IPC descriptor.
71+
* Reusing an IPC descriptor will lead to unpredictable behaviours.
6872
*
6973
* @param[inout] desc an IPC descriptor for the message
7074
* @param[out] msg the memory to copy the message to

features/FEATURE_UVISOR/includes/uvisor/api/inc/magic_exports.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#define UVISOR_RPC_GATEWAY_MAGIC_SYNC UDF_OPCODE(0x07C3)
3838
#define UVISOR_POOL_MAGIC UDF_OPCODE(0x07C4)
3939
#define UVISOR_POOL_QUEUE_MAGIC UDF_OPCODE(0x07C5)
40+
#define UVISOR_DEBUG_BOX_MAGIC UDF_OPCODE(0x07C6)
4041
#else
4142
#error "Unsupported instruction set. The ARM Thumb-2 instruction set must be supported."
4243
#endif /* __thumb__ && __thumb2__ */

features/FEATURE_UVISOR/includes/uvisor/api/inc/pool_queue_exports.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
#include "api/inc/magic_exports.h"
2121
#include "api/inc/uvisor_exports.h"
22-
#include "api/inc/uvisor_semaphore_exports.h"
2322
#include "api/inc/uvisor_spinlock_exports.h"
2423
#include <stdint.h>
2524
#include <stddef.h>
@@ -115,8 +114,8 @@ UVISOR_EXTERN uvisor_pool_slot_t uvisor_pool_allocate(uvisor_pool_t * pool);
115114
UVISOR_EXTERN uvisor_pool_slot_t uvisor_pool_try_allocate(uvisor_pool_t * pool);
116115

117116
/* Enqueue the specified slot into the queue. */
118-
UVISOR_EXTERN void uvisor_pool_queue_enqueue(uvisor_pool_queue_t * pool_queue, uvisor_pool_slot_t slot);
119-
UVISOR_EXTERN int uvisor_pool_queue_try_enqueue(uvisor_pool_queue_t * pool_queue, uvisor_pool_slot_t slot);
117+
UVISOR_EXTERN uvisor_pool_slot_t uvisor_pool_queue_enqueue(uvisor_pool_queue_t * pool_queue, uvisor_pool_slot_t slot);
118+
UVISOR_EXTERN uvisor_pool_slot_t uvisor_pool_queue_try_enqueue(uvisor_pool_queue_t * pool_queue, uvisor_pool_slot_t slot);
120119

121120
/* Free the specified slot back into the pool. Invalid slots are ignored.
122121
* Return the slot that was freed, or UVISOR_POOL_SLOT_IS_FREE if the slot was

features/FEATURE_UVISOR/includes/uvisor/api/inc/uvisor-lib.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include "api/inc/api.h"
2929
#include "api/inc/box_config.h"
3030
#include "api/inc/box_id.h"
31-
#include "api/inc/debug.h"
3231
#include "api/inc/disabled.h"
3332
#include "api/inc/error.h"
3433
#include "api/inc/interrupts.h"

features/FEATURE_UVISOR/includes/uvisor/api/inc/uvisor_exports.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,12 @@
133133
#define UVISOR_MACRO_REGS_RETVAL(type, name) \
134134
register type name asm("r0");
135135

136+
UVISOR_FORCEINLINE void uvisor_noreturn(void)
137+
{
138+
volatile int var = 1;
139+
while(var);
140+
}
141+
136142
/* declare callee-saved input/output operands for gcc-style inline asm */
137143
/* note: this macro requires that a C variable having the same name of the
138144
* corresponding callee-saved register is declared; these operands follow

features/FEATURE_UVISOR/includes/uvisor/api/inc/vmpu_exports.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#define __UVISOR_API_VMPU_EXPORTS_H__
1919

2020
#include "api/inc/uvisor_exports.h"
21-
#include "api/inc/pool_queue_exports.h"
2221
#include <stdint.h>
2322

2423
/* The maximum box namespace length is 37 so that it is exactly big enough for

features/FEATURE_UVISOR/source/page_allocator.c_inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ void page_allocator_init(void * const heap_start, void * const heap_end, const u
138138
g_page_map_shift -= (g_page_head_end_rounded - (uint32_t) g_page_heap_end) / g_page_size;
139139

140140
DPRINTF(
141-
"page heap: [0x%08x, 0x%08x] %ukB -> %u %ukB pages\r\n",
141+
"page heap: [0x%08x, 0x%08x] %ukB -> %u %ukB pages\n",
142142
(unsigned int) g_page_heap_start,
143143
(unsigned int) g_page_heap_end,
144144
(unsigned int) (g_page_count_free * g_page_size / 1024),
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
e3b1385c7facc7fdab472440293c4c87ed2b2999
1+
36664e60639dda2b364e6e8b5ecf9a23116d280a

0 commit comments

Comments
 (0)