From 56b4e6432b20f5e7b46a7699e7e47aff3b042e16 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 2 Sep 2013 12:10:10 +0000 Subject: [PATCH] git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6248 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/rt/ports/ARMCMx/chcore.h | 4 ++-- os/rt/ports/ARMCMx/chcore_v6m.c | 10 +++++----- os/rt/ports/ARMCMx/chcore_v6m.h | 25 +++++++++++++------------ os/rt/ports/ARMCMx/chcore_v7m.c | 14 +++++++------- os/rt/ports/ARMCMx/chcore_v7m.h | 25 +++++++++++++------------ test/testbmk.c | 4 ++-- 6 files changed, 42 insertions(+), 40 deletions(-) diff --git a/os/rt/ports/ARMCMx/chcore.h b/os/rt/ports/ARMCMx/chcore.h index 9efb2c1bb..ef6720fb2 100644 --- a/os/rt/ports/ARMCMx/chcore.h +++ b/os/rt/ports/ARMCMx/chcore.h @@ -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_) */ diff --git a/os/rt/ports/ARMCMx/chcore_v6m.c b/os/rt/ports/ARMCMx/chcore_v6m.c index 5737fa886..78e796087 100644 --- a/os/rt/ports/ARMCMx/chcore_v6m.c +++ b/os/rt/ports/ARMCMx/chcore_v6m.c @@ -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(); diff --git a/os/rt/ports/ARMCMx/chcore_v6m.h b/os/rt/ports/ARMCMx/chcore_v6m.h index 9d6ccd355..f1af44fdc 100644 --- a/os/rt/ports/ARMCMx/chcore_v6m.h +++ b/os/rt/ports/ARMCMx/chcore_v6m.h @@ -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); \ diff --git a/os/rt/ports/ARMCMx/chcore_v7m.c b/os/rt/ports/ARMCMx/chcore_v7m.c index 78fd284e1..4cd5db64a 100644 --- a/os/rt/ports/ARMCMx/chcore_v7m.c +++ b/os/rt/ports/ARMCMx/chcore_v7m.c @@ -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.*/ diff --git a/os/rt/ports/ARMCMx/chcore_v7m.h b/os/rt/ports/ARMCMx/chcore_v7m.h index dfd6413ce..c2c47024f 100644 --- a/os/rt/ports/ARMCMx/chcore_v7m.h +++ b/os/rt/ports/ARMCMx/chcore_v7m.h @@ -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); \ diff --git a/test/testbmk.c b/test/testbmk.c index fe43c6aff..551a001a1 100644 --- a/test/testbmk.c +++ b/test/testbmk.c @@ -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: ");