mirror of https://github.com/ARMmbed/mbed-os.git
commit
62855f06fb
|
@ -1,7 +1,7 @@
|
|||
523 Milosch Meriac
|
||||
422 Alessandro Angelino
|
||||
17 Niklas Hauser
|
||||
16 Jaeden Amero
|
||||
513 Milosch Meriac
|
||||
424 Alessandro Angelino
|
||||
18 Jaeden Amero
|
||||
18 Niklas Hauser
|
||||
3 Hugo Vincent
|
||||
3 JaredCJR
|
||||
3 Jim Huang
|
||||
|
|
|
@ -1 +1 @@
|
|||
v0.9.14-alpha-8-g1f0a4b9b181476c65d396838d61465ea5363e23b
|
||||
v0.9.17-alpha
|
||||
|
|
|
@ -33,7 +33,7 @@ TARGET_LIB_INC:=$(TARGET_PREFIX)includes/uvisor-lib
|
|||
|
||||
# uVisor source directory - hidden from mbed via TARGET_IGNORE
|
||||
UVISOR_GIT_URL:=https://github.com/ARMmbed/uvisor
|
||||
UVISOR_GIT_BRANCH:=dev
|
||||
UVISOR_GIT_BRANCH:=unstable
|
||||
UVISOR_DIR:=TARGET_IGNORE/uvisor
|
||||
UVISOR_API:=$(UVISOR_DIR)/api
|
||||
UVISOR_GIT_CFG=$(UVISOR_DIR)/.git/config
|
||||
|
|
|
@ -45,6 +45,8 @@ UVISOR_EXTERN const uint32_t __uvisor_mode;
|
|||
sizeof(RtxBoxIndex), \
|
||||
0, \
|
||||
0, \
|
||||
0, \
|
||||
0, \
|
||||
NULL, \
|
||||
acl_list, \
|
||||
acl_list_count \
|
||||
|
@ -76,6 +78,8 @@ UVISOR_EXTERN const uint32_t __uvisor_mode;
|
|||
sizeof(RtxBoxIndex), \
|
||||
context_size, \
|
||||
__uvisor_box_heapsize, \
|
||||
__uvisor_box_main_function, \
|
||||
__uvisor_box_main_priority, \
|
||||
__uvisor_box_namespace, \
|
||||
acl_list, \
|
||||
acl_list_count \
|
||||
|
@ -116,6 +120,13 @@ UVISOR_EXTERN const uint32_t __uvisor_mode;
|
|||
#define UVISOR_BOX_NAMESPACE(box_namespace) \
|
||||
static const char *const __uvisor_box_namespace = box_namespace
|
||||
|
||||
/* Use this macro before UVISOR_BOX_CONFIG to define the function the main
|
||||
* thread of your box will use for its body. If you don't want a main thread,
|
||||
* too bad: you have to have one. */
|
||||
#define UVISOR_BOX_MAIN(function, priority) \
|
||||
static void (*const __uvisor_box_main_function)(void const *) = (function); \
|
||||
static const int32_t __uvisor_box_main_priority = (priority);
|
||||
|
||||
#define UVISOR_BOX_HEAPSIZE(heap_size) \
|
||||
static const uint32_t __uvisor_box_heapsize = heap_size;
|
||||
|
||||
|
|
|
@ -116,6 +116,7 @@
|
|||
/* SVC immediate values for hardcoded table (call from unprivileged) */
|
||||
#define UVISOR_SVC_ID_UNVIC_OUT UVISOR_SVC_FIXED_TABLE(0, 0)
|
||||
#define UVISOR_SVC_ID_REGISTER_GATEWAY UVISOR_SVC_FIXED_TABLE(3, 0)
|
||||
#define UVISOR_SVC_ID_BOX_MAIN_NEXT UVISOR_SVC_FIXED_TABLE(5, 0)
|
||||
|
||||
/* SVC immediate values for hardcoded table (call from privileged) */
|
||||
#define UVISOR_SVC_ID_UNVIC_IN UVISOR_SVC_FIXED_TABLE(0, 0)
|
||||
|
|
|
@ -158,6 +158,9 @@ typedef struct {
|
|||
/* Contains user provided size of box heap without guards of buffers. */
|
||||
uint32_t heap_size;
|
||||
|
||||
void (*main_function)(void const *argument);
|
||||
int32_t main_priority;
|
||||
|
||||
const char * box_namespace;
|
||||
const UvisorBoxAclItem * const acl_list;
|
||||
uint32_t acl_count;
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"name": "uvisor-lib",
|
||||
"macros": ["CMSIS_NVIC_VIRTUAL", "CMSIS_VECTAB_VIRTUAL"]
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (c) 2016, ARM Limited, All Rights Reserved
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "uvisor-lib/uvisor-lib.h"
|
||||
#include "mbed_interface.h"
|
||||
#include "cmsis_os.h"
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* This function is called by uVisor in unprivileged mode to create box main
|
||||
* threads. */
|
||||
void __uvisor_lib_box_main_handler(
|
||||
void (*function)(void const *),
|
||||
int32_t priority,
|
||||
uint32_t stack_pointer,
|
||||
uint32_t stack_size)
|
||||
{
|
||||
osThreadId thread_id;
|
||||
osThreadDef_t thread_def;
|
||||
thread_def.pthread = function;
|
||||
thread_def.tpriority = priority;
|
||||
thread_def.stacksize = stack_size;
|
||||
thread_def.stack_pointer = malloc(stack_size); /* XXX */
|
||||
|
||||
thread_id = osThreadCreate(&thread_def, NULL);
|
||||
|
||||
if (thread_id == NULL) {
|
||||
mbed_die();
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -505,10 +505,6 @@ osStatus svcKernelStart (void) {
|
|||
|
||||
if (os_running) { return osOK; }
|
||||
|
||||
if (osEventObs && osEventObs->pre_start) {
|
||||
osEventObs->pre_start();
|
||||
}
|
||||
|
||||
rt_tsk_prio(0U, os_tsk.run->prio_base); // Restore priority
|
||||
if (os_tsk.run->task_id == 0xFFU) { // Idle Thread
|
||||
__set_PSP(os_tsk.run->tsk_stack + (8U*4U)); // Setup PSP
|
||||
|
@ -567,6 +563,15 @@ osStatus osKernelStart (void) {
|
|||
if (__get_IPSR() != 0U) {
|
||||
return osErrorISR; // Not allowed in ISR
|
||||
}
|
||||
|
||||
/* Call the pre-start event (from unprivileged mode) if the handler exists
|
||||
* and the kernel is not running. */
|
||||
/* FIXME osEventObs needs to be readable but not writable from unprivileged
|
||||
* code. */
|
||||
if (!osKernelRunning() && osEventObs && osEventObs->pre_start) {
|
||||
osEventObs->pre_start();
|
||||
}
|
||||
|
||||
switch (__get_CONTROL() & 0x03U) {
|
||||
case 0x00U: // Privileged Thread mode & MSP
|
||||
__set_PSP((uint32_t)(stack + 8)); // Initial PSP
|
||||
|
|
|
@ -51,5 +51,11 @@ const OsEventObserver *osEventObs;
|
|||
|
||||
void osRegisterForOsEvents(const OsEventObserver *observer)
|
||||
{
|
||||
static uint8_t has_been_called = 0;
|
||||
if (has_been_called) {
|
||||
return;
|
||||
}
|
||||
has_been_called = 1;
|
||||
|
||||
osEventObs = observer;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue