From dce98ad7cd0742cc258a2ed9200c6a76fbfb329f Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 27 Aug 2014 16:15:46 -0600 Subject: Add ADDRENV support to ALL implementations of up_unblock_task() --- nuttx/arch/sh/src/common/up_unblocktask.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'nuttx/arch/sh') diff --git a/nuttx/arch/sh/src/common/up_unblocktask.c b/nuttx/arch/sh/src/common/up_unblocktask.c index 04832386f..463dc0bf9 100644 --- a/nuttx/arch/sh/src/common/up_unblocktask.c +++ b/nuttx/arch/sh/src/common/up_unblocktask.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/sh/src/common/up_unblocktask.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 @@ -44,6 +44,7 @@ #include #include "sched/sched.h" +#include "group/group.h" #include "clock/clock.h" #include "up_internal.h" @@ -75,7 +76,7 @@ * tcb: Refers to the tcb to be unblocked. This tcb is * in one of the waiting tasks lists. It must be moved to * the ready-to-run list and, if it is the highest priority - * ready to run taks, executed. + * ready to run task, executed. * ****************************************************************************/ @@ -129,6 +130,16 @@ void up_unblock_task(struct tcb_s *tcb) /* 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 } /* We are not in an interrupt handler. Copy the user C context @@ -146,6 +157,15 @@ void up_unblock_task(struct tcb_s *tcb) 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); -- cgit v1.2.3