Tentative fix for bug #985.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12416 110e8d01-0319-4d1e-a829-52ad28d1bb01
This commit is contained in:
parent
d65f2107f8
commit
1d6d312d43
|
@ -107,15 +107,16 @@ void PendSV_Handler(void) {
|
||||||
*
|
*
|
||||||
* @param[in] lr value of the @p LR register on ISR entry
|
* @param[in] lr value of the @p LR register on ISR entry
|
||||||
*/
|
*/
|
||||||
void _port_irq_epilogue(regarm_t lr) {
|
void _port_irq_epilogue(void) {
|
||||||
|
struct port_extctx *ctxp;
|
||||||
|
|
||||||
if (lr != (regarm_t)0xFFFFFFF1U) {
|
port_lock_from_isr();
|
||||||
struct port_extctx *ctxp;
|
|
||||||
|
|
||||||
port_lock_from_isr();
|
/* Checking if the artificial exception return context has already been
|
||||||
|
added.*/
|
||||||
/* The extctx structure is pointed by the PSP register.*/
|
ctxp = (struct port_extctx *)__get_PSP();
|
||||||
ctxp = (struct port_extctx *)__get_PSP();
|
if ((ctxp->pc != (regarm_t)_port_switch_from_isr) &&
|
||||||
|
chSchIsPreemptionRequired()) {
|
||||||
|
|
||||||
/* Adding an artificial exception return context, there is no need to
|
/* Adding an artificial exception return context, there is no need to
|
||||||
populate it fully.*/
|
populate it fully.*/
|
||||||
|
@ -127,21 +128,16 @@ void _port_irq_epilogue(regarm_t lr) {
|
||||||
/* Setting up a fake XPSR register value.*/
|
/* Setting up a fake XPSR register value.*/
|
||||||
ctxp->xpsr = (regarm_t)0x01000000;
|
ctxp->xpsr = (regarm_t)0x01000000;
|
||||||
|
|
||||||
/* The exit sequence is different depending on if a preemption is
|
/* Return address set to OS code, there context switch will be
|
||||||
required or not.*/
|
performed.*/
|
||||||
if (chSchIsPreemptionRequired()) {
|
ctxp->pc = (regarm_t)_port_switch_from_isr;
|
||||||
/* Preemption is required we need to enforce a context switch.*/
|
|
||||||
ctxp->pc = (regarm_t)_port_switch_from_isr;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* Preemption not required, we just need to exit the exception
|
|
||||||
atomically.*/
|
|
||||||
ctxp->pc = (regarm_t)_port_exit_from_isr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Note, returning without unlocking is intentional, this is done in
|
/* Note, returning without unlocking is intentional, this is done in
|
||||||
order to keep the rest of the context switch atomic.*/
|
order to keep the rest of the context switch atomic.*/
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
port_unlock_from_isr();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
|
@ -246,23 +246,14 @@ struct port_intctx {
|
||||||
* @details This macro must be inserted at the start of all IRQ handlers
|
* @details This macro must be inserted at the start of all IRQ handlers
|
||||||
* enabled to invoke system APIs.
|
* enabled to invoke system APIs.
|
||||||
*/
|
*/
|
||||||
#if defined(__GNUC__) || defined(__DOXYGEN__)
|
#define PORT_IRQ_PROLOGUE()
|
||||||
#define PORT_IRQ_PROLOGUE() \
|
|
||||||
regarm_t _saved_lr = (regarm_t)__builtin_return_address(0)
|
|
||||||
#elif defined(__ICCARM__)
|
|
||||||
#define PORT_IRQ_PROLOGUE() \
|
|
||||||
regarm_t _saved_lr = (regarm_t)__get_LR()
|
|
||||||
#elif defined(__CC_ARM)
|
|
||||||
#define PORT_IRQ_PROLOGUE() \
|
|
||||||
regarm_t _saved_lr = (regarm_t)__return_address()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief IRQ epilogue code.
|
* @brief IRQ epilogue code.
|
||||||
* @details This macro must be inserted at the end of all IRQ handlers
|
* @details This macro must be inserted at the end of all IRQ handlers
|
||||||
* enabled to invoke system APIs.
|
* enabled to invoke system APIs.
|
||||||
*/
|
*/
|
||||||
#define PORT_IRQ_EPILOGUE() _port_irq_epilogue(_saved_lr)
|
#define PORT_IRQ_EPILOGUE() _port_irq_epilogue()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief IRQ handler function declaration.
|
* @brief IRQ handler function declaration.
|
||||||
|
@ -307,11 +298,10 @@ struct port_intctx {
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
void _port_irq_epilogue(regarm_t lr);
|
void _port_irq_epilogue(void);
|
||||||
void _port_switch(thread_t *ntp, thread_t *otp);
|
void _port_switch(thread_t *ntp, thread_t *otp);
|
||||||
void _port_thread_start(void);
|
void _port_thread_start(void);
|
||||||
void _port_switch_from_isr(void);
|
void _port_switch_from_isr(void);
|
||||||
void _port_exit_from_isr(void);
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -160,6 +160,7 @@
|
||||||
- EX: Updated LIS302DL to 1.1.0 (backported to 18.2.1).
|
- EX: Updated LIS302DL to 1.1.0 (backported to 18.2.1).
|
||||||
- EX: Updated LPS25H to 1.1.0 (backported to 18.2.1).
|
- EX: Updated LPS25H to 1.1.0 (backported to 18.2.1).
|
||||||
- EX: Updated LSM303DLHC to 1.1.0 (backported to 18.2.1).
|
- EX: Updated LSM303DLHC to 1.1.0 (backported to 18.2.1).
|
||||||
|
- RT: Fixed GCC6 problem breaks Cortex-M0 port (bug #985).
|
||||||
- NIL: Fixed scheduler misbehaving in rare cases (bug #983)
|
- NIL: Fixed scheduler misbehaving in rare cases (bug #983)
|
||||||
(backported to 18.2.2 and 17.6.5).
|
(backported to 18.2.2 and 17.6.5).
|
||||||
- NIL: Fixed function chThdSuspendTimeoutS() ignoring TIME_IMMEDIATE (bug #982)
|
- NIL: Fixed function chThdSuspendTimeoutS() ignoring TIME_IMMEDIATE (bug #982)
|
||||||
|
|
Loading…
Reference in New Issue