Skip to content

Commit eccecd3

Browse files
authored
Merge pull request #2733 from meriac/master
uVisor: Debug Box & ENET DMA-support for default box
2 parents 65ffa8c + 2ca4095 commit eccecd3

28 files changed

+50
-26
lines changed

features/FEATURE_UVISOR/AUTHORS.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
553 Milosch Meriac
2-
458 Alessandro Angelino
1+
567 Milosch Meriac
2+
470 Alessandro Angelino
3+
49 Jaeden Amero
34
42 Niklas Hauser
4-
40 Jaeden Amero
55
3 Hugo Vincent
66
3 JaredCJR
77
3 Jim Huang
8+
2 Vincenzo Frascino
89
2 tonyyanxuan
910
1 Aksel Skauge Mellbye
1011
1 Irit Arkin

features/FEATURE_UVISOR/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,15 @@ To enable the uVisor on the app, just add the following lines at the beginning o
9393
#include "rtos.h"
9494
#include "uvisor-lib/uvisor-lib.h"
9595

96-
/* Register privleged system IRQ hooks.
96+
/* Register privleged system hooks.
9797
* This is a system-wide configuration and it is independent from the app, but
9898
* for the moment it needs to be specified in the app. This will change in a
9999
* later version: The configuration will be provided by the OS. */
100100
extern "C" void SVC_Handler(void);
101101
extern "C" void PendSV_Handler(void);
102102
extern "C" void SysTick_Handler(void);
103-
UVISOR_SET_PRIV_SYS_IRQ_HOOKS(SVC_Handler, PendSV_Handler, SysTick_Handler);
103+
extern "C" uint32_t rt_suspend(void);
104+
UVISOR_SET_PRIV_SYS_HOOKS(SVC_Handler, PendSV_Handler, SysTick_Handler, rt_suspend);
104105

105106
/* Main box Access Control Lists (ACLs). */
106107
/* Note: These are specific to the NXP FRDM-K64F board. See the section below
@@ -125,7 +126,7 @@ UVISOR_SET_MODE_ACL(UVISOR_ENABLED, g_main_box_acls);
125126
126127
In the code above we specified 3 elements:
127128
128-
1. System-wide uVisor configurations: `UVISOR_SET_PRIV_SYS_IRQ_HOOKS`. Application authors currently need to specify the privileged system IRQ hooks at the application level with this macro, but in the future the operating system will register the privileged system IRQ hooks on its own.
129+
1. System-wide uVisor configurations: `UVISOR_SET_PRIV_SYS_HOOKS`. Application authors currently need to specify the privileged system hooks at the application level with this macro, but in the future the operating system will register the privileged system hooks on its own.
129130
1. Main box Access Control Lists (ACLs). Since with uVisor enabled everything runs in unprivileged mode, we need to make sure that peripherals that are accessed by the OS and the main box are allowed. These peripherals are specified using a list like the one in the snippet above. For the purpose of this example we provide you the list of all the ACLs that we know you will need. For other platforms or other applications you need to determine those ACLs following a process that is described in a [section](#the-main-box-acls) below.
130131
1. App-specific uVisor configurations: `UVISOR_SET_MODE_ACL`. This macro sets the uVisor mode (enabled) and associates the list of ACLs we just created with the main box.
131132

features/FEATURE_UVISOR/VERSION.txt

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

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,18 @@ typedef enum {
3131
USER_NOT_ALLOWED = 1,
3232
} THaltUserError;
3333

34+
typedef enum {
35+
HALT_NO_ERROR = 0,
36+
PERMISSION_DENIED = 1,
37+
SANITY_CHECK_FAILED,
38+
NOT_IMPLEMENTED,
39+
NOT_ALLOWED,
40+
FAULT_MEMMANAGE,
41+
FAULT_BUS,
42+
FAULT_USAGE,
43+
FAULT_HARD,
44+
FAULT_DEBUG,
45+
__THALTERROR_MAX /* always keep as the last element of the enum */
46+
} THaltError;
47+
3448
#endif /* __UVISOR_API_HALT_EXPORTS_H__ */

features/FEATURE_UVISOR/includes/uvisor/api/inc/priv_sys_irq_hook_exports.h renamed to features/FEATURE_UVISOR/includes/uvisor/api/inc/priv_sys_hook_exports.h

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,36 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
#ifndef __UVISOR_API_PRIV_SYS_IRQ_HOOK_EXPORTS_H__
18-
#define __UVISOR_API_PRIV_SYS_IRQ_HOOK_EXPORTS_H__
17+
#ifndef __UVISOR_API_PRIV_SYS_HOOK_EXPORTS_H__
18+
#define __UVISOR_API_PRIV_SYS_HOOK_EXPORTS_H__
1919

2020
/*
21-
* Privileged system interrupt hooks
21+
* Privileged system hooks
2222
*
2323
* In this version of uVisor, uVisor lives alongside an RTOS that requires
2424
* running privileged code. In order for the RTOS to run any privileged code,
2525
* uVisor must allow the RTOS to handle a subset of privileged system
26-
* interrupts. Only the following system interrupts are hookable. Code called
27-
* by these hooks circumvents uVisor security. HANDLE WITH CARE. */
26+
* interrupts or system calls. Only the following system interrupts and system
27+
* calls are hookable. Code called by these hooks circumvents uVisor security.
28+
* HANDLE WITH CARE. */
2829
typedef struct {
2930
void (*priv_svc_0)(void);
3031
void (*priv_pendsv)(void);
3132
void (*priv_systick)(void);
32-
} UvisorPrivSystemIRQHooks;
33+
uint32_t (*priv_os_suspend)(void);
34+
} UvisorPrivSystemHooks;
3335

3436
/* Use this macro to register privileged system IRQ hooks. If you don't want to
3537
* register a particular privileged system IRQ hook, you can supply NULL for
3638
* that hook parameter. */
37-
#define UVISOR_SET_PRIV_SYS_IRQ_HOOKS(priv_svc_0_, priv_pendsv_, priv_systick_) \
38-
UVISOR_EXTERN const UvisorPrivSystemIRQHooks __uvisor_priv_sys_irq_hooks = { \
39+
#define UVISOR_SET_PRIV_SYS_HOOKS(priv_svc_0_, priv_pendsv_, priv_systick_, priv_os_suspend_) \
40+
UVISOR_EXTERN_C_BEGIN \
41+
const UvisorPrivSystemHooks __uvisor_priv_sys_hooks = { \
3942
.priv_svc_0 = priv_svc_0_, \
4043
.priv_pendsv = priv_pendsv_, \
4144
.priv_systick = priv_systick_, \
42-
};
45+
.priv_os_suspend = priv_os_suspend_, \
46+
}; \
47+
UVISOR_EXTERN_C_END
4348

4449
#endif

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ UVISOR_EXTERN int uvisor_lib_init(void);
5959
#include "api/inc/register_gateway_exports.h"
6060
#include "api/inc/rpc_gateway_exports.h"
6161
#include "api/inc/svc_exports.h"
62-
#include "api/inc/priv_sys_irq_hook_exports.h"
62+
#include "api/inc/priv_sys_hook_exports.h"
6363
#include "api/inc/unvic_exports.h"
6464
#include "api/inc/uvisor_exports.h"
6565
#include "api/inc/vmpu_exports.h"

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,6 @@
5959

6060
#if defined(UVISOR_PRESENT) && UVISOR_PRESENT == 1
6161

62-
/* subregion mask for ARMv7M */
63-
#if defined(ARCH_MPU_ARMv7M)
64-
#define UVISOR_TACL_SUBREGIONS_POS 24
65-
#define UVISOR_TACL_SUBREGIONS_MASK (0xFFUL << UVISOR_TACL_SUBREGIONS_POS)
66-
#define UVISOR_TACL_SUBREGIONS(x) ( (((uint32_t) (x)) << UVISOR_TACL_SUBREGIONS_POS) & UVISOR_TACL_SUBREGIONS_MASK )
67-
#endif
68-
6962
#endif /* defined(UVISOR_PRESENT) && UVISOR_PRESENT == 1 */
7063

7164
#define UVISOR_TACLDEF_SECURE_BSS (UVISOR_TACL_UREAD |\

features/FEATURE_UVISOR/source/rtx/box_init.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020
#include <stdint.h>
2121
#include <string.h>
2222

23+
/* Register the OS with uVisor */
24+
extern void SVC_Handler(void);
25+
extern void PendSV_Handler(void);
26+
extern void SysTick_Handler(void);
27+
extern uint32_t rt_suspend(void);
28+
29+
UVISOR_SET_PRIV_SYS_HOOKS(SVC_Handler, PendSV_Handler, SysTick_Handler, rt_suspend);
30+
2331
/* This function is called by uVisor in unprivileged mode. On this OS, we
2432
* create box main threads for the box. */
2533
void __uvisor_lib_box_init(void * lib_config)

features/FEATURE_UVISOR/source/rtx/unsupported_malloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ extern uint32_t __HeapLimit[]; /* __heap_end */
2929
extern uint32_t __StackLimit[]; /* bottom of stack */
3030

3131
/* There is only one box index for box 0. */
32-
RtxBoxIndex * __uvisor_ps;
32+
RtxBoxIndex * __uvisor_ps UVISOR_ALIGN(4);
3333

3434
static void box_index_init(void *box_bss, uint32_t heap_size)
3535
{

features/net/FEATURE_IPV4/lwip-interface/lwip-eth/arch/TARGET_Freescale/hardware_init_MK64F12.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ void k64f_init_eth_hardware(void)
3737
{
3838
port_pin_config_t configENET = {0};
3939

40-
/* Disable MPU. */
40+
#ifndef FEATURE_UVISOR
41+
/* Disable MPU only when uVisor is not around. */
4142
MPU->CESR &= ~MPU_CESR_VLD_MASK;
43+
#endif/*FEATURE_UVISOR*/
4244

4345
CLOCK_EnableClock(kCLOCK_PortC);
4446
CLOCK_EnableClock(kCLOCK_PortB);

0 commit comments

Comments
 (0)