Remove invalid assert and move uVisor warning to correct function

pull/5346/head
Steven Cartmell 2017-10-25 18:04:40 +01:00
parent 3c9ae7bf1c
commit 84391f0b64
2 changed files with 11 additions and 14 deletions

View File

@ -36,30 +36,17 @@ MBED_WEAK void hal_critical_section_enter(void)
{
critical_interrupts_enabled = are_interrupts_enabled();
#ifndef FEATURE_UVISOR
// If we are in a nested critical section and interrupts are still enabled
// something has gone wrong.
MBED_ASSERT(!are_interrupts_enabled());
#else
#warning "core_util_critical_section_enter needs fixing to work from unprivileged code"
#endif /* FEATURE_UVISOR */
__disable_irq();
}
MBED_WEAK void hal_critical_section_exit()
{
// FIXME
#ifndef FEATURE_UVISOR
// Interrupts must be disabled on invoking an exit from a critical section
MBED_ASSERT(!are_interrupts_enabled());
#else
#warning "core_util_critical_section_exit needs fixing to work from unprivileged code"
#endif /* FEATURE_UVISOR */
// Restore the IRQs to their state prior to entering the critical section
if (critical_interrupts_enabled == true) {
__enable_irq();
__enable_irq();
}
}

View File

@ -58,6 +58,11 @@ bool core_util_in_critical_section(void)
void core_util_critical_section_enter(void)
{
// FIXME
#ifdef FEATURE_UVISOR
#warning "core_util_critical_section_enter needs fixing to work from unprivileged code"
#endif /* FEATURE_UVISOR */
// If the reentrancy counter overflows something has gone badly wrong.
MBED_ASSERT(critical_section_reentrancy_counter < UINT32_MAX);
@ -70,6 +75,11 @@ void core_util_critical_section_enter(void)
void core_util_critical_section_exit(void)
{
// FIXME
#ifdef FEATURE_UVISOR
#warning "core_util_critical_section_exit needs fixing to work from unprivileged code"
#endif /* FEATURE_UVISOR */
// If critical_section_enter has not previously been called, do nothing
if (critical_section_reentrancy_counter == 0) {
return;