diff --git a/arch/arm/src/arm/up_blocktask.c b/arch/arm/src/arm/up_blocktask.c index b3c6b45a11..13a6e646af 100644 --- a/arch/arm/src/arm/up_blocktask.c +++ b/arch/arm/src/arm/up_blocktask.c @@ -158,13 +158,13 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state) rtcb = (struct tcb_s*)g_readytorun.head; #ifdef CONFIG_ARCH_ADDRENV - /* Make sure that the address environment for the previously - * running task is closed down gracefully (data caches dump, - * MMU flushed) and set up the address environment for the new - * thread at the head of the ready-to-run list. - */ + /* Make sure that the address environment for the previously + * running task is closed down gracefully (data caches dump, + * MMU flushed) and set up the address environment for the new + * thread at the head of the ready-to-run list. + */ - (void)group_addrenv(rtcb); + (void)group_addrenv(rtcb); #endif /* Then switch contexts */ diff --git a/arch/arm/src/arm/up_reprioritizertr.c b/arch/arm/src/arm/up_reprioritizertr.c index 0a0c00aff0..bf6d7e8833 100644 --- a/arch/arm/src/arm/up_reprioritizertr.c +++ b/arch/arm/src/arm/up_reprioritizertr.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/arm/up_reprioritizertr.c * - * Copyright (C) 2007-2009, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -46,6 +46,7 @@ #include #include "sched/sched.h" +#include "group/group.h" #include "up_internal.h" /**************************************************************************** @@ -159,7 +160,9 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority) rtcb = (struct tcb_s*)g_readytorun.head; slldbg("New Active Task TCB=%p\n", rtcb); - /* Then switch contexts */ + /* Then switch contexts. Any necessary address environment + * changes will be made when the interrupt returns. + */ up_restorestate(rtcb->xcp.regs); } @@ -178,6 +181,15 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority) rtcb = (struct tcb_s*)g_readytorun.head; slldbg("New Active Task TCB=%p\n", rtcb); +#ifdef CONFIG_ARCH_ADDRENV + /* Make sure that the address environment for the previously + * running task is closed down gracefully (data caches dump, + * MMU flushed) and set up the address environment for the new + * thread at the head of the ready-to-run list. + */ + + (void)group_addrenv(rtcb); +#endif /* Then switch contexts */ up_fullcontextrestore(rtcb->xcp.regs); diff --git a/arch/arm/src/armv7-a/arm_reprioritizertr.c b/arch/arm/src/armv7-a/arm_reprioritizertr.c index e90e834334..d4c66cdf59 100644 --- a/arch/arm/src/armv7-a/arm_reprioritizertr.c +++ b/arch/arm/src/armv7-a/arm_reprioritizertr.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/armv7-a/arm_reprioritizertr.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -46,6 +46,7 @@ #include #include "sched/sched.h" +#include "group/group.h" #include "up_internal.h" /**************************************************************************** @@ -159,7 +160,9 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority) rtcb = (struct tcb_s*)g_readytorun.head; slldbg("New Active Task TCB=%p\n", rtcb); - /* Then switch contexts */ + /* Then switch contexts. Any necessary address environment + * changes will be made when the interrupt returns. + */ up_restorestate(rtcb->xcp.regs); } @@ -178,6 +181,15 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority) rtcb = (struct tcb_s*)g_readytorun.head; slldbg("New Active Task TCB=%p\n", rtcb); +#ifdef CONFIG_ARCH_ADDRENV + /* Make sure that the address environment for the previously + * running task is closed down gracefully (data caches dump, + * MMU flushed) and set up the address environment for the new + * thread at the head of the ready-to-run list. + */ + + (void)group_addrenv(rtcb); +#endif /* Then switch contexts */ up_fullcontextrestore(rtcb->xcp.regs); diff --git a/arch/avr/src/avr32/up_reprioritizertr.c b/arch/avr/src/avr32/up_reprioritizertr.c index 535134d51f..9ddafe37c4 100644 --- a/arch/avr/src/avr32/up_reprioritizertr.c +++ b/arch/avr/src/avr32/up_reprioritizertr.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/avr/src/avr32/up_reprioritizertr.c * - * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -46,6 +46,7 @@ #include #include "sched/sched.h" +#include "group/group.h" #include "up_internal.h" /**************************************************************************** @@ -159,7 +160,9 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority) rtcb = (struct tcb_s*)g_readytorun.head; slldbg("New Active Task TCB=%p\n", rtcb); - /* Then switch contexts */ + /* Then switch contexts. Any necessary address environment + * changes will be made when the interrupt returns. + */ up_restorestate(rtcb->xcp.regs); } @@ -173,6 +176,18 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority) */ struct tcb_s *nexttcb = (struct tcb_s*)g_readytorun.head; + +#ifdef CONFIG_ARCH_ADDRENV + /* Make sure that the address environment for the previously + * running task is closed down gracefully (data caches dump, + * MMU flushed) and set up the address environment for the new + * thread at the head of the ready-to-run list. + */ + + (void)group_addrenv(nexttcb); +#endif + /* Then switch contexts */ + up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs); /* up_switchcontext forces a context switch to the task at the diff --git a/arch/hc/src/common/up_reprioritizertr.c b/arch/hc/src/common/up_reprioritizertr.c index 8ed2f60e9d..9592f1d811 100644 --- a/arch/hc/src/common/up_reprioritizertr.c +++ b/arch/hc/src/common/up_reprioritizertr.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/hc/src/common/up_reprioritizertr.c * - * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -46,6 +46,7 @@ #include #include "sched/sched.h" +#include "group/group.h" #include "up_internal.h" /**************************************************************************** @@ -159,7 +160,9 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority) rtcb = (struct tcb_s*)g_readytorun.head; slldbg("New Active Task TCB=%p\n", rtcb); - /* Then switch contexts */ + /* Then switch contexts. Any necessary address environment + * changes will be made when the interrupt returns. + */ up_restorestate(rtcb->xcp.regs); } @@ -178,6 +181,15 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority) rtcb = (struct tcb_s*)g_readytorun.head; slldbg("New Active Task TCB=%p\n", rtcb); +#ifdef CONFIG_ARCH_ADDRENV + /* Make sure that the address environment for the previously + * running task is closed down gracefully (data caches dump, + * MMU flushed) and set up the address environment for the new + * thread at the head of the ready-to-run list. + */ + + (void)group_addrenv(rtcb); +#endif /* Then switch contexts */ up_fullcontextrestore(rtcb->xcp.regs); diff --git a/arch/mips/src/mips32/up_reprioritizertr.c b/arch/mips/src/mips32/up_reprioritizertr.c index 1d957e2c22..7057ce23a3 100644 --- a/arch/mips/src/mips32/up_reprioritizertr.c +++ b/arch/mips/src/mips32/up_reprioritizertr.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/mips/src/mips32/up_reprioritizertr.c * - * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -48,6 +48,7 @@ #include #include "sched/sched.h" +#include "group/group.h" #include "up_internal.h" /**************************************************************************** @@ -161,7 +162,9 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority) rtcb = (struct tcb_s*)g_readytorun.head; slldbg("New Active Task TCB=%p\n", rtcb); - /* Then switch contexts */ + /* Then switch contexts. Any necessary address environment + * changes will be made when the interrupt returns. + */ up_restorestate(rtcb->xcp.regs); } @@ -175,6 +178,18 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority) */ struct tcb_s *nexttcb = (struct tcb_s*)g_readytorun.head; + +#ifdef CONFIG_ARCH_ADDRENV + /* Make sure that the address environment for the previously + * running task is closed down gracefully (data caches dump, + * MMU flushed) and set up the address environment for the new + * thread at the head of the ready-to-run list. + */ + + (void)group_addrenv(nexttcb); +#endif + /* Then switch contexts */ + up_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs); /* up_switchcontext forces a context switch to the task at the diff --git a/arch/rgmp/src/nuttx.c b/arch/rgmp/src/nuttx.c index 386e588c92..ea0a4311f3 100644 --- a/arch/rgmp/src/nuttx.c +++ b/arch/rgmp/src/nuttx.c @@ -433,6 +433,15 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority) } nexttcb = (struct tcb_s*)g_readytorun.head; +#ifdef CONFIG_ARCH_ADDRENV + /* Make sure that the address environment for the previously + * running task is closed down gracefully (data caches dump, + * MMU flushed) and set up the address environment for the new + * thread at the head of the ready-to-run list. + */ + + (void)group_addrenv(nexttcb); +#endif // context switch up_switchcontext(rtcb, nexttcb); } diff --git a/arch/sh/src/common/up_reprioritizertr.c b/arch/sh/src/common/up_reprioritizertr.c index 93a577a92e..b509202a3b 100644 --- a/arch/sh/src/common/up_reprioritizertr.c +++ b/arch/sh/src/common/up_reprioritizertr.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/sh/src/common/up_reprioritizertr.c * - * Copyright (C) 2008-2009, 2011, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009, 2011, 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -46,6 +46,7 @@ #include #include "sched/sched.h" +#include "group/group.h" #include "up_internal.h" /**************************************************************************** @@ -159,7 +160,9 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority) rtcb = (struct tcb_s*)g_readytorun.head; slldbg("New Active Task TCB=%p\n", rtcb); - /* Then switch contexts */ + /* Then switch contexts. Any necessary address environment + * changes will be made when the interrupt returns. + */ current_regs = rtcb->xcp.regs; } @@ -178,6 +181,15 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority) rtcb = (struct tcb_s*)g_readytorun.head; slldbg("New Active Task TCB=%p\n", rtcb); +#ifdef CONFIG_ARCH_ADDRENV + /* Make sure that the address environment for the previously + * running task is closed down gracefully (data caches dump, + * MMU flushed) and set up the address environment for the new + * thread at the head of the ready-to-run list. + */ + + (void)group_addrenv(rtcb); +#endif /* Then switch contexts */ up_fullcontextrestore(rtcb->xcp.regs); diff --git a/arch/x86/src/common/up_reprioritizertr.c b/arch/x86/src/common/up_reprioritizertr.c index 5579ad3498..a9f650b71d 100644 --- a/arch/x86/src/common/up_reprioritizertr.c +++ b/arch/x86/src/common/up_reprioritizertr.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/arm/up_reprioritizertr.c * - * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -46,6 +46,7 @@ #include #include "sched/sched.h" +#include "group/group.h" #include "up_internal.h" /**************************************************************************** @@ -159,7 +160,9 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority) rtcb = (struct tcb_s*)g_readytorun.head; slldbg("New Active Task TCB=%p\n", rtcb); - /* Then switch contexts */ + /* Then switch contexts. Any necessary address environment + * changes will be made when the interrupt returns. + */ up_restorestate(rtcb->xcp.regs); } @@ -178,6 +181,15 @@ void up_reprioritize_rtr(struct tcb_s *tcb, uint8_t priority) rtcb = (struct tcb_s*)g_readytorun.head; slldbg("New Active Task TCB=%p\n", rtcb); +#ifdef CONFIG_ARCH_ADDRENV + /* Make sure that the address environment for the previously + * running task is closed down gracefully (data caches dump, + * MMU flushed) and set up the address environment for the new + * thread at the head of the ready-to-run list. + */ + + (void)group_addrenv(rtcb); +#endif /* Then switch contexts */ up_fullcontextrestore(rtcb->xcp.regs); diff --git a/arch/z80/src/common/up_reprioritizertr.c b/arch/z80/src/common/up_reprioritizertr.c index c470c08630..ff7cb64ab9 100644 --- a/arch/z80/src/common/up_reprioritizertr.c +++ b/arch/z80/src/common/up_reprioritizertr.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/z80/src/common/up_reprioritizertr.c * - * Copyright (C) 2007-2009, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -49,6 +49,7 @@ #include "chip/chip.h" #include "chip/switch.h" #include "sched/sched.h" +#include "group/group.h" #include "up_internal.h" /**************************************************************************** @@ -163,7 +164,8 @@ void up_reprioritize_rtr(FAR struct tcb_s *tcb, uint8_t priority) slldbg("New Active Task TCB=%p\n", rtcb); /* Then setup so that the context will be performed on exit - * from the interrupt. + * from the interrupt. Any necessary address environment + * changes will be made when the interrupt returns. */ SET_IRQCONTEXT(rtcb); @@ -183,6 +185,15 @@ void up_reprioritize_rtr(FAR struct tcb_s *tcb, uint8_t priority) rtcb = (FAR struct tcb_s*)g_readytorun.head; slldbg("New Active Task TCB=%p\n", rtcb); +#ifdef CONFIG_ARCH_ADDRENV + /* Make sure that the address environment for the previously + * running task is closed down gracefully (data caches dump, + * MMU flushed) and set up the address environment for the new + * thread at the head of the ready-to-run list. + */ + + (void)group_addrenv(rtcb); +#endif /* Then switch contexts */ RESTORE_USERCONTEXT(rtcb);