Skip to content

Commit e4dde34

Browse files
authored
Merge pull request #2774 from AlessandroA/uvisor_rpc
uVisor: Update to v0.25.0
2 parents e9c556d + 2a42255 commit e4dde34

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+963
-132
lines changed

features/FEATURE_UVISOR/AUTHORS.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
567 Milosch Meriac
2-
470 Alessandro Angelino
3-
49 Jaeden Amero
4-
42 Niklas Hauser
1+
568 Milosch Meriac
2+
477 Alessandro Angelino
3+
72 Jaeden Amero
4+
53 Niklas Hauser
55
3 Hugo Vincent
66
3 JaredCJR
77
3 Jim Huang

features/FEATURE_UVISOR/VERSION.txt

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

features/FEATURE_UVISOR/importer/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ rsync:
8181
# Copying licenses
8282
cp $(UVISOR_DIR)/LICENSE* $(TARGET_SUPPORTED)
8383

84-
TARGET_M%: $(TARGET_SUPPORTED)/*/*/*_m%_*.a
84+
TARGET_M%: $(TARGET_SUPPORTED)/*/*/*_cortex_m%*.a
8585
@printf "#\n# Copying $@ files...\n"
8686
mkdir $(foreach file,$^,$(dir $(file))$@)
8787
$(foreach file,$^,mv $(file) $(dir $(file))$@/lib$(notdir $(file));)

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

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

2020
#include "api/inc/uvisor_exports.h"
2121
#include "api/inc/page_allocator_exports.h"
22+
#include "api/inc/rpc_exports.h"
2223
#include <stddef.h>
2324
#include <stdint.h>
2425

@@ -43,10 +44,15 @@ UVISOR_EXTERN const uint32_t __uvisor_mode;
4344
UVISOR_BOX_MAGIC, \
4445
UVISOR_BOX_VERSION, \
4546
0, \
46-
sizeof(RtxBoxIndex), \
47-
0, \
48-
0, \
4947
0, \
48+
sizeof(RtxBoxIndex), \
49+
{ \
50+
0, \
51+
sizeof(uvisor_rpc_outgoing_message_queue_t), \
52+
sizeof(uvisor_rpc_incoming_message_queue_t), \
53+
sizeof(uvisor_rpc_fn_group_queue_t), \
54+
}, \
55+
NULL, \
5056
NULL, \
5157
acl_list, \
5258
acl_list_count \
@@ -74,7 +80,10 @@ UVISOR_EXTERN const uint32_t __uvisor_mode;
7480
(UVISOR_MIN_STACK(stack_size) + \
7581
(context_size) + \
7682
(__uvisor_box_heapsize) + \
77-
sizeof(RtxBoxIndex) \
83+
sizeof(RtxBoxIndex) + \
84+
sizeof(uvisor_rpc_outgoing_message_queue_t) + \
85+
sizeof(uvisor_rpc_incoming_message_queue_t) + \
86+
sizeof(uvisor_rpc_fn_group_queue_t) \
7887
) \
7988
* 8) \
8089
/ 6)]; \
@@ -83,9 +92,14 @@ UVISOR_EXTERN const uint32_t __uvisor_mode;
8392
UVISOR_BOX_MAGIC, \
8493
UVISOR_BOX_VERSION, \
8594
UVISOR_MIN_STACK(stack_size), \
86-
sizeof(RtxBoxIndex), \
87-
context_size, \
8895
__uvisor_box_heapsize, \
96+
sizeof(RtxBoxIndex), \
97+
{ \
98+
context_size, \
99+
sizeof(uvisor_rpc_outgoing_message_queue_t), \
100+
sizeof(uvisor_rpc_incoming_message_queue_t), \
101+
sizeof(uvisor_rpc_fn_group_queue_t), \
102+
}, \
89103
__uvisor_box_lib_config, \
90104
__uvisor_box_namespace, \
91105
acl_list, \
@@ -139,13 +153,6 @@ UVISOR_EXTERN const uint32_t __uvisor_mode;
139153

140154
#define uvisor_ctx (*__uvisor_ps)
141155

142-
/* Return the numeric box ID of the current box. */
143-
UVISOR_EXTERN int uvisor_box_id_self(void);
144-
145-
/* Return the numeric box ID of the box that is calling through the most recent
146-
* secure gateway. Return -1 if there is no secure gateway calling box. */
147-
UVISOR_EXTERN int uvisor_box_id_caller(void);
148-
149156
/* Copy the box namespace of the specified box ID to the memory provided by
150157
* box_namespace. The box_namespace's length must be at least
151158
* MAX_BOX_NAMESPACE_LENGTH bytes. Return how many bytes were copied into
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright (c) 2016, ARM Limited, All Rights Reserved
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
6+
* not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
#ifndef __UVISOR_API_BOX_ID_H__
18+
#define __UVISOR_API_BOX_ID_H__
19+
20+
#include "api/inc/uvisor_exports.h"
21+
22+
/* Return the numeric box ID of the current box. */
23+
UVISOR_EXTERN int uvisor_box_id_self(void);
24+
25+
/* Return the numeric box ID of the box that is calling through the most recent
26+
* secure gateway. Return -1 if there is no secure gateway calling box. */
27+
UVISOR_EXTERN int uvisor_box_id_caller(void) UVISOR_DEPRECATED;
28+
29+
#endif /* __UVISOR_API_BOX_ID_H__ */
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright (c) 2016, ARM Limited, All Rights Reserved
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
6+
* not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
#ifndef __UVISOR_API_BOX_INIT_H__
18+
#define __UVISOR_API_BOX_INIT_H__
19+
20+
#include "api/inc/uvisor-lib.h"
21+
22+
UVISOR_EXTERN void __uvisor_lib_box_init(void * lib_config);
23+
24+
#endif

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

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

2020
#include "api/inc/interrupts.h"
21+
#include "api/inc/unvic_exports.h"
2122

2223
#define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping
2324
#define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping
@@ -29,5 +30,6 @@
2930
#define NVIC_GetActive __NVIC_GetActive
3031
#define NVIC_SetPriority vIRQ_SetPriority
3132
#define NVIC_GetPriority vIRQ_GetPriority
33+
#define NVIC_SystemReset() vIRQ_SystemReset(RESET_REASON_NO_REASON)
3234

3335
#endif /* __UVISOR_API_NVIC_VIRTUAL_H__ */

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

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

2020
#include "rt_OsEventObserver.h"
21+
#include "api/inc/pool_queue_exports.h"
2122
#include <stdint.h>
2223

2324
/* If this magic doesn't match what you get in a TUvisorExportTable, then you
@@ -39,9 +40,21 @@ typedef struct {
3940

4041
OsEventObserver os_event_observer;
4142

43+
UvisorPoolTable pool;
44+
4245
/* This must be the last element of the table so that uvisor-input.S can
4346
* export the size statically. */
4447
uint32_t size;
4548
} TUvisorExportTable;
4649

50+
static inline TUvisorExportTable const * uvisor_export_table(void)
51+
{
52+
/* Defined in uvisor-input.S */
53+
extern uint32_t uvisor_config;
54+
extern uint32_t uvisor_export_table_size;
55+
56+
uintptr_t uvisor_config_addr = (uintptr_t) &uvisor_config;
57+
return (TUvisorExportTable *) (uvisor_config_addr - uvisor_export_table_size);
58+
}
59+
4760
#endif

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
#define UVISOR_ERROR_INVALID_BOX_ID (-2)
2121
#define UVISOR_ERROR_BUFFER_TOO_SMALL (-3)
2222
#define UVISOR_ERROR_BOX_NAMESPACE_ANONYMOUS (-4)
23+
#define UVISOR_ERROR_BAD_MAGIC (-5)
24+
#define UVISOR_ERROR_BAD_VERSION (-6)
25+
#define UVISOR_ERROR_OUT_OF_STRUCTURES (-7)
26+
#define UVISOR_ERROR_INVALID_PARAMETERS (-8)
27+
#define UVISOR_ERROR_NOT_IMPLEMENTED (-9)
2328

2429

2530
#define UVISOR_ERROR_CLASS_MASK (0xFFFF0000UL)
@@ -29,6 +34,7 @@
2934

3035
typedef enum {
3136
USER_NOT_ALLOWED = 1,
37+
DEBUG_BOX_HALT,
3238
} THaltUserError;
3339

3440
typedef enum {

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

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

20+
#include "api/inc/unvic_exports.h"
2021
#include "api/inc/uvisor_exports.h"
2122
#include <stdint.h>
2223

@@ -60,4 +61,10 @@ UVISOR_EXTERN void vIRQ_DisableAll(void);
6061
* ::vIRQ_DisableAll for more information. */
6162
UVISOR_EXTERN void vIRQ_EnableAll(void);
6263

64+
/** Reset the device.
65+
* @warning Currently only the debug box can reset the device.
66+
* @param reason[in] Reason for rebooting. Currently not used.
67+
*/
68+
UVISOR_EXTERN void vIRQ_SystemReset(TResetReason reason);
69+
6370
#endif /* __UVISOR_API_INTERRUPTS_H__ */
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright (c) 2016, ARM Limited, All Rights Reserved
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
6+
* not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
#ifndef __UVISOR_API_LIB_HOOK_EXPORTS_H__
18+
#define __UVISOR_API_LIB_HOOK_EXPORTS_H__
19+
20+
#include <stdint.h>
21+
22+
/* Predeclaration */
23+
typedef struct uvisor_semaphore UvisorSemaphore;
24+
25+
/*
26+
* uVisor library hooks
27+
*
28+
* All functions that uVisor needs to call that are implemented in uvisor-lib.
29+
* These functions will be run by unprivileged code only. */
30+
typedef struct {
31+
void (*box_init)(void * lib_config);
32+
int (*semaphore_init)(UvisorSemaphore * semaphore, int32_t count);
33+
int (*semaphore_pend)(UvisorSemaphore * semaphore, uint32_t timeout_ms);
34+
} UvisorLibHooks;
35+
36+
#endif
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright (c) 2016, ARM Limited, All Rights Reserved
3+
* SPDX-License-Identifier: Apache-2.0
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
6+
* not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
#ifndef __UVISOR_API_MAGIC_EXPORTS_H__
18+
#define __UVISOR_API_MAGIC_EXPORTS_H__
19+
20+
#include <stdint.h>
21+
22+
/* udf imm16
23+
* UDF - ARMv7M ARM section A7.7.191
24+
* 111 1;0 111;1111; <imm4>; 1 01 0; <imm12> (Encoding T2)
25+
*/
26+
#define UDF_OPCODE(imm16) \
27+
((uint32_t) (0xA000F7F0UL | (((uint32_t) (imm16) & 0xFFFU) << 16U) | (((uint32_t) (imm16) & 0xF000UL) >> 12)))
28+
29+
/** Magics
30+
*
31+
* The following magics are used to verify various things within uVisor.The
32+
* magics are chosen to be one of the explicitly undefined Thumb-2
33+
* instructions.
34+
*/
35+
#if defined(__thumb__) && defined(__thumb2__)
36+
#define UVISOR_RPC_GATEWAY_MAGIC_ASYNC UDF_OPCODE(0x07C2)
37+
#define UVISOR_RPC_GATEWAY_MAGIC_SYNC UDF_OPCODE(0x07C3)
38+
#define UVISOR_POOL_MAGIC UDF_OPCODE(0x07C4)
39+
#define UVISOR_POOL_QUEUE_MAGIC UDF_OPCODE(0x07C5)
40+
#else
41+
#error "Unsupported instruction set. The ARM Thumb-2 instruction set must be supported."
42+
#endif /* __thumb__ && __thumb2__ */
43+
44+
45+
#endif /* __UVISOR_API_MAGIC_EXPORTS_H__ */

0 commit comments

Comments
 (0)