diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-08-27 15:36:52 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-08-27 15:36:52 -0600 |
commit | 7bda7a5e0cf009da5d0ace3d23efe7a2a2f70dc5 (patch) | |
tree | b07288035e690f4dc36943e4e5795e98f8a23fe2 | |
parent | 3bca5b16412b62536ce746774c4482871fae7852 (diff) | |
download | nuttx-7bda7a5e0cf009da5d0ace3d23efe7a2a2f70dc5.tar.gz nuttx-7bda7a5e0cf009da5d0ace3d23efe7a2a2f70dc5.tar.bz2 nuttx-7bda7a5e0cf009da5d0ace3d23efe7a2a2f70dc5.zip |
Add ADDRENV support to all implementations of up_block_task()
-rw-r--r-- | nuttx/arch/arm/src/arm/up_blocktask.c | 22 | ||||
-rw-r--r-- | nuttx/arch/arm/src/armv7-a/arm_blocktask.c | 22 | ||||
-rw-r--r-- | nuttx/arch/avr/src/avr32/up_blocktask.c | 29 | ||||
-rw-r--r-- | nuttx/arch/hc/src/common/up_blocktask.c | 22 | ||||
-rw-r--r-- | nuttx/arch/mips/src/mips32/up_blocktask.c | 29 | ||||
-rw-r--r-- | nuttx/arch/rgmp/src/nuttx.c | 12 | ||||
-rw-r--r-- | nuttx/arch/sh/src/common/up_blocktask.c | 22 | ||||
-rw-r--r-- | nuttx/arch/x86/src/common/up_blocktask.c | 22 | ||||
-rw-r--r-- | nuttx/arch/z80/src/common/up_blocktask.c | 23 |
9 files changed, 189 insertions, 14 deletions
diff --git a/nuttx/arch/arm/src/arm/up_blocktask.c b/nuttx/arch/arm/src/arm/up_blocktask.c index 99ec9cbdd..feaf6d2df 100644 --- a/nuttx/arch/arm/src/arm/up_blocktask.c +++ b/nuttx/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 <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -46,6 +46,7 @@ #include <nuttx/arch.h> #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/nuttx/arch/arm/src/armv7-a/arm_blocktask.c b/nuttx/arch/arm/src/armv7-a/arm_blocktask.c index df4f96b22..b0563e8da 100644 --- a/nuttx/arch/arm/src/armv7-a/arm_blocktask.c +++ b/nuttx/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 <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -46,6 +46,7 @@ #include <nuttx/arch.h> #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/nuttx/arch/avr/src/avr32/up_blocktask.c b/nuttx/arch/avr/src/avr32/up_blocktask.c index 2889addde..0013cedff 100644 --- a/nuttx/arch/avr/src/avr32/up_blocktask.c +++ b/nuttx/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 <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -46,6 +46,7 @@ #include <nuttx/arch.h> #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/nuttx/arch/hc/src/common/up_blocktask.c b/nuttx/arch/hc/src/common/up_blocktask.c index 450a1cebc..8a44a819d 100644 --- a/nuttx/arch/hc/src/common/up_blocktask.c +++ b/nuttx/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 <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -46,6 +46,7 @@ #include <nuttx/arch.h> #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/nuttx/arch/mips/src/mips32/up_blocktask.c b/nuttx/arch/mips/src/mips32/up_blocktask.c index 756b2f24f..e6979625a 100644 --- a/nuttx/arch/mips/src/mips32/up_blocktask.c +++ b/nuttx/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 <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -47,6 +47,7 @@ #include <nuttx/arch.h> #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/nuttx/arch/rgmp/src/nuttx.c b/nuttx/arch/rgmp/src/nuttx.c index 029263ea7..a7a6a2915 100644 --- a/nuttx/arch/rgmp/src/nuttx.c +++ b/nuttx/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/nuttx/arch/sh/src/common/up_blocktask.c b/nuttx/arch/sh/src/common/up_blocktask.c index 0cfe03267..db097e8ee 100644 --- a/nuttx/arch/sh/src/common/up_blocktask.c +++ b/nuttx/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 <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -45,6 +45,7 @@ #include <nuttx/arch.h> #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/nuttx/arch/x86/src/common/up_blocktask.c b/nuttx/arch/x86/src/common/up_blocktask.c index b0a11790b..4e8687e60 100644 --- a/nuttx/arch/x86/src/common/up_blocktask.c +++ b/nuttx/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 <gnutt@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -46,6 +46,7 @@ #include <nuttx/arch.h> #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/nuttx/arch/z80/src/common/up_blocktask.c b/nuttx/arch/z80/src/common/up_blocktask.c index dd037ca9a..d8bed1318 100644 --- a/nuttx/arch/z80/src/common/up_blocktask.c +++ b/nuttx/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 <gnutt@nuttx.org> * * 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); |