git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6248 35acf78f-673a-0410-8e92-d51de3d6d3f4

This commit is contained in:
gdisirio 2013-09-02 12:10:10 +00:00
parent 566b04ad79
commit 56b4e6432b
6 changed files with 42 additions and 40 deletions

View File

@ -128,14 +128,14 @@ typedef uint64_t stkalign_t;
* preemption-capable interrupt handler.
* @note It is implemented to match the Cortex-Mx exception context.
*/
struct extctx {};
struct port_extctx {};
/**
* @brief System saved context.
* @details This structure represents the inner stack frame during a context
* switching.
*/
struct intctx {};
struct port_intctx {};
#endif /* defined(__DOXYGEN__) */
#endif /* !defined(_FROM_ASM_) */

View File

@ -60,8 +60,8 @@
*/
void NMI_Handler(void) {
/* The extctx structure is pointed by the PSP register.*/
struct extctx *ctxp = (struct extctx *)__get_PSP();
/* The port_extctx structure is pointed by the PSP register.*/
struct port_extctx *ctxp = (struct port_extctx *)__get_PSP();
/* Discarding the current exception context and positioning the stack to
point to the real one.*/
@ -83,8 +83,8 @@ void NMI_Handler(void) {
*/
void PendSV_Handler(void) {
/* The extctx structure is pointed by the PSP register.*/
struct extctx *ctxp = (struct extctx *)__get_PSP();
/* The port_extctx structure is pointed by the PSP register.*/
struct port_extctx *ctxp = (struct port_extctx *)__get_PSP();
/* Discarding the current exception context and positioning the stack to
point to the real one.*/
@ -107,7 +107,7 @@ void PendSV_Handler(void) {
void _port_irq_epilogue(regarm_t lr) {
if (lr != (regarm_t)0xFFFFFFF1) {
struct extctx *ctxp;
struct port_extctx *ctxp;
port_lock_from_isr();

View File

@ -158,7 +158,7 @@ typedef void *regarm_t;
typedef uint64_t stkalign_t;
struct extctx {
struct port_extctx {
regarm_t r0;
regarm_t r1;
regarm_t r2;
@ -169,7 +169,7 @@ struct extctx {
regarm_t xpsr;
};
struct intctx {
struct port_intctx {
regarm_t r8;
regarm_t r9;
regarm_t r10;
@ -185,11 +185,12 @@ struct intctx {
/**
* @brief Platform dependent part of the @p thread_t structure.
* @details In this port the structure just holds a pointer to the @p intctx
* structure representing the stack pointer at context switch time.
* @details In this port the structure just holds a pointer to the
* @p port_intctx structure representing the stack pointer
* at context switch time.
*/
struct context {
struct intctx *r13;
struct port_intctx *r13;
};
/*===========================================================================*/
@ -199,12 +200,12 @@ struct context {
/**
* @brief Platform dependent part of the @p chThdCreateI() API.
* @details This code usually setup the context switching frame represented
* by an @p intctx structure.
* by an @p port_intctx structure.
*/
#define SETUP_CONTEXT(workspace, wsize, pf, arg) { \
tp->p_ctx.r13 = (struct intctx *)((uint8_t *)workspace + \
wsize - \
sizeof(struct intctx)); \
tp->p_ctx.r13 = (struct port_intctx *)((uint8_t *)workspace + \
wsize - \
sizeof(struct port_intctx)); \
tp->p_ctx.r13->r4 = (void *)(pf); \
tp->p_ctx.r13->r5 = (void *)(arg); \
tp->p_ctx.r13->lr = (void *)(_port_thread_start); \
@ -219,8 +220,8 @@ struct context {
* @brief Computes the thread working area global size.
*/
#define THD_WA_SIZE(n) STACK_ALIGN(sizeof(thread_t) + \
sizeof(struct intctx) + \
sizeof(struct extctx) + \
sizeof(struct port_intctx) + \
sizeof(struct port_extctx) + \
(n) + (CH_PORT_INT_REQUIRED_STACK))
/**
@ -274,7 +275,7 @@ struct context {
#define port_switch(ntp, otp) _port_switch(ntp, otp)
#else
#define port_switch(ntp, otp) { \
struct intctx *r13 = (struct intctx *)__get_PSP(); \
struct port_intctx *r13 = (struct port_intctx *)__get_PSP(); \
if ((stkalign_t *)(r13 - 1) < otp->p_stklimit) \
chSysHalt("stack overflow"); \
_port_switch(ntp, otp); \

View File

@ -61,8 +61,8 @@
*/
void SVC_Handler(void) {
/* The extctx structure is pointed by the PSP register.*/
struct extctx *ctxp = (struct extctx *)__get_PSP();
/* The port_extctx structure is pointed by the PSP register.*/
struct port_extctx *ctxp = (struct port_extctx *)__get_PSP();
/* Discarding the current exception context and positioning the stack to
point to the real one.*/
@ -91,8 +91,8 @@ void SVC_Handler(void) {
*/
void PendSV_Handler(void) {
/* The extctx structure is pointed by the PSP register.*/
struct extctx *ctxp = (struct extctx *)__get_PSP();
/* The port_extctx structure is pointed by the PSP register.*/
struct port_extctx *ctxp = (struct port_extctx *)__get_PSP();
/* Discarding the current exception context and positioning the stack to
point to the real one.*/
@ -101,7 +101,7 @@ void PendSV_Handler(void) {
#if CORTEX_USE_FPU
/* Restoring the special register FPCCR.*/
FPU->FPCCR = (uint32_t)ctxp->fpccr;
FPU->FPCAR = FPU->FPCAR + sizeof (struct extctx);
FPU->FPCAR = FPU->FPCAR + sizeof (struct port_extctx);
#endif
/* Writing back the modified PSP value.*/
@ -121,8 +121,8 @@ void _port_irq_epilogue(void) {
port_lock_from_isr();
if ((SCB->ICSR & SCB_ICSR_RETTOBASE_Msk) != 0) {
/* The extctx structure is pointed by the PSP register.*/
struct extctx *ctxp = (struct extctx *)__get_PSP();
/* The port_extctx structure is pointed by the PSP register.*/
struct port_extctx *ctxp = (struct port_extctx *)__get_PSP();
/* Adding an artificial exception return context, there is no need to
populate it fully.*/

View File

@ -219,7 +219,7 @@ typedef void *regarm_t;
typedef uint64_t stkalign_t;
struct extctx {
struct port_extctx {
regarm_t r0;
regarm_t r1;
regarm_t r2;
@ -250,7 +250,7 @@ struct extctx {
#endif /* CORTEX_USE_FPU */
};
struct intctx {
struct port_intctx {
#if CORTEX_USE_FPU
regarm_t s16;
regarm_t s17;
@ -284,11 +284,12 @@ struct intctx {
/**
* @brief Platform dependent part of the @p thread_t structure.
* @details In this port the structure just holds a pointer to the @p intctx
* structure representing the stack pointer at context switch time.
* @details In this port the structure just holds a pointer to the
* @p port_intctx structure representing the stack pointer
* at context switch time.
*/
struct context {
struct intctx *r13;
struct port_intctx *r13;
};
/*===========================================================================*/
@ -298,12 +299,12 @@ struct context {
/**
* @brief Platform dependent part of the @p chThdCreateI() API.
* @details This code usually setup the context switching frame represented
* by an @p intctx structure.
* by an @p port_intctx structure.
*/
#define SETUP_CONTEXT(workspace, wsize, pf, arg) { \
tp->p_ctx.r13 = (struct intctx *)((uint8_t *)workspace + \
wsize - \
sizeof(struct intctx)); \
tp->p_ctx.r13 = (struct port_intctx *)((uint8_t *)workspace + \
wsize - \
sizeof(struct port_intctx)); \
tp->p_ctx.r13->r4 = (void *)(pf); \
tp->p_ctx.r13->r5 = (void *)(arg); \
tp->p_ctx.r13->lr = (void *)(_port_thread_start); \
@ -318,8 +319,8 @@ struct context {
* @brief Computes the thread working area global size.
*/
#define THD_WA_SIZE(n) STACK_ALIGN(sizeof(thread_t) + \
sizeof(struct intctx) + \
sizeof(struct extctx) + \
sizeof(struct port_intctx) + \
sizeof(struct port_extctx) + \
(n) + (CH_PORT_INT_REQUIRED_STACK))
/**
@ -371,7 +372,7 @@ struct context {
#define port_switch(ntp, otp) _port_switch(ntp, otp)
#else
#define port_switch(ntp, otp) { \
struct intctx *r13 = (struct intctx *)__get_PSP(); \
struct port_intctx *r13 = (struct port_intctx *)__get_PSP(); \
if ((stkalign_t *)(r13 - 1) < otp->p_stklimit) \
chSysHalt("stack overflow"); \
_port_switch(ntp, otp); \

View File

@ -638,8 +638,8 @@ static void bmk13_execute(void) {
test_print("--- System: ");
test_printn(sizeof(ready_list_t) + sizeof(virtual_timers_list_t) +
CH_PORT_IDLE_THREAD_STACK_SIZE +
(sizeof(thread_t) + sizeof(struct intctx) +
sizeof(struct extctx) +
(sizeof(thread_t) + sizeof(struct port_intctx) +
sizeof(struct port_extctx) +
CH_PORT_INT_REQUIRED_STACK) * 2);
test_println(" bytes");
test_print("--- Thread: ");