diff --git a/arch/arm/src/arm/up_blocktask.c b/arch/arm/src/arm/up_blocktask.c index 99ec9cbddb..feaf6d2dfe 100644 --- a/arch/arm/src/arm/up_blocktask.c +++ b/arch/arm/src/arm/up_blocktask.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/arm/up_blocktask.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" /**************************************************************************** @@ -139,6 +140,16 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state) /* Then switch contexts */ up_restorestate(rtcb->xcp.regs); + +#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 } /* Copy the user C context into the TCB at the (old) head of the @@ -154,6 +165,15 @@ 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. + */ + + (void)group_addrenv(rtcb); +#endif /* Then switch contexts */ up_fullcontextrestore(rtcb->xcp.regs); diff --git a/arch/arm/src/armv7-a/arm_blocktask.c b/arch/arm/src/armv7-a/arm_blocktask.c index df4f96b229..b0563e8da7 100644 --- a/arch/arm/src/armv7-a/arm_blocktask.c +++ b/arch/arm/src/armv7-a/arm_blocktask.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/armv7-a/up_blocktask.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" /**************************************************************************** @@ -139,6 +140,16 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state) /* Then switch contexts */ up_restorestate(rtcb->xcp.regs); + +#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 } /* Copy the user C context into the TCB at the (old) head of the @@ -154,6 +165,15 @@ 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. + */ + + (void)group_addrenv(rtcb); +#endif /* Then switch contexts */ up_fullcontextrestore(rtcb->xcp.regs); diff --git a/arch/avr/src/avr32/up_blocktask.c b/arch/avr/src/avr32/up_blocktask.c index 2889adddef..0013cedffc 100644 --- a/arch/avr/src/avr32/up_blocktask.c +++ b/arch/avr/src/avr32/up_blocktask.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/avr/src/avr32/up_blocktask.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" /**************************************************************************** @@ -139,17 +140,39 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state) /* Then switch contexts */ up_restorestate(rtcb->xcp.regs); + +#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 } /* No, then we will need to perform the user context switch */ else { - /* Switch context to the context of the task at the head of the - * ready to run list. + /* Get the context of the task at the head of the ready to + * run list. */ 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_blocktask.c b/arch/hc/src/common/up_blocktask.c index 450a1cebc8..8a44a819dd 100644 --- a/arch/hc/src/common/up_blocktask.c +++ b/arch/hc/src/common/up_blocktask.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/hc/src/common/up_blocktask.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" /**************************************************************************** @@ -139,6 +140,16 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state) /* Then switch contexts */ up_restorestate(rtcb->xcp.regs); + +#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 } /* Copy the user C context into the TCB at the (old) head of the @@ -154,6 +165,15 @@ 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. + */ + + (void)group_addrenv(rtcb); +#endif /* Then switch contexts */ up_fullcontextrestore(rtcb->xcp.regs); diff --git a/arch/mips/src/mips32/up_blocktask.c b/arch/mips/src/mips32/up_blocktask.c index 756b2f24ff..e6979625a8 100644 --- a/arch/mips/src/mips32/up_blocktask.c +++ b/arch/mips/src/mips32/up_blocktask.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/mips/src/mips32/up_blocktask.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 @@ -47,6 +47,7 @@ #include #include "sched/sched.h" +#include "group/group.h" #include "up_internal.h" /**************************************************************************** @@ -140,17 +141,39 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state) /* Then switch contexts */ up_restorestate(rtcb->xcp.regs); + +#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 } /* No, then we will need to perform the user context switch */ else { - /* Switch context to the context of the task at the head of the - * ready to run list. + /* Get the context of the task at the head of the ready to + * run list. */ 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 029263ea70..a7a6a2915e 100644 --- a/arch/rgmp/src/nuttx.c +++ b/arch/rgmp/src/nuttx.c @@ -6,7 +6,7 @@ * * This file is a part of NuttX: * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2014 Gregory Nutt. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -55,6 +55,7 @@ #include "task/task.h" #include "sched/sched.h" +#include "group/group.h" struct tcb_s *current_task = NULL; @@ -288,6 +289,15 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state) sched_mergepending(); } 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_blocktask.c b/arch/sh/src/common/up_blocktask.c index 0cfe03267d..db097e8eec 100644 --- a/arch/sh/src/common/up_blocktask.c +++ b/arch/sh/src/common/up_blocktask.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/sh/src/common/up_blocktask.c * - * Copyright (C) 2008-2009, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009, 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -45,6 +45,7 @@ #include #include "sched/sched.h" +#include "group/group.h" #include "up_internal.h" /**************************************************************************** @@ -138,6 +139,16 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state) /* Then switch contexts */ current_regs = rtcb->xcp.regs; + +#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 } /* Copy the user C context into the TCB at the (old) head of the @@ -153,6 +164,15 @@ 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. + */ + + (void)group_addrenv(rtcb); +#endif /* Then switch contexts */ up_fullcontextrestore(rtcb->xcp.regs); diff --git a/arch/x86/src/common/up_blocktask.c b/arch/x86/src/common/up_blocktask.c index b0a11790b2..4e8687e609 100644 --- a/arch/x86/src/common/up_blocktask.c +++ b/arch/x86/src/common/up_blocktask.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/x86/src/common/up_blocktask.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" /**************************************************************************** @@ -138,6 +139,16 @@ void up_block_task(struct tcb_s *tcb, tstate_t task_state) /* Then switch contexts */ up_restorestate(rtcb->xcp.regs); + +#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 } /* Copy the user C context into the TCB at the (old) head of the @@ -153,6 +164,15 @@ 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. + */ + + (void)group_addrenv(rtcb); +#endif /* Then switch contexts */ up_fullcontextrestore(rtcb->xcp.regs); diff --git a/arch/z80/src/common/up_blocktask.c b/arch/z80/src/common/up_blocktask.c index dd037ca9ab..d8bed13188 100644 --- a/arch/z80/src/common/up_blocktask.c +++ b/arch/z80/src/common/up_blocktask.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/z80/src/common/up_blocktask.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 @@ -47,6 +47,7 @@ #include "chip/switch.h" #include "sched/sched.h" +#include "group/group.h" #include "up_internal.h" /**************************************************************************** @@ -145,6 +146,16 @@ void up_block_task(FAR struct tcb_s *tcb, tstate_t task_state) */ SET_IRQCONTEXT(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 } /* Copy the user C context into the TCB at the (old) head of the @@ -159,8 +170,16 @@ void up_block_task(FAR struct tcb_s *tcb, tstate_t task_state) */ rtcb = (FAR struct tcb_s*)g_readytorun.head; - /* dbg("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);