Example #1
0
int vIRQ_GetLevel(void)
{
    /* if uVisor is disabled we use the standard priority levels */
    if (__uvisor_mode == 0) {
        /* check if an IRQn is active (an ISR is being served) */
        uint32_t ipsr = __get_IPSR();
        int irqn = (int) (ipsr & 0x1FF) - NVIC_USER_IRQ_OFFSET;
        if (irqn >= NVIC_NUM_VECTORS || !ipsr || !NVIC_GetActive((IRQn_Type) irqn)) {
            return -1;
        }

        /* return the priority level of the active IRQ */
        /* if we are in a system interrupt we do not provide the actual
         * priority level, which is usually negative, since we already use -1
         * for stating "no IRQn is active". This is consistent with the
         * behavior of the actual uVisor-managed API, as this call will never
         * come from a system interrupt. The caller can still use this
         * information to assess that an IRQn is actually active (0 = lowest
         * priority) */
        if (irqn < 0) {
            return 0;
        }
        else {
            return NVIC_GetPriority((IRQn_Type) irqn);
        }
    }
    else {
        return UVISOR_SVC(UVISOR_SVC_ID_IRQ_LEVEL_GET, "");
    }
}
Example #2
0
static void boxes_init(void)
{
    /* Tell uVisor to call the uVisor lib box_init function for each box with
     * each box's uVisor lib config. */

    /* This must be called from unprivileged mode in order for the recursive
     * gateway chaining to work properly. */
    UVISOR_SVC(UVISOR_SVC_ID_BOX_INIT_FIRST, "");
}
Example #3
0
void vIRQ_SetPriority(uint32_t irqn, uint32_t priority)
{
    if(__uvisor_mode == 0) {
        NVIC_SetPriority((IRQn_Type) irqn, priority);
    }
    else {
        UVISOR_SVC(UVISOR_SVC_ID_IRQ_PRIO_SET, "", irqn, priority);
    }
}
Example #4
0
uint32_t vIRQ_GetPendingIRQ(uint32_t irqn)
{
    if(__uvisor_mode == 0) {
        return NVIC_GetPendingIRQ((IRQn_Type) irqn);
    }
    else {
        return UVISOR_SVC(UVISOR_SVC_ID_IRQ_PEND_GET, "", irqn);
    }
}
Example #5
0
void vIRQ_SetPendingIRQ(uint32_t irqn)
{
    if(__uvisor_mode == 0) {
        NVIC_SetPendingIRQ((IRQn_Type) irqn);
    }
    else {
        UVISOR_SVC(UVISOR_SVC_ID_IRQ_PEND_SET, "", irqn);
    }
}
Example #6
0
void vIRQ_DisableIRQ(uint32_t irqn)
{
    if(__uvisor_mode == 0) {
        NVIC_DisableIRQ((IRQn_Type) irqn);
    }
    else {
        UVISOR_SVC(UVISOR_SVC_ID_IRQ_DISABLE, "", irqn);
    }
}
Example #7
0
uint32_t vIRQ_GetVector(uint32_t irqn)
{
    if(__uvisor_mode == 0) {
        return NVIC_GetVector((IRQn_Type) irqn);
    }
    else {
        return UVISOR_SVC(UVISOR_SVC_ID_ISR_GET, "", irqn);
    }
}
Example #8
0
void vIRQ_SetVectorX(uint32_t irqn, uint32_t vector, uint32_t flag)
{
    if(__uvisor_mode == 0) {
        NVIC_SetVector((IRQn_Type) irqn, vector);
    }
    else {
        UVISOR_SVC(UVISOR_SVC_ID_ISR_SET, "", irqn, vector, flag);
    }
}
Example #9
0
uint32_t vIRQ_GetPriority(uint32_t irqn)
{
    if(__uvisor_mode == 0) {
        return NVIC_GetPriority((IRQn_Type) irqn);
    }
    else {
        return UVISOR_SVC(UVISOR_SVC_ID_IRQ_PRIO_GET, "", irqn);
    }
}
Example #10
0
void uvisor_error(THaltUserError reason)
{
    UVISOR_SVC(UVISOR_SVC_ID_HALT_USER_ERR, "", reason);
}
Example #11
0
void debug_die(void)
{
    UVISOR_SVC(UVISOR_SVC_ID_GET(error), "", DEBUG_BOX_HALT);
}