arm: remove dynamic IRQs and exceptions

Change-Id: I8fea235aff6b7cb7da07b491ba39ea383709b57f
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2016-08-01 17:15:05 -07:00 committed by Anas Nashif
parent 1cda7554ca
commit 844e21269c
6 changed files with 1 additions and 189 deletions

View file

@ -178,19 +178,6 @@ config SW_ISR_TABLE
a parameter to be passed to the interrupt handlers. Also, invoking
the exeception/interrupt exit stub is automatically done.
This has to be enabled for dynamically connecting interrupt handlers
at runtime (SW_ISR_TABLE_DYNAMIC).
config SW_ISR_TABLE_DYNAMIC
bool
prompt "Allow installing interrupt handlers at runtime"
depends on SW_ISR_TABLE
default n
help
This option enables irq_connect_dynamic(). It moves the ISR table to
SRAM so that it is writable. This has the side-effect of removing
write-protection on the ISR table.
config IRQ_VECTOR_TABLE_CUSTOM
bool
prompt "Projects provide a custom static IRQ part of vector table"

View file

@ -15,58 +15,12 @@
*/
/**
* @file dynamic exception management
* @file exception related routines
*/
/* can only be used with non-XIP kernels, since they don't have their vector
* table in the FLASH
*/
#if !defined(CONFIG_XIP)
#include <nanokernel.h>
#include <arch/cpu.h>
#include <inttypes.h>
#include <misc/__assert.h>
#include <toolchain.h>
#include <sections.h>
#include "vector_table.h"
static inline int exc_can_be_connected(int num)
{
static const uint16_t connectable_exceptions = (
(1 << _EXC_MPU_FAULT) |
(1 << _EXC_BUS_FAULT) |
(1 << _EXC_USAGE_FAULT) |
(1 << _EXC_DEBUG) |
0
);
return !!(connectable_exceptions & (1 << num));
}
/*
* Can be initialized with garbage, it doesn't matter until the wrapper is
* inserted in the vector table, at which point the relevant entry will contain
* the pointer to the handler.
*/
sys_exc_handler_t *_sw_exc_table[_NUM_EXC] __noinit;
extern void _exc_wrapper(void);
void sys_exc_connect(unsigned int num, sys_exc_handler_t *handler, void *unused)
{
__ASSERT(exc_can_be_connected(num), "not a connectable exception");
_sw_exc_table[num] = handler;
/*
* The compiler sets thumb bit (bit0) of the value of the _vector_table
* symbol, probably because it is in the .text section: to get the correct
* offset in the table, mask bit0.
*/
((void **)(((uint32_t)_vector_table) & 0xfffffffe))[num] = _exc_wrapper;
}
FUNC_ALIAS(sys_exc_connect, nanoCpuExcConnect, void);
#include <misc/printk.h>
void sys_exc_esf_dump(NANO_ESF *esf)
@ -92,4 +46,3 @@ void sys_exc_esf_dump(NANO_ESF *esf)
#endif
}
#endif /* CONFIG_XIP */

View file

@ -127,66 +127,3 @@ void _irq_spurious(void *unused)
__reserved();
}
#if CONFIG_SW_ISR_TABLE_DYNAMIC
/**
* @internal
*
* @brief Replace an interrupt handler by another
*
* An interrupt's ISR can be replaced at runtime.
*
* @return N/A
*/
void _irq_handler_set(unsigned int irq,
void (*new)(void *arg),
void *arg)
{
int key = irq_lock();
_sw_isr_table[irq].isr = new;
_sw_isr_table[irq].arg = arg;
irq_unlock(key);
}
/**
*
* @brief Connect an ISR to an interrupt line
*
* <isr> is connected to interrupt line <irq> (exception #<irq>+16). No prior
* ISR can have been connected on <irq> interrupt line since the system booted.
*
* This routine will hang if another ISR was connected for interrupt line <irq>
* and ASSERT_ON is enabled; if ASSERT_ON is disabled, it will fail silently.
*
* @return the interrupt line number
*/
int _arch_irq_connect_dynamic(unsigned int irq,
unsigned int prio,
void (*isr)(void *arg),
void *arg,
uint32_t flags)
{
ARG_UNUSED(flags);
_irq_handler_set(irq, isr, arg);
_irq_priority_set(irq, prio, flags);
return irq;
}
/**
*
* @internal
*
* @brief Disconnect an ISR from an interrupt line
*
* Interrupt line <irq> (exception #<irq>+16) is disconnected from its ISR and
* the latter is replaced by _irq_spurious(). irq_disable() should have
* been called before invoking this routine.
*
* @return N/A
*/
void _irq_disconnect(unsigned int irq)
{
_irq_handler_set(irq, _irq_spurious, NULL);
}
#endif /* CONFIG_SW_ISR_TABLE_DYNAMIC */

View file

@ -55,47 +55,6 @@ extern const NANO_ESF _default_esf;
extern void _ExcExit(void);
#if !defined(CONFIG_XIP)
/* currently, exception connecting is only available to non-XIP kernels */
/**
* @brief signature for an exception handler
*/
#define sys_exc_handler_sig(x) void (x)(NANO_ESF *esf)
/**
* @brief exception handler data type
*/
typedef sys_exc_handler_sig(sys_exc_handler_t);
/**
* @brief connect a handler to an exception vector
*
* Connect the @a handler to the exception vector @a num.
*
* The @a unused parameter is only there to match the x86 signature.
*
* @param num Exception vector number
* @param handler Exception handler to connect
* @param unused Unused
*
* @return N/A
*/
extern void sys_exc_connect(unsigned int num, sys_exc_handler_t *handler,
void *unused);
/**
* @brief alias of sys_exc_connect
*
* See sys_exc_connect().
*/
extern void nanoCpuExcConnect(unsigned int, sys_exc_handler_t *, void *);
/**
* @brief display the contents of a exception stack frame
*
@ -104,8 +63,6 @@ extern void nanoCpuExcConnect(unsigned int, sys_exc_handler_t *, void *);
extern void sys_exc_esf_dump(NANO_ESF *esf);
#endif
#endif /* _ASMLANGUAGE */
#ifdef __cplusplus

View file

@ -34,16 +34,9 @@ extern "C" {
#ifdef _ASMLANGUAGE
GTEXT(_IntExit);
GTEXT(_arch_irq_connect_dynamic)
GTEXT(_arch_irq_enable)
GTEXT(_arch_irq_disable)
#else
extern int _arch_irq_connect_dynamic(unsigned int irq,
unsigned int prio,
void (*isr)(void *arg),
void *arg,
uint32_t flags);
extern void _arch_irq_enable(unsigned int irq);
extern void _arch_irq_disable(unsigned int irq);

View file

@ -98,7 +98,6 @@ SECTIONS
KEEP(*(.security_frdm_k64f))
KEEP(*(".security_frdm_k64f.*"))
#ifndef CONFIG_SW_ISR_TABLE_DYNAMIC
KEEP(*(.isr_irq*))
/* sections for IRQ0-9 */
@ -109,7 +108,6 @@ SECTIONS
/* sections for IRQ100-999 */
KEEP(*(SORT(.gnu.linkonce.isr_irq[0-9][0-9][0-9])))
#endif
_image_text_start = .;
*(.text)
@ -209,19 +207,6 @@ SECTIONS
__data_ram_start = .;
*(.data)
*(".data.*")
#if CONFIG_SW_ISR_TABLE_DYNAMIC
KEEP(*(.isr_irq*))
/* sections for IRQ0-9 */
KEEP(*(SORT(.gnu.linkonce.isr_irq[0-9])))
/* sections for IRQ10-99 */
KEEP(*(SORT(.gnu.linkonce.isr_irq[0-9][0-9])))
/* sections for IRQ100-999 */
KEEP(*(SORT(.gnu.linkonce.isr_irq[0-9][0-9][0-9])))
#endif
} GROUP_LINK_IN(RAMABLE_REGION)
SECTION_PROLOGUE (initlevel, (OPTIONAL),)