Merge pull request #3270 from AlessandroA/update_uvisor

uVisor: Update to v0.26.1
pull/3179/merge
Anna Bridge 2016-11-24 13:22:14 +00:00 committed by GitHub
commit fd7d5eca14
30 changed files with 253 additions and 196 deletions

View File

@ -1,13 +1,13 @@
569 Milosch Meriac
478 Alessandro Angelino
73 Jaeden Amero
54 Niklas Hauser
3 Hugo Vincent
584 Milosch Meriac
501 Alessandro Angelino
95 Jaeden Amero
61 Niklas Hauser
4 Irit Arkin
3 JaredCJR
3 Jim Huang
2 Vincenzo Frascino
3 Hugo Vincent
2 tonyyanxuan
2 Vincenzo Frascino
1 Aksel Skauge Mellbye
1 Irit Arkin
1 Nathan Chong
1 ccli8
1 Nathan Chong

View File

@ -1 +1 @@
v0.25.1
v0.26.1

View File

@ -96,6 +96,12 @@ publish: rsync TARGET_M3 TARGET_M4
#
# Rename target directorires to TARGET_* filters...
$(foreach target, $(TARGET_TRANSLATION),mv $(TARGET_SUPPORTED)/$(subst .,,$(suffix $(target))) $(TARGET_SUPPORTED)/TARGET_$(basename $(target));)
#
# Updating checked out version tag
git -C $(UVISOR_DIR) describe --tags --abbrev=40 --dirty > $(TARGET_PREFIX)VERSION.txt
#
# Updated list of authors, sorted by contributions
git -C $(UVISOR_DIR) shortlog -s -n > $(TARGET_PREFIX)AUTHORS.txt
uvisor-compile: $(UVISOR_GIT_CFG)
make -C $(UVISOR_DIR)
@ -104,12 +110,6 @@ update: $(UVISOR_GIT_CFG)
#
# Updating to latest uVisor library version
git -C $(UVISOR_DIR) pull --rebase
#
# Updating checked out version tag
git -C $(UVISOR_DIR) describe --tags --abbrev=40 --dirty > $(TARGET_PREFIX)VERSION.txt
#
# Updated list of authors, sorted by contributions
git -C $(UVISOR_DIR) shortlog -s -n > $(TARGET_PREFIX)AUTHORS.txt
$(UVISOR_GIT_CFG):
rm -rf $(UVISOR_DIR)

View File

@ -0,0 +1,86 @@
/*
* 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.
*/
#ifndef __UVISOR_API_H__
#define __UVISOR_API_H__
#include "rt_OsEventObserver.h"
#include "api/inc/uvisor_exports.h"
#include "api/inc/unvic_exports.h"
#include "api/inc/debug_exports.h"
#include "api/inc/halt_exports.h"
#include "api/inc/pool_queue_exports.h"
#include "api/inc/page_allocator_exports.h"
#include <stdint.h>
#define UVISOR_API_MAGIC 0x5C9411B4
#define UVISOR_API_VERSION (10)
UVISOR_EXTERN_C_BEGIN
extern void uvisor_init(void);
typedef struct {
uint32_t magic;
uint32_t (*get_version)(uint32_t);
void (*init)(void);
void (*irq_enable)(uint32_t irqn);
void (*irq_disable)(uint32_t irqn);
void (*irq_disable_all)(void);
void (*irq_enable_all)(void);
void (*irq_set_vector)(uint32_t irqn, uint32_t vector);
uint32_t (*irq_get_vector)(uint32_t irqn);
void (*irq_set_priority)(uint32_t irqn, uint32_t priority);
uint32_t (*irq_get_priority)(uint32_t irqn);
void (*irq_set_pending)(uint32_t irqn);
uint32_t (*irq_get_pending)(uint32_t irqn);
void (*irq_clear_pending)(uint32_t irqn);
int (*irq_get_level)(void);
void (*irq_system_reset)(TResetReason reason);
int (*page_malloc)(UvisorPageTable * const table);
int (*page_free)(const UvisorPageTable * const table);
int (*box_namespace)(int box_id, char *box_namespace, size_t length);
void (*debug_init)(const TUvisorDebugDriver * const driver);
void (*error)(THaltUserError reason);
void (*vmpu_mem_invalidate)(void);
int (*pool_init)(uvisor_pool_t *, void *, size_t, size_t, int);
int (*pool_queue_init)(uvisor_pool_queue_t *, uvisor_pool_t *, void *, size_t, size_t, int);
uvisor_pool_slot_t (*pool_allocate)(uvisor_pool_t *, uint32_t);
void (*pool_queue_enqueue)(uvisor_pool_queue_t *, uvisor_pool_slot_t);
uvisor_pool_slot_t (*pool_free)(uvisor_pool_t *, uvisor_pool_slot_t);
uvisor_pool_slot_t (*pool_queue_dequeue)(uvisor_pool_queue_t *, uvisor_pool_slot_t);
uvisor_pool_slot_t (*pool_queue_dequeue_first)(uvisor_pool_queue_t *);
uvisor_pool_slot_t (*pool_queue_find_first)(uvisor_pool_queue_t *, TQueryFN_Ptr, void *);
OsEventObserver os_event_observer;
} UVISOR_PACKED UvisorApi;
extern UvisorApi uvisor_api;
static UVISOR_FORCEINLINE uint32_t uvisor_get_version(void)
{
return uvisor_api.get_version(UVISOR_API_VERSION);
}
UVISOR_EXTERN_C_END
#endif /* __UVISOR_API_H__ */

View File

@ -24,6 +24,7 @@
#include <stdint.h>
UVISOR_EXTERN const uint32_t __uvisor_mode;
UVISOR_EXTERN void const * const main_cfg_ptr;
#define UVISOR_DISABLED 0
#define UVISOR_PERMISSIVE 1
@ -58,7 +59,7 @@ UVISOR_EXTERN const uint32_t __uvisor_mode;
acl_list_count \
}; \
\
extern const __attribute__((section(".keep.uvisor.cfgtbl_ptr_first"), aligned(4))) void * const main_cfg_ptr = &main_cfg;
UVISOR_EXTERN const __attribute__((section(".keep.uvisor.cfgtbl_ptr_first"), aligned(4))) void * const main_cfg_ptr = &main_cfg;
/* Creates a global page heap with at least `minimum_number_of_pages` each of size `page_size` in bytes.
* The total page heap size is at least `minimum_number_of_pages * page_size`. */
@ -106,7 +107,10 @@ UVISOR_EXTERN const uint32_t __uvisor_mode;
acl_list_count \
}; \
\
extern const __attribute__((section(".keep.uvisor.cfgtbl_ptr"), aligned(4))) void * const box_name ## _cfg_ptr = &box_name ## _cfg;
UVISOR_EXTERN const __attribute__((section(".keep.uvisor.cfgtbl_ptr"), aligned(4))) void * const box_name ## _cfg_ptr = &box_name ## _cfg;
#define UVISOR_BOX_EXTERN(box_name) \
UVISOR_EXTERN const __attribute__((section(".keep.uvisor.cfgtbl_ptr"), aligned(4))) void * const box_name ## _cfg_ptr;
#define __UVISOR_BOX_CONFIG_NOCONTEXT(box_name, acl_list, stack_size) \
__UVISOR_BOX_CONFIG(box_name, acl_list, UVISOR_ARRAY_COUNT(acl_list), stack_size, 0) \
@ -153,13 +157,4 @@ UVISOR_EXTERN const uint32_t __uvisor_mode;
#define uvisor_ctx (*__uvisor_ps)
/* Copy the box namespace of the specified box ID to the memory provided by
* box_namespace. The box_namespace's length must be at least
* MAX_BOX_NAMESPACE_LENGTH bytes. Return how many bytes were copied into
* box_namespace. Return UVISOR_ERROR_INVALID_BOX_ID if the provided box ID is
* invalid. Return UVISOR_ERROR_BUFFER_TOO_SMALL if the provided box_namespace
* is too small to hold MAX_BOX_NAMESPACE_LENGTH bytes. Return
* UVISOR_ERROR_BOX_NAMESPACE_ANONYMOUS if the box is anonymous. */
UVISOR_EXTERN int uvisor_box_namespace(int box_id, char *box_namespace, size_t length);
#endif /* __UVISOR_API_BOX_CONFIG_H__ */

View File

@ -17,13 +17,29 @@
#ifndef __UVISOR_API_BOX_ID_H__
#define __UVISOR_API_BOX_ID_H__
#include "api/inc/uvisor_exports.h"
#include "api/inc/api.h"
UVISOR_EXTERN_C_BEGIN
/* Return the numeric box ID of the current box. */
UVISOR_EXTERN int uvisor_box_id_self(void);
int uvisor_box_id_self(void);
/* Return the numeric box ID of the box that is calling through the most recent
* secure gateway. Return -1 if there is no secure gateway calling box. */
UVISOR_EXTERN int uvisor_box_id_caller(void) UVISOR_DEPRECATED;
int uvisor_box_id_caller(void) UVISOR_DEPRECATED;
/* Copy the box namespace of the specified box ID to the memory provided by
* box_namespace. The box_namespace's length must be at least
* MAX_BOX_NAMESPACE_LENGTH bytes. Return how many bytes were copied into
* box_namespace. Return UVISOR_ERROR_INVALID_BOX_ID if the provided box ID is
* invalid. Return UVISOR_ERROR_BUFFER_TOO_SMALL if the provided box_namespace
* is too small to hold MAX_BOX_NAMESPACE_LENGTH bytes. Return
* UVISOR_ERROR_BOX_NAMESPACE_ANONYMOUS if the box is anonymous. */
static UVISOR_FORCEINLINE int uvisor_box_namespace(int box_id, char *box_namespace, size_t length)
{
return uvisor_api.box_namespace(box_id, box_namespace, length);
}
UVISOR_EXTERN_C_END
#endif /* __UVISOR_API_BOX_ID_H__ */

View File

@ -20,6 +20,13 @@
#include "api/inc/debug_exports.h"
#include "api/inc/uvisor_exports.h"
UVISOR_EXTERN void uvisor_debug_init(const TUvisorDebugDriver * const driver);
UVISOR_EXTERN_C_BEGIN
static UVISOR_FORCEINLINE void uvisor_debug_init(const TUvisorDebugDriver * const driver)
{
uvisor_api.debug_init(driver);
}
UVISOR_EXTERN_C_END
#endif /* __UVISOR_API_DEBUG_H__ */

View File

@ -19,7 +19,15 @@
#include "api/inc/halt_exports.h"
#include "api/inc/uvisor_exports.h"
#include "api/inc/api.h"
UVISOR_EXTERN void uvisor_error(THaltUserError reason);
UVISOR_EXTERN_C_BEGIN
static UVISOR_FORCEINLINE void uvisor_error(THaltUserError reason)
{
uvisor_api.error(reason);
}
UVISOR_EXTERN_C_END
#endif /* __UVISOR_API_ERROR_H__ */

View File

@ -1,60 +0,0 @@
/*
* 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.
*/
#ifndef __UVISOR_API_EXPORT_TABLE_EXPORTS_H__
#define __UVISOR_API_EXPORT_TABLE_EXPORTS_H__
#include "rt_OsEventObserver.h"
#include "api/inc/pool_queue_exports.h"
#include <stdint.h>
/* If this magic doesn't match what you get in a TUvisorExportTable, then you
* didn't find a TUvisorExportTable and all bets are off as to what will be
* contained in what you found. */
#define UVISOR_EXPORT_MAGIC 0x5C9411B4
/* This is the export table API version. If this version doesn't match what you
* get in TUvisorExportTable, then you need a different header file to
* understand the TUvisorExportTable. */
#define UVISOR_EXPORT_VERSION 0
typedef struct {
/* magic and version must be present as the first two elements in this
* table so that across various versions of the table layout, the table can
* be interpreted correctly. */
uint32_t magic;
uint32_t version;
OsEventObserver os_event_observer;
UvisorPoolTable pool;
/* This must be the last element of the table so that uvisor-input.S can
* export the size statically. */
uint32_t size;
} TUvisorExportTable;
static inline TUvisorExportTable const * uvisor_export_table(void)
{
/* Defined in uvisor-input.S */
extern uint32_t uvisor_config;
extern uint32_t uvisor_export_table_size;
uintptr_t uvisor_config_addr = (uintptr_t) &uvisor_config;
return (TUvisorExportTable *) (uvisor_config_addr - uvisor_export_table_size);
}
#endif

View File

@ -25,6 +25,7 @@
#define UVISOR_ERROR_OUT_OF_STRUCTURES (-7)
#define UVISOR_ERROR_INVALID_PARAMETERS (-8)
#define UVISOR_ERROR_NOT_IMPLEMENTED (-9)
#define UVISOR_ERROR_TIMEOUT (-10)
#define UVISOR_ERROR_CLASS_MASK (0xFFFF0000UL)

View File

@ -19,18 +19,60 @@
#include "api/inc/unvic_exports.h"
#include "api/inc/uvisor_exports.h"
#include "api/inc/api.h"
#include <stdint.h>
UVISOR_EXTERN void vIRQ_SetVector(uint32_t irqn, uint32_t vector);
UVISOR_EXTERN uint32_t vIRQ_GetVector(uint32_t irqn);
UVISOR_EXTERN void vIRQ_EnableIRQ(uint32_t irqn);
UVISOR_EXTERN void vIRQ_DisableIRQ(uint32_t irqn);
UVISOR_EXTERN void vIRQ_ClearPendingIRQ(uint32_t irqn);
UVISOR_EXTERN void vIRQ_SetPendingIRQ(uint32_t irqn);
UVISOR_EXTERN uint32_t vIRQ_GetPendingIRQ(uint32_t irqn);
UVISOR_EXTERN void vIRQ_SetPriority(uint32_t irqn, uint32_t priority);
UVISOR_EXTERN uint32_t vIRQ_GetPriority(uint32_t irqn);
UVISOR_EXTERN int vIRQ_GetLevel(void);
UVISOR_EXTERN_C_BEGIN
static UVISOR_FORCEINLINE void vIRQ_SetVector(uint32_t irqn, uint32_t vector)
{
uvisor_api.irq_set_vector(irqn, vector);
}
static UVISOR_FORCEINLINE uint32_t vIRQ_GetVector(uint32_t irqn)
{
return uvisor_api.irq_get_vector(irqn);
}
static UVISOR_FORCEINLINE void vIRQ_EnableIRQ(uint32_t irqn)
{
uvisor_api.irq_enable(irqn);
}
static UVISOR_FORCEINLINE void vIRQ_DisableIRQ(uint32_t irqn)
{
uvisor_api.irq_disable(irqn);
}
static UVISOR_FORCEINLINE void vIRQ_ClearPendingIRQ(uint32_t irqn)
{
uvisor_api.irq_clear_pending(irqn);
}
static UVISOR_FORCEINLINE void vIRQ_SetPendingIRQ(uint32_t irqn)
{
uvisor_api.irq_set_pending(irqn);
}
static UVISOR_FORCEINLINE uint32_t vIRQ_GetPendingIRQ(uint32_t irqn)
{
return uvisor_api.irq_get_pending(irqn);
}
static UVISOR_FORCEINLINE void vIRQ_SetPriority(uint32_t irqn, uint32_t priority)
{
uvisor_api.irq_set_priority(irqn, priority);
}
static UVISOR_FORCEINLINE uint32_t vIRQ_GetPriority(uint32_t irqn)
{
return uvisor_api.irq_get_priority(irqn);
}
static UVISOR_FORCEINLINE int vIRQ_GetLevel(void)
{
return uvisor_api.irq_get_level();
}
/** Disable all interrupts for the currently active box.
*
@ -51,7 +93,10 @@ UVISOR_EXTERN int vIRQ_GetLevel(void);
* vIRQ_EnableAll(); counter = 0; IRQs are now re-enabled.
*
* where some_function() also has a disable/enable pair. */
UVISOR_EXTERN void vIRQ_DisableAll(void);
static UVISOR_FORCEINLINE void vIRQ_DisableAll(void)
{
uvisor_api.irq_disable_all();
}
/** Re-enable all interrupts that were previously disabled for the currently
* active box.
@ -59,12 +104,20 @@ UVISOR_EXTERN void vIRQ_DisableAll(void);
* This function only re-enables interrupt if the uVisor internal counter is set
* to 0, to make sure that nested disabling of IRQs is still effective. See
* ::vIRQ_DisableAll for more information. */
UVISOR_EXTERN void vIRQ_EnableAll(void);
static UVISOR_FORCEINLINE void vIRQ_EnableAll(void)
{
uvisor_api.irq_enable_all();
}
/** Reset the device.
* @warning Currently only the debug box can reset the device.
* @param reason[in] Reason for rebooting. Currently not used.
*/
UVISOR_EXTERN void vIRQ_SystemReset(TResetReason reason);
static UVISOR_FORCEINLINE void vIRQ_SystemReset(TResetReason reason)
{
return uvisor_api.irq_system_reset(reason);
}
UVISOR_EXTERN_C_END
#endif /* __UVISOR_API_INTERRUPTS_H__ */

View File

@ -19,22 +19,36 @@
#include "api/inc/uvisor_exports.h"
#include "api/inc/page_allocator_exports.h"
#include "api/inc/api.h"
#include <stdint.h>
UVISOR_EXTERN_C_BEGIN
/* Allocate a number of requested pages with the requested page size.
* @param table.page_size[in] Must be equal to the current page size
* @param table.page_count[in] The number of pages to be allocated
* @param table.page_origins[out] Pointers to the page origins. The table must be large enough to hold page_count entries.
* @returns Non-zero on failure with failure class `UVISOR_ERROR_CLASS_PAGE`. See `UVISOR_ERROR_PAGE_*`.
*/
UVISOR_EXTERN int uvisor_page_malloc(UvisorPageTable * const table);
static UVISOR_FORCEINLINE int uvisor_page_malloc(UvisorPageTable * const table)
{
return uvisor_api.page_malloc(table);
}
/* Free the pages associated with the table, only if it passes validation.
* @returns Non-zero on failure with failure class `UVISOR_ERROR_CLASS_PAGE`. See `UVISOR_ERROR_PAGE_*`.
*/
UVISOR_EXTERN int uvisor_page_free(const UvisorPageTable * const table);
static UVISOR_FORCEINLINE int uvisor_page_free(const UvisorPageTable * const table)
{
return uvisor_api.page_free(table);
}
/* @returns the active page size for one page. */
UVISOR_EXTERN uint32_t uvisor_get_page_size(void);
static UVISOR_FORCEINLINE uint32_t uvisor_get_page_size(void)
{
return __uvisor_page_size;
}
UVISOR_EXTERN_C_END
#endif /* __UVISOR_API_PAGE_ALLOCATOR_H__ */

View File

@ -194,15 +194,4 @@ static inline void * uvisor_pool_pointer_to(uvisor_pool_t * pool, uvisor_pool_sl
return (uint8_t *) pool->array + pool->stride * slot;
}
typedef struct {
int (*init)(uvisor_pool_t *, void *, size_t, size_t, int);
int (*queue_init)(uvisor_pool_queue_t *, uvisor_pool_t *, void *, size_t, size_t, int);
uvisor_pool_slot_t (*allocate)(uvisor_pool_t *, uint32_t);
void (*queue_enqueue)(uvisor_pool_queue_t *, uvisor_pool_slot_t);
uvisor_pool_slot_t (*free)(uvisor_pool_t *, uvisor_pool_slot_t);
uvisor_pool_slot_t (*queue_dequeue)(uvisor_pool_queue_t *, uvisor_pool_slot_t);
uvisor_pool_slot_t (*queue_dequeue_first)(uvisor_pool_queue_t *);
uvisor_pool_slot_t (*queue_find_first)(uvisor_pool_queue_t *, TQueryFN_Ptr, void *);
} UvisorPoolTable;
#endif

View File

@ -19,6 +19,7 @@
#include "api/inc/register_gateway_exports.h"
#include "api/inc/uvisor_exports.h"
#include "api/inc/svc_exports.h"
#include <stdint.h>
/** Get the offset of a struct member.
@ -26,6 +27,9 @@
*/
#define __UVISOR_OFFSETOF(type, member) ((uint32_t) (&(((type *)(0))->member)))
/** Generate the SVCall opcode from the SVC ID. */
#define UVISOR_SVC_OPCODE(id) ((uint16_t) (0xDF00 | ((id) & 0xFF)))
/** Generate the opcode of the 16-bit Thumb-2 16-bit T2 encoding of the branch
* instruction.
* @internal

View File

@ -18,6 +18,7 @@
#define __UVISOR_API_SVC_EXPORTS_H__
#include "api/inc/uvisor_exports.h"
#include "api/inc/api.h"
#include <stdint.h>
/* An SVCall takes a 8bit immediate, which is used as follows:
@ -88,31 +89,6 @@
UVISOR_SVC_FAST_INDEX(index) | \
UVISOR_SVC_FAST_NARGS_SET(nargs)))
/* SVC immediate values for custom table */
#define UVISOR_SVC_ID_ISR_SET UVISOR_SVC_CUSTOM_TABLE(1)
#define UVISOR_SVC_ID_ISR_GET UVISOR_SVC_CUSTOM_TABLE(2)
#define UVISOR_SVC_ID_IRQ_ENABLE UVISOR_SVC_CUSTOM_TABLE(3)
#define UVISOR_SVC_ID_IRQ_DISABLE UVISOR_SVC_CUSTOM_TABLE(4)
#define UVISOR_SVC_ID_IRQ_PEND_CLR UVISOR_SVC_CUSTOM_TABLE(5)
#define UVISOR_SVC_ID_IRQ_PEND_SET UVISOR_SVC_CUSTOM_TABLE(6)
#define UVISOR_SVC_ID_IRQ_PEND_GET UVISOR_SVC_CUSTOM_TABLE(7)
#define UVISOR_SVC_ID_IRQ_PRIO_SET UVISOR_SVC_CUSTOM_TABLE(8)
#define UVISOR_SVC_ID_IRQ_PRIO_GET UVISOR_SVC_CUSTOM_TABLE(9)
#define UVISOR_SVC_ID_BENCHMARK_CFG UVISOR_SVC_CUSTOM_TABLE(10)
#define UVISOR_SVC_ID_BENCHMARK_RST UVISOR_SVC_CUSTOM_TABLE(11)
#define UVISOR_SVC_ID_BENCHMARK_STOP UVISOR_SVC_CUSTOM_TABLE(12)
#define UVISOR_SVC_ID_HALT_USER_ERR UVISOR_SVC_CUSTOM_TABLE(13)
#define UVISOR_SVC_ID_IRQ_LEVEL_GET UVISOR_SVC_CUSTOM_TABLE(14)
#define UVISOR_SVC_ID_BOX_ID_SELF UVISOR_SVC_CUSTOM_TABLE(15)
#define UVISOR_SVC_ID_BOX_ID_CALLER UVISOR_SVC_CUSTOM_TABLE(16)
#define UVISOR_SVC_ID_BOX_NAMESPACE_FROM_ID UVISOR_SVC_CUSTOM_TABLE(17)
#define UVISOR_SVC_ID_DEBUG_REBOOT UVISOR_SVC_CUSTOM_TABLE(18)
#define UVISOR_SVC_ID_DEBUG_REGISTER_BOX UVISOR_SVC_CUSTOM_TABLE(19)
#define UVISOR_SVC_ID_IRQ_DISABLE_ALL UVISOR_SVC_CUSTOM_TABLE(20)
#define UVISOR_SVC_ID_IRQ_ENABLE_ALL UVISOR_SVC_CUSTOM_TABLE(21)
#define UVISOR_SVC_ID_PAGE_MALLOC UVISOR_SVC_CUSTOM_TABLE(22)
#define UVISOR_SVC_ID_PAGE_FREE UVISOR_SVC_CUSTOM_TABLE(23)
/* SVC immediate values for hardcoded table (call from unprivileged) */
#define UVISOR_SVC_ID_UNVIC_OUT UVISOR_SVC_FIXED_TABLE(0, 0)
/* Deprecated: UVISOR_SVC_ID_CX_IN(nargs) UVISOR_SVC_FIXED_TABLE(1, nargs) */
@ -124,42 +100,4 @@
/* SVC immediate values for hardcoded table (call from privileged) */
#define UVISOR_SVC_ID_UNVIC_IN UVISOR_SVC_FIXED_TABLE(0, 0)
/** Generate the SVCall opcode from the SVC ID. */
#define UVISOR_SVC_OPCODE(id) ((uint16_t) 0xDF00 | (uint8_t) ((id) & 0xFF))
/* macro to execute an SVCall; additional metadata can be provided, which will
* be appended right after the svc instruction */
/* note: the macro is implicitly overloaded to allow 0 to 4 32bits arguments */
#if defined(__CC_ARM)
#elif defined(__GNUC__)
#define UVISOR_SVC(id, metadata, ...) \
({ \
UVISOR_MACRO_REGS_ARGS(uint32_t, ##__VA_ARGS__); \
UVISOR_MACRO_REGS_RETVAL(uint32_t, res); \
asm volatile( \
"svc %[svc_id]\n" \
metadata \
: UVISOR_MACRO_GCC_ASM_OUTPUT(res) \
: UVISOR_MACRO_GCC_ASM_INPUT(__VA_ARGS__), \
[svc_id] "I" ((id) & 0xFF) \
); \
res; \
})
#define UVISOR_FUNCTION_CALL(dst_fn, ...) \
({ \
UVISOR_MACRO_REGS_ARGS(uint32_t, ##__VA_ARGS__); \
UVISOR_MACRO_REGS_RETVAL(uint32_t, res); \
asm volatile( \
"bl " UVISOR_TO_STRING(dst_fn) "\n" \
: UVISOR_MACRO_GCC_ASM_OUTPUT(res) \
: UVISOR_MACRO_GCC_ASM_INPUT(__VA_ARGS__) \
); \
res; \
})
#endif /* defined(__CC_ARM) || defined(__GNUC__) */
#endif /* __UVISOR_API_SVC_EXPORTS_H__ */

View File

@ -21,7 +21,7 @@
/* this value refers to the minimum allowable priority in the physical NVIC
* module, but not in the virtualised one (vIRQ) */
#define __UVISOR_NVIC_MIN_PRIORITY ((uint32_t) 1)
#define __UVISOR_NVIC_MIN_PRIORITY ((uint32_t) 2)
/* this is the maximum priority allowed for the vIRQ module */
/* users of uVisor APIs can use this to determine the maximum level of

View File

@ -25,7 +25,7 @@
#if defined(UVISOR_PRESENT) && UVISOR_PRESENT == 1
/* Library header files */
#include "api/inc/benchmark.h"
#include "api/inc/api.h"
#include "api/inc/box_config.h"
#include "api/inc/box_id.h"
#include "api/inc/debug.h"
@ -37,6 +37,7 @@
#include "api/inc/rpc_gateway.h"
#include "api/inc/secure_access.h"
#include "api/inc/uvisor_semaphore.h"
#include "api/inc/vmpu.h"
#else /* defined(UVISOR_PRESENT) && UVISOR_PRESENT == 1 */
@ -56,11 +57,9 @@ UVISOR_EXTERN int uvisor_lib_init(void);
* target platform. */
#include "api/inc/debug_exports.h"
#include "api/inc/context_exports.h"
#include "api/inc/export_table_exports.h"
#include "api/inc/halt_exports.h"
#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_hook_exports.h"
#include "api/inc/unvic_exports.h"
#include "api/inc/uvisor_exports.h"

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2015, ARM Limited, All Rights Reserved
* Copyright (c) 2013-2016, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -14,14 +14,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __UVISOR_API_BENCHMARK_H__
#define __UVISOR_API_BENCHMARK_H__
#ifndef __UVISOR_API_VMPU_H__
#define __UVISOR_API_VMPU_H__
#include "api/inc/uvisor_exports.h"
#include <stdint.h>
#include "api/inc/api.h"
UVISOR_EXTERN void uvisor_benchmark_configure(void);
UVISOR_EXTERN void uvisor_benchmark_start(void);
UVISOR_EXTERN uint32_t uvisor_benchmark_stop(void);
UVISOR_EXTERN_C_BEGIN
#endif /* __UVISOR_API_BENCHMARK_H__ */
/* Invalidate all regions in the MPU, forcing subsequent memory accesses to
* fault. */
static UVISOR_FORCEINLINE void uvisor_vmpu_mem_invalidate(void)
{
uvisor_api.vmpu_mem_invalidate();
}
UVISOR_EXTERN_C_END
#endif /* __UVISOR_API_VMPU_H__ */

View File

@ -23,8 +23,8 @@
#include <uvisor.h>
#include "page_allocator.h"
#include "page_allocator_faults.h"
#include "mpu/vmpu_unpriv_access.h"
#include "mpu/vmpu.h"
#include "vmpu_unpriv_access.h"
#include "vmpu.h"
#include "halt.h"
#include "context.h"

View File

@ -35,7 +35,7 @@ int __uvisor_semaphore_pend(UvisorSemaphore * s, uint32_t timeout_ms)
}
if (num_available_tokens == 0) {
return UVISOR_ERROR_OUT_OF_STRUCTURES;
return UVISOR_ERROR_TIMEOUT;
}
return 0;