Merge pull request #2733 from meriac/master

uVisor: Debug Box & ENET DMA-support for default box
pull/2139/merge
Sam Grove 2016-09-19 22:55:13 -05:00 committed by GitHub
commit eccecd3735
28 changed files with 50 additions and 26 deletions

View File

@ -1,10 +1,11 @@
553 Milosch Meriac
458 Alessandro Angelino
567 Milosch Meriac
470 Alessandro Angelino
49 Jaeden Amero
42 Niklas Hauser
40 Jaeden Amero
3 Hugo Vincent
3 JaredCJR
3 Jim Huang
2 Vincenzo Frascino
2 tonyyanxuan
1 Aksel Skauge Mellbye
1 Irit Arkin

View File

@ -93,14 +93,15 @@ To enable the uVisor on the app, just add the following lines at the beginning o
#include "rtos.h"
#include "uvisor-lib/uvisor-lib.h"
/* Register privleged system IRQ hooks.
/* Register privleged system hooks.
* This is a system-wide configuration and it is independent from the app, but
* for the moment it needs to be specified in the app. This will change in a
* later version: The configuration will be provided by the OS. */
extern "C" void SVC_Handler(void);
extern "C" void PendSV_Handler(void);
extern "C" void SysTick_Handler(void);
UVISOR_SET_PRIV_SYS_IRQ_HOOKS(SVC_Handler, PendSV_Handler, SysTick_Handler);
extern "C" uint32_t rt_suspend(void);
UVISOR_SET_PRIV_SYS_HOOKS(SVC_Handler, PendSV_Handler, SysTick_Handler, rt_suspend);
/* Main box Access Control Lists (ACLs). */
/* 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);
In the code above we specified 3 elements:
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.
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.
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.
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.

View File

@ -1 +1 @@
v0.21.0-alpha
v0.24.1

View File

@ -31,4 +31,18 @@ typedef enum {
USER_NOT_ALLOWED = 1,
} THaltUserError;
typedef enum {
HALT_NO_ERROR = 0,
PERMISSION_DENIED = 1,
SANITY_CHECK_FAILED,
NOT_IMPLEMENTED,
NOT_ALLOWED,
FAULT_MEMMANAGE,
FAULT_BUS,
FAULT_USAGE,
FAULT_HARD,
FAULT_DEBUG,
__THALTERROR_MAX /* always keep as the last element of the enum */
} THaltError;
#endif /* __UVISOR_API_HALT_EXPORTS_H__ */

View File

@ -14,31 +14,36 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __UVISOR_API_PRIV_SYS_IRQ_HOOK_EXPORTS_H__
#define __UVISOR_API_PRIV_SYS_IRQ_HOOK_EXPORTS_H__
#ifndef __UVISOR_API_PRIV_SYS_HOOK_EXPORTS_H__
#define __UVISOR_API_PRIV_SYS_HOOK_EXPORTS_H__
/*
* Privileged system interrupt hooks
* Privileged system hooks
*
* In this version of uVisor, uVisor lives alongside an RTOS that requires
* running privileged code. In order for the RTOS to run any privileged code,
* uVisor must allow the RTOS to handle a subset of privileged system
* interrupts. Only the following system interrupts are hookable. Code called
* by these hooks circumvents uVisor security. HANDLE WITH CARE. */
* interrupts or system calls. Only the following system interrupts and system
* calls are hookable. Code called by these hooks circumvents uVisor security.
* HANDLE WITH CARE. */
typedef struct {
void (*priv_svc_0)(void);
void (*priv_pendsv)(void);
void (*priv_systick)(void);
} UvisorPrivSystemIRQHooks;
uint32_t (*priv_os_suspend)(void);
} UvisorPrivSystemHooks;
/* Use this macro to register privileged system IRQ hooks. If you don't want to
* register a particular privileged system IRQ hook, you can supply NULL for
* that hook parameter. */
#define UVISOR_SET_PRIV_SYS_IRQ_HOOKS(priv_svc_0_, priv_pendsv_, priv_systick_) \
UVISOR_EXTERN const UvisorPrivSystemIRQHooks __uvisor_priv_sys_irq_hooks = { \
#define UVISOR_SET_PRIV_SYS_HOOKS(priv_svc_0_, priv_pendsv_, priv_systick_, priv_os_suspend_) \
UVISOR_EXTERN_C_BEGIN \
const UvisorPrivSystemHooks __uvisor_priv_sys_hooks = { \
.priv_svc_0 = priv_svc_0_, \
.priv_pendsv = priv_pendsv_, \
.priv_systick = priv_systick_, \
};
.priv_os_suspend = priv_os_suspend_, \
}; \
UVISOR_EXTERN_C_END
#endif

View File

@ -59,7 +59,7 @@ UVISOR_EXTERN int uvisor_lib_init(void);
#include "api/inc/register_gateway_exports.h"
#include "api/inc/rpc_gateway_exports.h"
#include "api/inc/svc_exports.h"
#include "api/inc/priv_sys_irq_hook_exports.h"
#include "api/inc/priv_sys_hook_exports.h"
#include "api/inc/unvic_exports.h"
#include "api/inc/uvisor_exports.h"
#include "api/inc/vmpu_exports.h"

View File

@ -59,13 +59,6 @@
#if defined(UVISOR_PRESENT) && UVISOR_PRESENT == 1
/* subregion mask for ARMv7M */
#if defined(ARCH_MPU_ARMv7M)
#define UVISOR_TACL_SUBREGIONS_POS 24
#define UVISOR_TACL_SUBREGIONS_MASK (0xFFUL << UVISOR_TACL_SUBREGIONS_POS)
#define UVISOR_TACL_SUBREGIONS(x) ( (((uint32_t) (x)) << UVISOR_TACL_SUBREGIONS_POS) & UVISOR_TACL_SUBREGIONS_MASK )
#endif
#endif /* defined(UVISOR_PRESENT) && UVISOR_PRESENT == 1 */
#define UVISOR_TACLDEF_SECURE_BSS (UVISOR_TACL_UREAD |\

View File

@ -20,6 +20,14 @@
#include <stdint.h>
#include <string.h>
/* Register the OS with uVisor */
extern void SVC_Handler(void);
extern void PendSV_Handler(void);
extern void SysTick_Handler(void);
extern uint32_t rt_suspend(void);
UVISOR_SET_PRIV_SYS_HOOKS(SVC_Handler, PendSV_Handler, SysTick_Handler, rt_suspend);
/* This function is called by uVisor in unprivileged mode. On this OS, we
* create box main threads for the box. */
void __uvisor_lib_box_init(void * lib_config)

View File

@ -29,7 +29,7 @@ extern uint32_t __HeapLimit[]; /* __heap_end */
extern uint32_t __StackLimit[]; /* bottom of stack */
/* There is only one box index for box 0. */
RtxBoxIndex * __uvisor_ps;
RtxBoxIndex * __uvisor_ps UVISOR_ALIGN(4);
static void box_index_init(void *box_bss, uint32_t heap_size)
{

View File

@ -37,8 +37,10 @@ void k64f_init_eth_hardware(void)
{
port_pin_config_t configENET = {0};
/* Disable MPU. */
#ifndef FEATURE_UVISOR
/* Disable MPU only when uVisor is not around. */
MPU->CESR &= ~MPU_CESR_VLD_MASK;
#endif/*FEATURE_UVISOR*/
CLOCK_EnableClock(kCLOCK_PortC);
CLOCK_EnableClock(kCLOCK_PortB);