Skip to content

uVisor: Update to v0.25.0 #2774

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions features/FEATURE_UVISOR/AUTHORS.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
567 Milosch Meriac
470 Alessandro Angelino
49 Jaeden Amero
42 Niklas Hauser
568 Milosch Meriac
477 Alessandro Angelino
72 Jaeden Amero
53 Niklas Hauser
3 Hugo Vincent
3 JaredCJR
3 Jim Huang
Expand Down
2 changes: 1 addition & 1 deletion features/FEATURE_UVISOR/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.24.1
v0.25.0
2 changes: 1 addition & 1 deletion features/FEATURE_UVISOR/importer/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ rsync:
# Copying licenses
cp $(UVISOR_DIR)/LICENSE* $(TARGET_SUPPORTED)

TARGET_M%: $(TARGET_SUPPORTED)/*/*/*_m%_*.a
TARGET_M%: $(TARGET_SUPPORTED)/*/*/*_cortex_m%*.a
@printf "#\n# Copying $@ files...\n"
mkdir $(foreach file,$^,$(dir $(file))$@)
$(foreach file,$^,mv $(file) $(dir $(file))$@/lib$(notdir $(file));)
Expand Down
33 changes: 20 additions & 13 deletions features/FEATURE_UVISOR/includes/uvisor/api/inc/box_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include "api/inc/uvisor_exports.h"
#include "api/inc/page_allocator_exports.h"
#include "api/inc/rpc_exports.h"
#include <stddef.h>
#include <stdint.h>

Expand All @@ -43,10 +44,15 @@ UVISOR_EXTERN const uint32_t __uvisor_mode;
UVISOR_BOX_MAGIC, \
UVISOR_BOX_VERSION, \
0, \
sizeof(RtxBoxIndex), \
0, \
0, \
0, \
sizeof(RtxBoxIndex), \
{ \
0, \
sizeof(uvisor_rpc_outgoing_message_queue_t), \
sizeof(uvisor_rpc_incoming_message_queue_t), \
sizeof(uvisor_rpc_fn_group_queue_t), \
}, \
NULL, \
NULL, \
acl_list, \
acl_list_count \
Expand Down Expand Up @@ -74,7 +80,10 @@ UVISOR_EXTERN const uint32_t __uvisor_mode;
(UVISOR_MIN_STACK(stack_size) + \
(context_size) + \
(__uvisor_box_heapsize) + \
sizeof(RtxBoxIndex) \
sizeof(RtxBoxIndex) + \
sizeof(uvisor_rpc_outgoing_message_queue_t) + \
sizeof(uvisor_rpc_incoming_message_queue_t) + \
sizeof(uvisor_rpc_fn_group_queue_t) \
) \
* 8) \
/ 6)]; \
Expand All @@ -83,9 +92,14 @@ UVISOR_EXTERN const uint32_t __uvisor_mode;
UVISOR_BOX_MAGIC, \
UVISOR_BOX_VERSION, \
UVISOR_MIN_STACK(stack_size), \
sizeof(RtxBoxIndex), \
context_size, \
__uvisor_box_heapsize, \
sizeof(RtxBoxIndex), \
{ \
context_size, \
sizeof(uvisor_rpc_outgoing_message_queue_t), \
sizeof(uvisor_rpc_incoming_message_queue_t), \
sizeof(uvisor_rpc_fn_group_queue_t), \
}, \
__uvisor_box_lib_config, \
__uvisor_box_namespace, \
acl_list, \
Expand Down Expand Up @@ -139,13 +153,6 @@ UVISOR_EXTERN const uint32_t __uvisor_mode;

#define uvisor_ctx (*__uvisor_ps)

/* Return the numeric box ID of the current box. */
UVISOR_EXTERN 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);

/* 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
Expand Down
29 changes: 29 additions & 0 deletions features/FEATURE_UVISOR/includes/uvisor/api/inc/box_id.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* 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_BOX_ID_H__
#define __UVISOR_API_BOX_ID_H__

#include "api/inc/uvisor_exports.h"

/* Return the numeric box ID of the current box. */
UVISOR_EXTERN 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;

#endif /* __UVISOR_API_BOX_ID_H__ */
24 changes: 24 additions & 0 deletions features/FEATURE_UVISOR/includes/uvisor/api/inc/box_init.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* 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_BOX_INIT_H__
#define __UVISOR_API_BOX_INIT_H__

#include "api/inc/uvisor-lib.h"

UVISOR_EXTERN void __uvisor_lib_box_init(void * lib_config);

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#define __UVISOR_API_NVIC_VIRTUAL_H__

#include "api/inc/interrupts.h"
#include "api/inc/unvic_exports.h"

#define NVIC_SetPriorityGrouping __NVIC_SetPriorityGrouping
#define NVIC_GetPriorityGrouping __NVIC_GetPriorityGrouping
Expand All @@ -29,5 +30,6 @@
#define NVIC_GetActive __NVIC_GetActive
#define NVIC_SetPriority vIRQ_SetPriority
#define NVIC_GetPriority vIRQ_GetPriority
#define NVIC_SystemReset() vIRQ_SystemReset(RESET_REASON_NO_REASON)

#endif /* __UVISOR_API_NVIC_VIRTUAL_H__ */
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#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
Expand All @@ -39,9 +40,21 @@ typedef struct {

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
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
#define UVISOR_ERROR_INVALID_BOX_ID (-2)
#define UVISOR_ERROR_BUFFER_TOO_SMALL (-3)
#define UVISOR_ERROR_BOX_NAMESPACE_ANONYMOUS (-4)
#define UVISOR_ERROR_BAD_MAGIC (-5)
#define UVISOR_ERROR_BAD_VERSION (-6)
#define UVISOR_ERROR_OUT_OF_STRUCTURES (-7)
#define UVISOR_ERROR_INVALID_PARAMETERS (-8)
#define UVISOR_ERROR_NOT_IMPLEMENTED (-9)


#define UVISOR_ERROR_CLASS_MASK (0xFFFF0000UL)
Expand All @@ -29,6 +34,7 @@

typedef enum {
USER_NOT_ALLOWED = 1,
DEBUG_BOX_HALT,
} THaltUserError;

typedef enum {
Expand Down
7 changes: 7 additions & 0 deletions features/FEATURE_UVISOR/includes/uvisor/api/inc/interrupts.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#ifndef __UVISOR_API_INTERRUPTS_H__
#define __UVISOR_API_INTERRUPTS_H__

#include "api/inc/unvic_exports.h"
#include "api/inc/uvisor_exports.h"
#include <stdint.h>

Expand Down Expand Up @@ -60,4 +61,10 @@ UVISOR_EXTERN void vIRQ_DisableAll(void);
* ::vIRQ_DisableAll for more information. */
UVISOR_EXTERN void vIRQ_EnableAll(void);

/** 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);

#endif /* __UVISOR_API_INTERRUPTS_H__ */
36 changes: 36 additions & 0 deletions features/FEATURE_UVISOR/includes/uvisor/api/inc/lib_hook_exports.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* 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_LIB_HOOK_EXPORTS_H__
#define __UVISOR_API_LIB_HOOK_EXPORTS_H__

#include <stdint.h>

/* Predeclaration */
typedef struct uvisor_semaphore UvisorSemaphore;

/*
* uVisor library hooks
*
* All functions that uVisor needs to call that are implemented in uvisor-lib.
* These functions will be run by unprivileged code only. */
typedef struct {
void (*box_init)(void * lib_config);
int (*semaphore_init)(UvisorSemaphore * semaphore, int32_t count);
int (*semaphore_pend)(UvisorSemaphore * semaphore, uint32_t timeout_ms);
} UvisorLibHooks;

#endif
45 changes: 45 additions & 0 deletions features/FEATURE_UVISOR/includes/uvisor/api/inc/magic_exports.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* 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_MAGIC_EXPORTS_H__
#define __UVISOR_API_MAGIC_EXPORTS_H__

#include <stdint.h>

/* udf imm16
* UDF - ARMv7M ARM section A7.7.191
* 111 1;0 111;1111; <imm4>; 1 01 0; <imm12> (Encoding T2)
*/
#define UDF_OPCODE(imm16) \
((uint32_t) (0xA000F7F0UL | (((uint32_t) (imm16) & 0xFFFU) << 16U) | (((uint32_t) (imm16) & 0xF000UL) >> 12)))

/** Magics
*
* The following magics are used to verify various things within uVisor.The
* magics are chosen to be one of the explicitly undefined Thumb-2
* instructions.
*/
#if defined(__thumb__) && defined(__thumb2__)
#define UVISOR_RPC_GATEWAY_MAGIC_ASYNC UDF_OPCODE(0x07C2)
#define UVISOR_RPC_GATEWAY_MAGIC_SYNC UDF_OPCODE(0x07C3)
#define UVISOR_POOL_MAGIC UDF_OPCODE(0x07C4)
#define UVISOR_POOL_QUEUE_MAGIC UDF_OPCODE(0x07C5)
#else
#error "Unsupported instruction set. The ARM Thumb-2 instruction set must be supported."
#endif /* __thumb__ && __thumb2__ */


#endif /* __UVISOR_API_MAGIC_EXPORTS_H__ */
Loading