Fixed bugs 3226671 and 3226657.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/stable_2.2.x@2834 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
gdisirio 2011-03-19 18:02:15 +00:00
parent ed7612eb4e
commit ab96cc78df
5 changed files with 29 additions and 12 deletions

View File

@ -116,16 +116,9 @@ void _port_switch_from_isr(void) {
#if !defined(__DOXYGEN__)
__attribute__((naked))
#endif
void port_switch(Thread *ntp, Thread *otp) {
void _port_switch(Thread *ntp, Thread *otp) {
register struct intctx *r13 asm ("r13");
/* Stack overflow check, if enabled.*/
#if CH_DBG_ENABLE_STACK_CHECK
if ((void *)(r13 - 1) < (void *)(otp + 1))
asm volatile ("movs r0, #0 \n\t"
"b chDbgPanic");
#endif /* CH_DBG_ENABLE_STACK_CHECK */
PUSH_CONTEXT(r13);
otp->p_ctx.r13 = r13;

View File

@ -88,7 +88,7 @@ struct intctx {
* reduce this value to zero when compiling with optimizations.
*/
#ifndef IDLE_THREAD_STACK_SIZE
#define IDLE_THREAD_STACK_SIZE 8
#define IDLE_THREAD_STACK_SIZE 16
#endif
/**
@ -206,11 +206,32 @@ struct intctx {
#define port_wait_for_interrupt()
#endif
/**
* @brief Performs a context switch between two threads.
* @details This is the most critical code in any port, this function
* is responsible for the context switch between 2 threads.
* @note The implementation of this code affects <b>directly</b> the context
* switch performance so optimize here as much as you can.
*
* @param[in] ntp the thread to be switched in
* @param[in] otp the thread to be switched out
*/
#if !defined(CH_DBG_ENABLE_STACK_CHECK) || defined(__DOXYGEN__)
#define port_switch(ntp, otp) _port_switch(ntp, otp)
#else
#define port_switch(ntp, otp) { \
register struct intctx *r13 asm ("r13"); \
if ((void *)(r13 - 1) < (void *)(otp + 1)) \
chDbgPanic("stack overflow"); \
_port_switch(ntp, otp); \
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
void port_halt(void);
void port_switch(Thread *ntp, Thread *otp);
void _port_switch(Thread *ntp, Thread *otp);
void _port_irq_epilogue(regarm_t lr);
void _port_switch_from_isr(void);
void _port_thread_start(void);

View File

@ -88,7 +88,7 @@ struct intctx {
* reduce this value to zero when compiling with optimizations.
*/
#ifndef IDLE_THREAD_STACK_SIZE
#define IDLE_THREAD_STACK_SIZE 8
#define IDLE_THREAD_STACK_SIZE 16
#endif
/**

View File

@ -88,7 +88,7 @@ struct intctx {
* reduce this value to zero when compiling with optimizations.
*/
#ifndef IDLE_THREAD_STACK_SIZE
#define IDLE_THREAD_STACK_SIZE 8
#define IDLE_THREAD_STACK_SIZE 16
#endif
/**

View File

@ -69,6 +69,9 @@
*****************************************************************************
*** 2.2.3 ***
- FIX: Fixed insufficient idle thread stack in Cortex-M0-GCC port
(bug 3226671).
- FIX: Fixed stack checking in Cortex-M0-GCC port (bug 3226657).
- FIX: Fixed wrong checks in PAL driver (bug 3224681).
- FIX: Fixed wrong checks in I/O Queues (bug 3219197).
- FIX: Fixed invalid assertion in adcConvert() (bug 3205410).