arch: remove up_release_pending function

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
This commit is contained in:
zhangyuan21 2022-12-16 16:13:11 +08:00 committed by Xiang Xiao
parent 548c417858
commit 632d87ee71
49 changed files with 41 additions and 2406 deletions

View file

@ -186,19 +186,6 @@ APIs Exported by Architecture-Specific Logic to NuttX
which will be executed.
:param rtcb: Refers to the running task which will be blocked.
.. c:function:: void up_release_pending(void)
When tasks become ready-to-run but cannot run
because pre-emption is disabled, they are placed into a pending
task list. This function releases and makes ready-to-run all of
the tasks that have collected in the pending task list. This can
cause a context switch if a new task is placed at the head of the
ready to run list.
This function is called only from the NuttX scheduling logic when
pre-emption is re-enabled. Interrupts will always be disabled when
this function is called.
.. c:macro:: noreturn_function
.. c:function:: void up_exit(int status) noreturn_function;

View file

@ -24,7 +24,7 @@ CMN_CSRCS += arm_allocateheap.c arm_assert.c
CMN_CSRCS += arm_createstack.c arm_exit.c
CMN_CSRCS += arm_initialize.c arm_lowputs.c
CMN_CSRCS += arm_modifyreg16.c arm_modifyreg32.c
CMN_CSRCS += arm_modifyreg8.c arm_nputs.c arm_releasepending.c
CMN_CSRCS += arm_modifyreg8.c arm_nputs.c
CMN_CSRCS += arm_releasestack.c arm_saveusercontext.c
CMN_CSRCS += arm_stackframe.c
CMN_CSRCS += arm_vfork.c arm_switchcontext.c arm_usestack.c

View file

@ -1,118 +0,0 @@
/****************************************************************************
* arch/arm/src/common/arm_releasepending.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sched.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/sched.h>
#include "sched/sched.h"
#include "group/group.h"
#include "arm_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_release_pending
*
* Description:
* Release and ready-to-run tasks that have collected in the pending task
* list. This can call a context switch if a new task is placed at the
* head of the ready to run list.
*
****************************************************************************/
void up_release_pending(void)
{
struct tcb_s *rtcb = this_task();
sinfo("From TCB=%p\n", rtcb);
/* Merge the g_pendingtasks list into the ready-to-run task list */
if (nxsched_merge_pending())
{
/* The currently active task has changed! We will need to
* switch contexts.
*/
/* Update scheduler parameters */
nxsched_suspend_scheduler(rtcb);
/* Are we operating in interrupt context? */
if (CURRENT_REGS)
{
/* Yes, then we have to do things differently.
* Just copy the CURRENT_REGS into the OLD rtcb.
*/
arm_savestate(rtcb->xcp.regs);
/* Restore the exception context of the rtcb at the (new) head
* of the ready-to-run task list.
*/
rtcb = this_task();
/* Update scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts. Any necessary address environment
* changes will be made when the interrupt returns.
*/
arm_restorestate(rtcb->xcp.regs);
}
/* No, then we will need to perform the user context switch */
else
{
struct tcb_s *nexttcb = this_task();
/* Update scheduler parameters */
nxsched_resume_scheduler(nexttcb);
/* Switch context to the context of the task at the head of the
* ready to run list.
*/
arm_switchcontext(&rtcb->xcp.regs, nexttcb->xcp.regs);
/* arm_switchcontext forces a context switch to the task at the
* head of the ready-to-run list. It does not 'return' in the
* normal sense. When it does return, it is because the blocked
* task is again ready to run and has execution priority.
*/
}
}
}

View file

@ -45,8 +45,7 @@ endif
CMN_CSRCS = arm64_initialize.c arm64_initialstate.c arm64_boot.c
CMN_CSRCS += arm64_nputs.c arm64_idle.c arm64_copystate.c
CMN_CSRCS += arm64_createstack.c arm64_releasestack.c arm64_stackframe.c arm64_usestack.c
CMN_CSRCS += arm64_task_sched.c arm64_exit.c arm64_vfork.c
CMN_CSRCS += arm64_releasepending.c arm64_switchcontext.c
CMN_CSRCS += arm64_task_sched.c arm64_exit.c arm64_vfork.c arm64_switchcontext.c
CMN_CSRCS += arm64_assert.c arm64_schedulesigaction.c arm64_backtrace.c
CMN_CSRCS += arm64_sigdeliver.c arm64_systemreset.c

View file

@ -1,116 +0,0 @@
/****************************************************************************
* arch/arm64/src/common/arm64_releasepending.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sched.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/sched.h>
#include "sched/sched.h"
#include "group/group.h"
#include "arm64_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_release_pending
*
* Description:
* Release and ready-to-run tasks that have collected in the pending task
* list. This can call a context switch if a new task is placed at the
* head of the ready to run list.
*
****************************************************************************/
void up_release_pending(void)
{
struct tcb_s *rtcb = this_task();
/* Merge the g_pendingtasks list into the ready-to-run task list */
if (nxsched_merge_pending())
{
/* The currently active task has changed! We will need to
* switch contexts.
*/
/* Update scheduler parameters */
nxsched_suspend_scheduler(rtcb);
/* Are we operating in interrupt context? */
if (CURRENT_REGS)
{
/* Yes, then we have to do things differently.
* Just copy the CURRENT_REGS into the OLD rtcb.
*/
arm64_savestate(rtcb->xcp.regs);
/* Restore the exception context of the rtcb at the (new) head
* of the ready-to-run task list.
*/
rtcb = this_task();
/* Update scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts. Any necessary address environment
* changes will be made when the interrupt returns.
*/
arm64_restorestate(rtcb->xcp.regs);
}
/* No, then we will need to perform the user context switch */
else
{
struct tcb_s *nexttcb = this_task();
/* Update scheduler parameters */
nxsched_resume_scheduler(nexttcb);
/* Switch context to the context of the task at the head of the
* ready to run list.
*/
arm64_switchcontext(&rtcb->xcp.regs, nexttcb->xcp.regs);
/* arm_switchcontext forces a context switch to the task at the
* head of the ready-to-run list. It does not 'return' in the
* normal sense. When it does return, it is because the blocked
* task is again ready to run and has execution priority.
*/
}
}
}

View file

@ -28,8 +28,7 @@ CMN_ASRCS = avr_exceptions.S avr_fullcontextrestore.S avr_doswitch.S
CMN_CSRCS = avr_assert.c avr_allocateheap.c avr_copystate.c
CMN_CSRCS += avr_createstack.c avr_mdelay.c avr_udelay.c avr_exit.c avr_idle.c
CMN_CSRCS += avr_initialize.c avr_initialstate.c
CMN_CSRCS += avr_modifyreg8.c avr_modifyreg16.c avr_modifyreg32.c
CMN_CSRCS += avr_releasepending.c avr_releasestack.c
CMN_CSRCS += avr_modifyreg8.c avr_modifyreg16.c avr_modifyreg32.c avr_releasestack.c
CMN_CSRCS += avr_schedulesigaction.c avr_sigdeliver.c avr_stackframe.c
CMN_CSRCS += avr_switchcontext.c avr_usestack.c avr_doirq.c avr_nputs.c

View file

@ -29,7 +29,7 @@ CMN_CSRCS = avr_allocateheap.c avr_assert.c avr_copystate.c
CMN_CSRCS += avr_createstack.c avr_doirq.c avr_exit.c avr_idle.c avr_initialize.c
CMN_CSRCS += avr_initialstate.c avr_irq.c avr_lowputs.c
CMN_CSRCS += avr_mdelay.c avr_modifyreg8.c avr_modifyreg16.c avr_modifyreg32.c
CMN_CSRCS += avr_nputs.c avr_releasepending.c avr_releasestack.c
CMN_CSRCS += avr_nputs.c avr_releasestack.c
CMN_CSRCS += avr_schedulesigaction.c avr_sigdeliver.c
CMN_CSRCS += avr_stackframe.c avr_udelay.c avr_switchcontext.c avr_usestack.c

View file

@ -29,7 +29,7 @@ CMN_CSRCS = avr_allocateheap.c avr_assert.c avr_copystate.c
CMN_CSRCS += avr_createstack.c avr_doirq.c avr_exit.c avr_idle.c avr_initialize.c
CMN_CSRCS += avr_initialstate.c avr_irq.c avr_lowputs.c
CMN_CSRCS += avr_mdelay.c avr_modifyreg8.c avr_modifyreg16.c avr_modifyreg32.c
CMN_CSRCS += avr_nputs.c avr_releasepending.c avr_releasestack.c
CMN_CSRCS += avr_nputs.c avr_releasestack.c
CMN_CSRCS += avr_schedulesigaction.c avr_sigdeliver.c
CMN_CSRCS += avr_stackframe.c avr_udelay.c avr_switchcontext.c avr_usestack.c

View file

@ -1,114 +0,0 @@
/****************************************************************************
* arch/avr/src/avr/avr_releasepending.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sched.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/sched.h>
#include "sched/sched.h"
#include "avr_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_release_pending
*
* Description:
* Release and ready-to-run tasks that have
* collected in the pending task list. This can call a
* context switch if a new task is placed at the head of
* the ready to run list.
*
****************************************************************************/
void up_release_pending(void)
{
struct tcb_s *rtcb = this_task();
sinfo("From TCB=%p\n", rtcb);
/* Merge the g_pendingtasks list into the ready-to-run task list */
if (nxsched_merge_pending())
{
/* The currently active task has changed! We will need to switch
* contexts.
*/
/* Update scheduler parameters */
nxsched_suspend_scheduler(rtcb);
if (g_current_regs)
{
/* Yes, then we have to do things differently.
* Just copy the g_current_regs into the OLD rtcb.
*/
avr_savestate(rtcb->xcp.regs);
/* Restore the exception context of the rtcb at the (new) head
* of the ready-to-run task list.
*/
rtcb = this_task();
/* Update scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts */
avr_restorestate(rtcb->xcp.regs);
}
/* No, then we will need to perform the user context switch */
else
{
struct tcb_s *nexttcb = this_task();
/* Update scheduler parameters */
nxsched_resume_scheduler(nexttcb);
/* Switch context to the context of the task at the head of the
* ready to run list.
*/
avr_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
/* avr_switchcontext forces a context switch to the task at the
* head of the ready-to-run list. It does not 'return' in the
* normal sense. When it does return, it is because the blocked
* task is again ready to run and has execution priority.
*/
}
}
}

View file

@ -1,130 +0,0 @@
/****************************************************************************
* arch/avr/src/avr32/avr_releasepending.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sched.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/sched.h>
#include "sched/sched.h"
#include "group/group.h"
#include "avr_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_release_pending
*
* Description:
* Release and ready-to-run tasks that have
* collected in the pending task list. This can call a
* context switch if a new task is placed at the head of
* the ready to run list.
*
****************************************************************************/
void up_release_pending(void)
{
struct tcb_s *rtcb = this_task();
sinfo("From TCB=%p\n", rtcb);
/* Merge the g_pendingtasks list into the ready-to-run task list */
if (nxsched_merge_pending())
{
/* The currently active task has changed! We will need to switch
* contexts.
*
* Update scheduler parameters.
*/
nxsched_suspend_scheduler(rtcb);
/* Are we operating in interrupt context? */
if (g_current_regs)
{
/* Yes, then we have to do things differently.
* Just copy the g_current_regs into the OLD rtcb.
*/
avr_savestate(rtcb->xcp.regs);
/* Restore the exception context of the rtcb at the (new) head
* of the ready-to-run task list.
*/
rtcb = this_task();
/* Update scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts. Any necessary address environment
* changes will be made when the interrupt returns.
*/
avr_restorestate(rtcb->xcp.regs);
}
/* 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.
*/
struct tcb_s *nexttcb = this_task();
#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.
*/
group_addrenv(nexttcb);
#endif
/* Update scheduler parameters */
nxsched_resume_scheduler(nexttcb);
/* Then switch contexs */
avr_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
/* avr_switchcontext forces a context switch to the task at the
* head of the ready-to-run list. It does not 'return' in the
* normal sense. When it does return, it is because the blocked
* task is again ready to run and has execution priority.
*/
}
}
}

View file

@ -1,114 +0,0 @@
/****************************************************************************
* arch/ceva/src/common/ceva_releasepending.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <debug.h>
#include <nuttx/arch.h>
#include "sched/sched.h"
#include "ceva_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_release_pending
*
* Description:
* Release and ready-to-run tasks that have
* collected in the pending task list. This can call a
* context switch if a new task is placed at the head of
* the ready to run list.
*
****************************************************************************/
void up_release_pending(void)
{
struct tcb_s *rtcb = this_task();
sinfo("From TCB=%p\n", rtcb);
/* Merge the g_pendingtasks list into the ready-to-run task list */
if (sched_mergepending())
{
/* The currently active task has changed! We will need to switch
* contexts.
*/
/* Update scheduler parameters */
sched_suspend_scheduler(rtcb);
/* Are we operating in interrupt context? */
if (CURRENT_REGS)
{
/* Yes, then we have to do things differently. Just copy the
* CURRENT_REGS into the OLD rtcb.
*/
rtcb->xcp.regs = CURRENT_REGS;
/* Restore the exception context of the rtcb at the (new) head
* of the ready-to-run task list.
*/
rtcb = this_task();
/* Update scheduler parameters */
sched_resume_scheduler(rtcb);
/* Then switch contexts */
CURRENT_REGS = rtcb->xcp.regs;
}
/* No, then we will need to perform the user context switch */
else
{
struct tcb_s *nexttcb = this_task();
/* Update scheduler parameters */
sched_resume_scheduler(nexttcb);
/* Switch context to the context of the task at the head of the
* ready to run list.
*/
ceva_switchcontext(&rtcb->xcp.regs, nexttcb->xcp.regs);
/* ceva_switchcontext forces a context switch to the task at the
* head of the ready-to-run list. It does not 'return' in the
* normal sense. When it does return, it is because the blocked
* task is again ready to run and has execution priority.
*/
}
}
}

View file

@ -1,127 +0,0 @@
/****************************************************************************
* arch/hc/src/common/hc_releasepending.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sched.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/sched.h>
#include "sched/sched.h"
#include "group/group.h"
#include "hc_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_release_pending
*
* Description:
* Release and ready-to-run tasks that have collected in the pending task
* list. This can call a context switch if a new task is placed at the
* head of the ready to run list.
*
****************************************************************************/
void up_release_pending(void)
{
struct tcb_s *rtcb = this_task();
sinfo("From TCB=%p\n", rtcb);
/* Merge the g_pendingtasks list into the ready-to-run task list */
if (nxsched_merge_pending())
{
/* The currently active task has changed! We will need to switch
* contexts.
*
* Update scheduler parameters.
*/
nxsched_suspend_scheduler(rtcb);
/* Are we operating in interrupt context? */
if (g_current_regs)
{
/* Yes, then we have to do things differently.
* Just copy the g_current_regs into the OLD rtcb.
*/
hc_savestate(rtcb->xcp.regs);
/* Restore the exception context of the rtcb at the (new) head
* of the ready-to-run task list.
*/
rtcb = this_task();
/* Update scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts. Any necessary address environment
* changes will be made when the interrupt returns.
*/
hc_restorestate(rtcb->xcp.regs);
}
/* Copy the exception context into the TCB of the task that
* was currently active. if up_saveusercontext returns a non-zero
* value, then this is really the previously running task
* restarting!
*/
else if (!up_saveusercontext(rtcb->xcp.regs))
{
/* Restore the exception context of the rtcb at the (new) head
* of the ready-to-run task list.
*/
rtcb = this_task();
#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.
*/
group_addrenv(rtcb);
#endif
/* Update scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts */
hc_fullcontextrestore(rtcb->xcp.regs);
}
}
}

View file

@ -23,7 +23,7 @@ HEAD_ASRC = m9s12_vectors.S
CMN_CSRCS = hc_allocateheap.c hc_copystate.c hc_createstack.c
CMN_CSRCS += hc_doirq.c hc_exit.c hc_idle.c hc_initialize.c
CMN_CSRCS += hc_mdelay.c hc_modifyreg16.c hc_modifyreg32.c hc_modifyreg8.c
CMN_CSRCS += hc_nputs.c hc_releasepending.c hc_releasestack.c
CMN_CSRCS += hc_nputs.c hc_releasestack.c
CMN_CSRCS += hc_stackframe.c hc_udelay.c hc_switchcontext.c hc_usestack.c
CHIP_ASRCS = m9s12_start.S m9s12_lowputc.S m9s12_saveusercontext.S

View file

@ -1,125 +0,0 @@
/****************************************************************************
* arch/mips/src/mips32/mips_releasepending.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sched.h>
#include <syscall.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/sched.h>
#include "sched/sched.h"
#include "group/group.h"
#include "mips_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_release_pending
*
* Description:
* Release and ready-to-run tasks that have
* collected in the pending task list. This can call a
* context switch if a new task is placed at the head of
* the ready to run list.
*
****************************************************************************/
void up_release_pending(void)
{
struct tcb_s *rtcb = this_task();
sinfo("From TCB=%p\n", rtcb);
/* Merge the g_pendingtasks list into the ready-to-run task list */
/* sched_lock(); */
if (nxsched_merge_pending())
{
/* The currently active task has changed! We will need to switch
* contexts.
*
* Update scheduler parameters.
*/
nxsched_suspend_scheduler(rtcb);
/* Are we operating in interrupt context? */
if (CURRENT_REGS)
{
/* Yes, then we have to do things differently.
* Just copy the g_current_regs into the OLD rtcb.
*/
mips_savestate(rtcb->xcp.regs);
/* Restore the exception context of the rtcb at the (new) head
* of the ready-to-run task list.
*/
rtcb = this_task();
/* Update scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts. Any necessary address environment
* changes will be made when the interrupt returns.
*/
mips_restorestate(rtcb->xcp.regs);
}
/* 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.
*/
struct tcb_s *nexttcb = this_task();
/* Update scheduler parameters */
nxsched_resume_scheduler(nexttcb);
/* Then switch contexts */
mips_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
/* mips_switchcontext forces a context switch to the task at the
* head of the ready-to-run list. It does not 'return' in the
* normal sense. When it does return, it is because the blocked
* task is again ready to run and has execution priority.
*/
}
}
}

View file

@ -29,7 +29,7 @@ CMN_CSRCS = mips_allocateheap.c mips_assert.c mips_copystate.c
CMN_CSRCS += mips_createstack.c mips_doirq.c mips_exit.c mips_initialize.c
CMN_CSRCS += mips_initialstate.c mips_irq.c mips_lowputs.c
CMN_CSRCS += mips_mdelay.c mips_modifyreg8.c mips_modifyreg16.c mips_modifyreg32.c
CMN_CSRCS += mips_nputs.c mips_releasepending.c mips_releasestack.c
CMN_CSRCS += mips_nputs.c mips_releasestack.c
CMN_CSRCS += mips_schedulesigaction.c mips_sigdeliver.c
CMN_CSRCS += mips_stackframe.c mips_swint0.c mips_udelay.c mips_switchcontext.c
CMN_CSRCS += mips_usestack.c mips_vfork.c

View file

@ -29,7 +29,7 @@ CMN_CSRCS = mips_allocateheap.c mips_assert.c mips_copystate.c
CMN_CSRCS += mips_createstack.c mips_doirq.c mips_exit.c mips_initialize.c
CMN_CSRCS += mips_initialstate.c mips_irq.c mips_lowputs.c
CMN_CSRCS += mips_mdelay.c mips_modifyreg8.c mips_modifyreg16.c mips_modifyreg32.c
CMN_CSRCS += mips_nputs.c mips_releasepending.c mips_releasestack.c
CMN_CSRCS += mips_nputs.c mips_releasestack.c
CMN_CSRCS += mips_schedulesigaction.c mips_sigdeliver.c
CMN_CSRCS += mips_stackframe.c mips_swint0.c mips_udelay.c mips_switchcontext.c
CMN_CSRCS += mips_usestack.c mips_vfork.c

View file

@ -30,7 +30,7 @@ CHIP_ASRCS = lm32_syscall.S
CHIP_CSRCS = lm32_allocateheap.c lm32_assert.c
CHIP_CSRCS += lm32_copystate.c lm32_createstack.c lm32_decodeirq.c
CHIP_CSRCS += lm32_doirq.c lm32_dumpstate.c lm32_exit.c lm32_idle.c
CHIP_CSRCS += lm32_initialstate.c lm32_irq.c lm32_releasepending.c
CHIP_CSRCS += lm32_initialstate.c lm32_irq.c
CHIP_CSRCS += lm32_releasestack.c lm32_stackframe.c lm32_swint.c
CHIP_CSRCS += lm32_switchcontext.c
CHIP_CSRCS += lm32_schedulesigaction.c lm32_sigdeliver.c

View file

@ -1,123 +0,0 @@
/****************************************************************************
* arch/misoc/src/lm32/lm32_releasepending.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sched.h>
#include <syscall.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/sched.h>
#include "sched/sched.h"
#include "group/group.h"
#include "lm32.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_release_pending
*
* Description:
* Release and ready-to-run tasks that have
* collected in the pending task list. This can call a
* context switch if a new task is placed at the head of
* the ready to run list.
*
****************************************************************************/
void up_release_pending(void)
{
struct tcb_s *rtcb = this_task();
sinfo("From TCB=%p\n", rtcb);
/* Merge the g_pendingtasks list into the ready-to-run task list */
if (nxsched_merge_pending())
{
/* The currently active task has changed! We will need to switch
* contexts.
*
* Update scheduler parameters.
*/
nxsched_suspend_scheduler(rtcb);
/* Are we operating in interrupt context? */
if (g_current_regs)
{
/* Yes, then we have to do things differently.
* Just copy the g_current_regs into the OLD rtcb.
*/
misoc_savestate(rtcb->xcp.regs);
/* Restore the exception context of the rtcb at the (new) head
* of the ready-to-run task list.
*/
rtcb = this_task();
/* Update scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts. Any necessary address environment
* changes will be made when the interrupt returns.
*/
misoc_restorestate(rtcb->xcp.regs);
}
/* 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.
*/
struct tcb_s *nexttcb = this_task();
/* Update scheduler parameters */
nxsched_resume_scheduler(nexttcb);
/* Then switch contexts */
misoc_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
/* misoc_switchcontext forces a context switch to the task at the
* head of the ready-to-run list. It does not 'return' in the
* normal sense. When it does return, it is because the blocked
* task is again ready to run and has execution priority.
*/
}
}
}

View file

@ -30,7 +30,7 @@ CHIP_ASRCS = minerva_syscall.S
CHIP_CSRCS = minerva_allocateheap.c minerva_assert.c
CHIP_CSRCS += minerva_copystate.c minerva_createstack.c minerva_decodeirq.c
CHIP_CSRCS += minerva_doirq.c minerva_dumpstate.c minerva_exit.c minerva_idle.c
CHIP_CSRCS += minerva_initialstate.c minerva_irq.c minerva_releasepending.c
CHIP_CSRCS += minerva_initialstate.c minerva_irq.c
CHIP_CSRCS += minerva_releasestack.c minerva_stackframe.c minerva_swint.c
CHIP_CSRCS += minerva_switchcontext.c
CHIP_CSRCS += minerva_schedulesigaction.c minerva_sigdeliver.c

View file

@ -1,123 +0,0 @@
/****************************************************************************
* arch/misoc/src/minerva/minerva_releasepending.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sched.h>
#include <syscall.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/sched.h>
#include "sched/sched.h"
#include "group/group.h"
#include "minerva.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_release_pending
*
* Description:
* Release and ready-to-run tasks that have
* collected in the pending task list. This can call a
* context switch if a new task is placed at the head of
* the ready to run list.
*
****************************************************************************/
void up_release_pending(void)
{
struct tcb_s *rtcb = this_task();
sinfo("From TCB=%p\n", rtcb);
/* Merge the g_pendingtasks list into the ready-to-run task list */
/* sched_lock(); */
if (nxsched_merge_pending())
{
/* The currently active task has changed! We will need to switch
* contexts. Update scheduler parameters.
*/
nxsched_suspend_scheduler(rtcb);
/* Are we operating in interrupt context? */
if (g_current_regs)
{
/* Yes, then we have to do things differently. Just copy the
* g_current_regs into the OLD rtcb.
*/
misoc_savestate(rtcb->xcp.regs);
/* Restore the exception context of the rtcb at the (new) head of
* the ready-to-run task list.
*/
rtcb = this_task();
/* Update scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts. Any necessary address environment changes
* will be made when the interrupt returns.
*/
misoc_restorestate(rtcb->xcp.regs);
}
/* 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.
*/
struct tcb_s *nexttcb = this_task();
/* Update scheduler parameters */
nxsched_resume_scheduler(nexttcb);
/* Then switch contexts */
misoc_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
/* misoc_switchcontext forces a context switch to the task at the
* head of the ready-to-run list. It does not 'return' in the
* normal sense. When it does return, it is because the blocked
* task is again ready to run and has execution priority.
*/
}
}
}

View file

@ -1,128 +0,0 @@
/****************************************************************************
* arch/or1k/src/common/or1k_releasepending.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sched.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/sched.h>
#include "sched/sched.h"
#include "group/group.h"
#include "or1k_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_release_pending
*
* Description:
* Release and ready-to-run tasks that have
* collected in the pending task list. This can call a
* context switch if a new task is placed at the head of
* the ready to run list.
*
****************************************************************************/
void up_release_pending(void)
{
struct tcb_s *rtcb = this_task();
sinfo("From TCB=%p\n", rtcb);
/* Merge the g_pendingtasks list into the ready-to-run task list */
if (nxsched_merge_pending())
{
/* The currently active task has changed! We will need to switch
* contexts.
*
* Update scheduler parameters.
*/
nxsched_suspend_scheduler(rtcb);
/* Are we operating in interrupt context? */
if (CURRENT_REGS)
{
/* Yes, then we have to do things differently.
* Just copy the CURRENT_REGS into the OLD rtcb.
*/
or1k_savestate(rtcb->xcp.regs);
/* Restore the exception context of the rtcb at the (new) head
* of the ready-to-run task list.
*/
rtcb = this_task();
/* Update scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts. Any necessary address environment
* changes will be made when the interrupt returns.
*/
or1k_restorestate(rtcb->xcp.regs);
}
/* Copy the exception context into the TCB of the task that
* was currently active. if up_saveusercontext returns a non-zero
* value, then this is really the previously running task
* restarting!
*/
else if (!up_saveusercontext(rtcb->xcp.regs))
{
/* Restore the exception context of the rtcb at the (new) head
* of the ready-to-run task list.
*/
rtcb = this_task();
#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.
*/
group_addrenv(rtcb);
#endif
/* Update scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts */
or1k_fullcontextrestore(rtcb->xcp.regs);
}
}
}

View file

@ -30,7 +30,6 @@ CMN_CSRCS = or1k_initialize.c \
or1k_stackframe.c \
or1k_initialstate.c \
or1k_switchcontext.c \
or1k_releasepending.c \
or1k_schedulesigaction.c \
or1k_copyfullstate.c \
or1k_assert.c \

View file

@ -1,128 +0,0 @@
/****************************************************************************
* arch/renesas/src/common/renesas_releasepending.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sched.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/sched.h>
#include "sched/sched.h"
#include "group/group.h"
#include "renesas_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_release_pending
*
* Description:
* Release and ready-to-run tasks that have
* collected in the pending task list. This can call a
* context switch if a new task is placed at the head of
* the ready to run list.
*
****************************************************************************/
void up_release_pending(void)
{
struct tcb_s *rtcb = this_task();
sinfo("From TCB=%p\n", rtcb);
/* Merge the g_pendingtasks list into the ready-to-run task list */
if (nxsched_merge_pending())
{
/* The currently active task has changed! We will need to switch
* contexts.
*
* Update scheduler parameters.
*/
nxsched_suspend_scheduler(rtcb);
/* Are we operating in interrupt context? */
if (g_current_regs)
{
/* Yes, then we have to do things differently.
* Just copy the g_current_regs into the OLD rtcb.
*/
renesas_savestate(rtcb->xcp.regs);
/* Restore the exception context of the rtcb at the (new) head
* of the ready-to-run task list.
*/
rtcb = this_task();
/* Update scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts. Any necessary address environment
* changes will be made when the interrupt returns.
*/
g_current_regs = rtcb->xcp.regs;
}
/* Copy the exception context into the TCB of the task that
* was currently active. if up_saveusercontext returns a non-zero
* value, then this is really the previously running task
* restarting!
*/
else if (!up_saveusercontext(rtcb->xcp.regs))
{
/* Restore the exception context of the rtcb at the (new) head
* of the ready-to-run task list.
*/
rtcb = this_task();
#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.
*/
group_addrenv(rtcb);
#endif
/* Update scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts */
renesas_fullcontextrestore(rtcb->xcp.regs);
}
}
}

View file

@ -22,8 +22,7 @@ HEAD_ASRC = m16c_head.S
CMN_CSRCS = renesas_allocateheap.c renesas_assert.c
CMN_CSRCS += renesas_createstack.c renesas_doirq.c renesas_exit.c renesas_idle.c renesas_initialize.c
CMN_CSRCS += renesas_lowputs.c renesas_mdelay.c renesas_nputs.c
CMN_CSRCS += renesas_releasepending.c renesas_releasestack.c
CMN_CSRCS += renesas_lowputs.c renesas_mdelay.c renesas_nputs.c renesas_releasestack.c
CMN_CSRCS += renesas_stackframe.c renesas_udelay.c renesas_switchcontext.c renesas_usestack.c
CHIP_ASRCS = m16c_vectors.S

View file

@ -22,8 +22,7 @@ HEAD_ASRC = rx65n_head.S
CMN_CSRCS = renesas_allocateheap.c renesas_assert.c
CMN_CSRCS += renesas_createstack.c renesas_doirq.c renesas_exit.c renesas_idle.c renesas_initialize.c
CMN_CSRCS += renesas_lowputs.c renesas_mdelay.c renesas_nputs.c
CMN_CSRCS += renesas_releasepending.c renesas_releasestack.c
CMN_CSRCS += renesas_lowputs.c renesas_mdelay.c renesas_nputs.c renesas_releasestack.c
CMN_CSRCS += renesas_stackframe.c renesas_udelay.c renesas_switchcontext.c renesas_usestack.c
CHIP_ASRCS = rx65n_vector.S

View file

@ -23,7 +23,7 @@ HEAD_ASRC = sh1_head.S
CMN_CSRCS = renesas_allocateheap.c renesas_assert.c
CMN_CSRCS += renesas_createstack.c renesas_doirq.c renesas_exit.c renesas_idle.c renesas_initialize.c
CMN_CSRCS += renesas_initialstate.c renesas_lowputs.c
CMN_CSRCS += renesas_mdelay.c renesas_nputs.c renesas_releasepending.c renesas_releasestack.c
CMN_CSRCS += renesas_mdelay.c renesas_nputs.c renesas_releasestack.c
CMN_CSRCS += renesas_stackframe.c renesas_udelay.c
CMN_CSRCS += sh1_schedulesigaction.c sh1_sigdeliver.c
CMN_CSRCS += renesas_switchcontext.c renesas_usestack.c

View file

@ -30,7 +30,6 @@ CMN_CSRCS += riscv_initialize.c riscv_swint.c riscv_mtimer.c
CMN_CSRCS += riscv_allocateheap.c riscv_createstack.c riscv_exit.c
CMN_CSRCS += riscv_assert.c riscv_copystate.c riscv_initialstate.c
CMN_CSRCS += riscv_modifyreg32.c riscv_nputs.c
CMN_CSRCS += riscv_releasepending.c
CMN_CSRCS += riscv_releasestack.c riscv_stackframe.c riscv_schedulesigaction.c
CMN_CSRCS += riscv_sigdeliver.c riscv_switchcontext.c riscv_usestack.c
CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c riscv_cpuidlestack.c

View file

@ -1,125 +0,0 @@
/****************************************************************************
* arch/risc-v/src/common/riscv_releasepending.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sched.h>
#include <syscall.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/sched.h>
#include "sched/sched.h"
#include "group/group.h"
#include "riscv_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_release_pending
*
* Description:
* Release and ready-to-run tasks that have
* collected in the pending task list. This can call a
* context switch if a new task is placed at the head of
* the ready to run list.
*
****************************************************************************/
void up_release_pending(void)
{
struct tcb_s *rtcb = this_task();
sinfo("From TCB=%p\n", rtcb);
/* Merge the g_pendingtasks list into the ready-to-run task list */
/* sched_lock(); */
if (nxsched_merge_pending())
{
/* The currently active task has changed! We will need to switch
* contexts.
*
* Update scheduler parameters.
*/
nxsched_suspend_scheduler(rtcb);
/* Are we operating in interrupt context? */
if (CURRENT_REGS)
{
/* Yes, then we have to do things differently.
* Just copy the CURRENT_REGS into the OLD rtcb.
*/
riscv_savestate(rtcb->xcp.regs);
/* Restore the exception context of the rtcb at the (new) head
* of the ready-to-run task list.
*/
rtcb = this_task();
/* Update scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts. Any necessary address environment
* changes will be made when the interrupt returns.
*/
riscv_restorestate(rtcb->xcp.regs);
}
/* 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.
*/
struct tcb_s *nexttcb = this_task();
/* Update scheduler parameters */
nxsched_resume_scheduler(nexttcb);
/* Then switch contexts */
riscv_switchcontext(&rtcb->xcp.regs, nexttcb->xcp.regs);
/* riscv_switchcontext forces a context switch to the task at the
* head of the ready-to-run list. It does not 'return' in the
* normal sense. When it does return, it is because the blocked
* task is again ready to run and has execution priority.
*/
}
}
}

View file

@ -59,8 +59,7 @@ AOBJS = $(ASRCS:.S=$(OBJEXT))
CSRCS = sim_initialize.c sim_idle.c sim_interruptcontext.c sim_initialstate.c
CSRCS += sim_createstack.c sim_usestack.c sim_releasestack.c sim_stackframe.c
CSRCS += sim_switchcontext.c sim_releasepending.c
CSRCS += sim_exit.c sim_schedulesigaction.c
CSRCS += sim_exit.c sim_schedulesigaction.c sim_switchcontext.c
CSRCS += sim_heap.c sim_uart.c sim_assert.c sim_nputs.c
CSRCS += sim_copyfullstate.c
CSRCS += sim_sigdeliver.c

View file

@ -1,114 +0,0 @@
/****************************************************************************
* arch/sim/src/sim/sim_releasepending.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sched.h>
#include <assert.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/sched.h>
#include "sched/sched.h"
#include "sim_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_release_pending
*
* Description:
* Release and ready-to-run tasks that have
* collected in the pending task list. This can call a
* context switch if a new task is placed at the head of
* the ready to run list.
*
****************************************************************************/
void up_release_pending(void)
{
struct tcb_s *rtcb = this_task();
sinfo("From TCB=%p\n", rtcb);
/* Merge the g_pendingtasks list into the ready-to-run task list */
/* sched_lock(); */
if (nxsched_merge_pending())
{
/* The currently active task has changed! We will need to switch
* contexts.
*
* Update scheduler parameters.
*/
nxsched_suspend_scheduler(rtcb);
/* TODO */
if (CURRENT_REGS)
{
ASSERT(false);
}
/* Copy the exception context into the TCB of the task that was
* currently active. if setjmp returns a non-zero value, then
* this is really the previously running task restarting!
*/
else if (!setjmp(rtcb->xcp.regs))
{
/* Restore the exception context of the rtcb at the (new) head
* of the ready-to-run task list.
*/
rtcb = this_task();
sinfo("New Active Task TCB=%p\n", rtcb);
/* Update scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Restore the cpu lock */
restore_critical_section();
/* Then switch contexts */
longjmp(rtcb->xcp.regs, 1);
}
else
{
/* The way that we handle signals in the simulation is kind of
* a kludge. This would be unsafe in a truly multi-threaded,
* interrupt driven environment.
*/
sim_sigdeliver();
}
}
}

View file

@ -25,7 +25,7 @@ include common/Make.defs
CMN_ASRCS += sparc_v8_syscall.S
CMN_CSRCS += sparc_v8_copystate.c sparc_v8_doirq.c
CMN_CSRCS += sparc_v8_initialstate.c sparc_v8_irq.c
CMN_CSRCS += sparc_v8_releasepending.c sparc_v8_schedulesigaction.c
CMN_CSRCS += sparc_v8_schedulesigaction.c
CMN_CSRCS += sparc_v8_sigdeliver.c sparc_v8_swint1.c sparc_v8_systemreset.c
CMN_CSRCS += sparc_v8_switchcontext.c

View file

@ -1,118 +0,0 @@
/****************************************************************************
* arch/sparc/src/sparc_v8/sparc_v8_releasepending.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sched.h>
#include <syscall.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/sched.h>
#include "sched/sched.h"
#include "sparc_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_release_pending
*
* Description:
* Release and ready-to-run tasks that have
* collected in the pending task list. This can call a
* context switch if a new task is placed at the head of
* the ready to run list.
*
****************************************************************************/
void up_release_pending(void)
{
struct tcb_s *rtcb = this_task();
sinfo("From TCB=%p\n", rtcb);
/* Merge the g_pendingtasks list into the ready-to-run task list */
/* sched_lock(); */
if (nxsched_merge_pending())
{
/* The currently active task has changed! We will need to switch
* contexts.
*/
/* Update scheduler parameters */
nxsched_suspend_scheduler(rtcb);
if (CURRENT_REGS)
{
/* Yes, then we have to do things differently.
* Just copy the CURRENT_REGS into the OLD rtcb.
*/
sparc_savestate(rtcb->xcp.regs);
/* Restore the exception context of the rtcb at the (new) head
* of the ready-to-run task list.
*/
rtcb = this_task();
/* Update scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts */
sparc_restorestate(rtcb->xcp.regs);
}
/* No, then we will need to perform the user context switch */
else
{
struct tcb_s *nexttcb = this_task();
/* Update scheduler parameters */
nxsched_resume_scheduler(nexttcb);
/* Switch context to the context of the task at the head of the
* ready to run list.
*/
sparc_switchcontext(rtcb->xcp.regs, nexttcb->xcp.regs);
/* sparc_switchcontext forces a context switch to the task at the
* head of the ready-to-run list. It does not 'return' in the
* normal sense. When it does return, it is because the blocked
* task is again ready to run and has execution priority.
*/
}
}
}

View file

@ -1,128 +0,0 @@
/****************************************************************************
* arch/x86/src/common/x86_releasepending.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sched.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/sched.h>
#include "sched/sched.h"
#include "group/group.h"
#include "x86_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_release_pending
*
* Description:
* Release and ready-to-run tasks that have
* collected in the pending task list. This can call a
* context switch if a new task is placed at the head of
* the ready to run list.
*
****************************************************************************/
void up_release_pending(void)
{
struct tcb_s *rtcb = this_task();
sinfo("From TCB=%p\n", rtcb);
/* Merge the g_pendingtasks list into the ready-to-run task list */
if (nxsched_merge_pending())
{
/* The currently active task has changed! We will need to switch
* contexts.
*
* Update scheduler parameters.
*/
nxsched_suspend_scheduler(rtcb);
/* Are we operating in interrupt context? */
if (g_current_regs)
{
/* Yes, then we have to do things differently.
* Just copy the g_current_regs into the OLD rtcb.
*/
x86_savestate(rtcb->xcp.regs);
/* Restore the exception context of the rtcb at the (new) head
* of the ready-to-run task list.
*/
rtcb = this_task();
/* Update scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts. Any necessary address environment
* changes will be made when the interrupt returns.
*/
x86_restorestate(rtcb->xcp.regs);
}
/* Copy the exception context into the TCB of the task that
* was currently active. if up_saveusercontext returns a non-zero
* value, then this is really the previously running task
* restarting!
*/
else if (!up_saveusercontext(rtcb->xcp.regs))
{
/* Restore the exception context of the rtcb at the (new) head
* of the ready-to-run task list.
*/
rtcb = this_task();
#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.
*/
group_addrenv(rtcb);
#endif
/* Update scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts */
x86_fullcontextrestore(rtcb->xcp.regs);
}
}
}

View file

@ -30,7 +30,7 @@ CMN_CSRCS += i486_createstack.c i486_initialstate.c
CMN_CSRCS += x86_allocateheap.c x86_assert.c x86_copystate.c
CMN_CSRCS += x86_exit.c x86_initialize.c x86_mdelay.c x86_udelay.c
CMN_CSRCS += x86_modifyreg8.c x86_modifyreg16.c x86_modifyreg32.c
CMN_CSRCS += x86_nputs.c x86_releasepending.c x86_switchcontext.c
CMN_CSRCS += x86_nputs.c x86_switchcontext.c
CMN_CSRCS += i486_irq.c i486_regdump.c i486_releasestack.c
CMN_CSRCS += i486_savestate.c i486_sigdeliver.c
CMN_CSRCS += i486_schedulesigaction.c i486_stackframe.c

View file

@ -1,130 +0,0 @@
/****************************************************************************
* arch/x86_64/src/common/x86_64_releasepending.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sched.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/sched.h>
#include "sched/sched.h"
#include "group/group.h"
#include "x86_64_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_release_pending
*
* Description:
* Release and ready-to-run tasks that have
* collected in the pending task list. This can call a
* context switch if a new task is placed at the head of
* the ready to run list.
*
****************************************************************************/
void up_release_pending(void)
{
struct tcb_s *rtcb = this_task();
sinfo("From TCB=%p\n", rtcb);
/* Merge the g_pendingtasks list into the ready-to-run task list */
if (nxsched_merge_pending())
{
/* The currently active task has changed! We will need to switch
* contexts.
*
* Update scheduler parameters.
*/
nxsched_suspend_scheduler(rtcb);
/* Are we operating in interrupt context? */
if (g_current_regs)
{
/* Yes, then we have to do things differently.
* Just copy the g_current_regs into the OLD rtcb.
*/
x86_64_savestate(rtcb->xcp.regs);
/* Restore the exception context of the rtcb at the (new) head
* of the ready-to-run task list.
*/
rtcb = this_task();
x86_64_restore_auxstate(rtcb);
/* Update scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts. Any necessary address environment
* changes will be made when the interrupt returns.
*/
x86_64_restorestate(rtcb->xcp.regs);
}
/* Copy the exception context into the TCB of the task that
* was currently active. if up_saveusercontext returns a non-zero
* value, then this is really the previously running task
* restarting!
*/
else if (!up_saveusercontext(rtcb->xcp.regs))
{
/* Restore the exception context of the rtcb at the (new) head
* of the ready-to-run task list.
*/
rtcb = this_task();
x86_64_restore_auxstate(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.
*/
group_addrenv(rtcb);
#endif
/* Update scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts */
x86_64_fullcontextrestore(rtcb->xcp.regs);
}
}
}

View file

@ -23,7 +23,7 @@
CMN_CSRCS += x86_64_allocateheap.c x86_64_assert.c x86_64_copystate.c
CMN_CSRCS += x86_64_mdelay.c x86_64_udelay.c x86_64_exit.c x86_64_initialize.c
CMN_CSRCS += x86_64_modifyreg8.c x86_64_modifyreg16.c x86_64_modifyreg32.c x86_64_nputs.c
CMN_CSRCS += x86_64_releasepending.c x86_64_switchcontext.c
CMN_CSRCS += x86_64_switchcontext.c
CMN_CSRCS += intel64_restore_auxstate.c intel64_createstack.c intel64_initialstate.c
CMN_CSRCS += intel64_regdump.c intel64_releasestack.c intel64_map_region.c
CMN_CSRCS += intel64_savestate.c intel64_sigdeliver.c

View file

@ -32,7 +32,7 @@ CMN_CSRCS += xtensa_cpenable.c xtensa_createstack.c xtensa_exit.c
CMN_CSRCS += xtensa_initialize.c xtensa_initialstate.c
CMN_CSRCS += xtensa_irqdispatch.c xtensa_lowputs.c xtensa_mdelay.c
CMN_CSRCS += xtensa_modifyreg8.c xtensa_modifyreg16.c xtensa_modifyreg32.c
CMN_CSRCS += xtensa_nputs.c xtensa_releasepending.c xtensa_releasestack.c
CMN_CSRCS += xtensa_nputs.c xtensa_releasestack.c
CMN_CSRCS += xtensa_schedsigaction.c
CMN_CSRCS += xtensa_sigdeliver.c xtensa_stackframe.c xtensa_udelay.c
CMN_CSRCS += xtensa_switchcontext.c xtensa_usestack.c xtensa_swint.c

View file

@ -1,121 +0,0 @@
/****************************************************************************
* arch/xtensa/src/common/xtensa_releasepending.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sched.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/sched.h>
#include <arch/chip/core-isa.h>
#include "sched/sched.h"
#include "group/group.h"
#include "xtensa.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_release_pending
*
* Description:
* Release and ready-to-run tasks that have
* collected in the pending task list. This can call a
* context switch if a new task is placed at the head of
* the ready to run list.
*
****************************************************************************/
void up_release_pending(void)
{
struct tcb_s *rtcb = this_task();
sinfo("From TCB=%p\n", rtcb);
/* Merge the g_pendingtasks list into the ready-to-run task list */
if (nxsched_merge_pending())
{
/* The currently active task has changed! We will need to
* switch contexts.
*/
/* Update scheduler parameters */
nxsched_suspend_scheduler(rtcb);
/* Are we operating in interrupt context? */
if (CURRENT_REGS)
{
/* Yes, then we have to do things differently.
* Just copy the CURRENT_REGS into the OLD rtcb.
*/
xtensa_savestate(rtcb->xcp.regs);
/* Restore the exception context of the rtcb at the (new) head
* of the ready-to-run task list.
*/
rtcb = this_task();
/* Update scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts. Any necessary address environment
* changes will be made when the interrupt returns.
*/
xtensa_restorestate(rtcb->xcp.regs);
}
/* No, then we will need to perform the user context switch */
else
{
struct tcb_s *nexttcb = this_task();
/* Reset scheduler parameters */
nxsched_resume_scheduler(nexttcb);
/* Switch context to the context of the task at the head of the
* ready to run list.
*/
xtensa_switchcontext(&rtcb->xcp.regs, nexttcb->xcp.regs);
/* xtensa_switchcontext forces a context switch to the task at the
* head of the ready-to-run list. It does not 'return' in the
* normal sense. When it does return, it is because the blocked
* task is again ready to run and has execution priority.
*/
}
}
}

View file

@ -1,120 +0,0 @@
/****************************************************************************
* arch/z16/src/common/z16_releasepending.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sched.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/sched.h>
#include "chip.h"
#include "sched/sched.h"
#include "z16_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_release_pending
*
* Description:
* Release and ready-to-run tasks that have
* collected in the pending task list. This can call a
* context switch if a new task is placed at the head of
* the ready to run list.
*
****************************************************************************/
void up_release_pending(void)
{
FAR struct tcb_s *rtcb = this_task();
sinfo("From TCB=%p\n", rtcb);
/* Merge the g_pendingtasks list into the ready-to-run task list */
if (nxsched_merge_pending())
{
/* The currently active task has changed! We will need to switch
* contexts.
*
* Update scheduler parameters.
*/
nxsched_suspend_scheduler(rtcb);
/* Are we operating in interrupt context? */
if (IN_INTERRUPT)
{
/* Yes, then we have to do things differently.
* Just copy the current context into the OLD rtcb.
*/
SAVE_IRQCONTEXT(rtcb);
/* Restore the exception context of the rtcb at the (new) head
* of the ready-to-run task list.
*/
rtcb = this_task();
/* Update scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then setup so that the context will be performed on exit
* from the interrupt.
*/
SET_IRQCONTEXT(rtcb);
}
/* Copy the exception context into the TCB of the task that
* was currently active. if SAVE_USERCONTEXT returns a non-zero
* value, then this is really the previously running task
* restarting!
*/
else if (!SAVE_USERCONTEXT(rtcb))
{
/* Restore the exception context of the rtcb at the (new) head
* of the ready-to-run task list.
*/
rtcb = this_task();
/* Update scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts */
RESTORE_USERCONTEXT(rtcb);
}
}
}

View file

@ -24,7 +24,7 @@ CMN_CSRCS = z16_allocateheap.c z16_initialize.c z16_schedulesigaction.c
CMN_CSRCS += z16_assert.c z16_initialstate.c z16_sigdeliver.c
CMN_CSRCS += z16_stackdump.c z16_copystate.c
CMN_CSRCS += z16_mdelay.c z16_udelay.c z16_createstack.c z16_registerdump.c
CMN_CSRCS += z16_switchcontext.c z16_doirq.c z16_releasepending.c z16_usestack.c
CMN_CSRCS += z16_switchcontext.c z16_doirq.c z16_usestack.c
CMN_CSRCS += z16_exit.c z16_releasestack.c z16_stackframe.c z16_idle.c
CMN_CSRCS += z16_nputs.c

View file

@ -1,132 +0,0 @@
/****************************************************************************
* arch/z80/src/common/z80_releasepending.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sched.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <nuttx/sched.h>
#include "chip.h"
#include "chip/switch.h"
#include "sched/sched.h"
#include "group/group.h"
#include "z80_internal.h"
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_release_pending
*
* Description:
* Release and ready-to-run tasks that have
* collected in the pending task list. This can call a
* context switch if a new task is placed at the head of
* the ready to run list.
*
****************************************************************************/
void up_release_pending(void)
{
FAR struct tcb_s *rtcb = this_task();
sinfo("From TCB=%p\n", rtcb);
/* Merge the g_pendingtasks list into the ready-to-run task list */
if (nxsched_merge_pending())
{
/* The currently active task has changed! We will need to switch
* contexts.
*
* Update scheduler parameters.
*/
nxsched_suspend_scheduler(rtcb);
/* Are we operating in interrupt context? */
if (IN_INTERRUPT())
{
/* Yes, then we have to do things differently.
* Just copy the current context into the OLD rtcb.
*/
SAVE_IRQCONTEXT(rtcb);
/* Restore the exception context of the rtcb at the (new) head
* of the ready-to-run task list.
*/
rtcb = this_task();
/* Update scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then setup so that the context will be performed on exit
* from the interrupt. Any necessary address environment
* changes will be made when the interrupt returns.
*/
SET_IRQCONTEXT(rtcb);
}
/* Copy the exception context into the TCB of the task that
* was currently active. if SAVE_USERCONTEXT returns a non-zero
* value, then this is really the previously running task
* restarting!
*/
else if (!SAVE_USERCONTEXT(rtcb))
{
/* Restore the exception context of the rtcb at the (new) head
* of the ready-to-run task list.
*/
rtcb = this_task();
#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.
*/
group_addrenv(rtcb);
#endif
/* Update scheduler parameters */
nxsched_resume_scheduler(rtcb);
/* Then switch contexts */
RESTORE_USERCONTEXT(rtcb);
}
}
}

View file

@ -20,7 +20,7 @@
CMN_CSRCS = z80_initialize.c z80_allocateheap.c z80_createstack.c
CMN_CSRCS += z80_releasestack.c z80_interruptcontext.c
CMN_CSRCS += z80_switchcontext.c z80_exit.c z80_releasepending.c
CMN_CSRCS += z80_switchcontext.c z80_exit.c
CMN_CSRCS += z80_idle.c z80_assert.c z80_doirq.c
CMN_CSRCS += z80_mdelay.c z80_stackframe.c z80_udelay.c z80_usestack.c
CMN_CSRCS += z80_nputs.c

View file

@ -28,7 +28,7 @@ endif
CMN_CSRCS = z80_allocateheap.c z80_assert.c z80_createstack.c
CMN_CSRCS += z80_doirq.c z80_exit.c z80_idle.c z80_initialize.c
CMN_CSRCS += z80_interruptcontext.c z80_mdelay.c z80_releasepending.c
CMN_CSRCS += z80_interruptcontext.c z80_mdelay.c
CMN_CSRCS += z80_releasestack.c z80_stackframe.c
CMN_CSRCS += z80_switchcontext.c z80_udelay.c z80_usestack.c z80_nputs.c

View file

@ -22,7 +22,7 @@ HEAD_SSRC = z8_head.S
CMN_CSRCS = z80_initialize.c z80_allocateheap.c z80_createstack.c
CMN_CSRCS += z80_releasestack.c z80_interruptcontext.c
CMN_CSRCS += z80_switchcontext.c z80_exit.c z80_releasepending.c
CMN_CSRCS += z80_switchcontext.c z80_exit.c
CMN_CSRCS += z80_idle.c z80_assert.c z80_doirq.c
CMN_CSRCS += z80_mdelay.c z80_stackframe.c z80_udelay.c z80_usestack.c
CMN_CSRCS += z80_nputs.c

View file

@ -28,7 +28,7 @@ endif
CMN_CSRCS = z80_initialize.c z80_allocateheap.c z80_createstack.c
CMN_CSRCS += z80_releasestack.c z80_interruptcontext.c
CMN_CSRCS += z80_switchcontext.c z80_exit.c z80_releasepending.c
CMN_CSRCS += z80_switchcontext.c z80_exit.c
CMN_CSRCS += z80_idle.c z80_assert.c z80_doirq.c
CMN_CSRCS += z80_mdelay.c z80_stackframe.c z80_udelay.c z80_usestack.c

View file

@ -61,7 +61,6 @@ SECTIONS
*libarch.a:arm_doirq.o(.text .text.*)
*libarch.a:arm_unblocktask.o(.text .text.*)
*libarch.a:arm_blocktask.o(.text .text.*)
*libarch.a:arm_releasepending.o(.text .text.*)
*libsched.a:nx_start.o(.rodata .rodata.g_tasklisttable)
*libsched.a:sem_post.o(.text .text.*)

View file

@ -403,25 +403,6 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype);
void up_switch_context(FAR struct tcb_s *tcb, FAR struct tcb_s *rtcb);
/****************************************************************************
* Name: up_release_pending
*
* Description:
* When tasks become ready-to-run but cannot run because
* pre-emption is disabled, they are placed into a pending
* task list. This function releases and makes ready-to-run
* all of the tasks that have collected in the pending task
* list. This can cause a context switch if a new task is
* placed at the head of the ready to run list.
*
* This function is called only from the NuttX scheduling
* logic when pre-emptioni is re-enabled. Interrupts will
* always be disabled when this function is called.
*
****************************************************************************/
void up_release_pending(void);
/****************************************************************************
* Name: up_exit
*

View file

@ -546,7 +546,7 @@ void leave_critical_section(irqstate_t flags)
{
/* Yes.. Check if there are pending tasks and that pre-
* emption is also enabled. This is necessary because we
* may have deferred the up_release_pending() call in
* may have deferred the nxsched_merge_pending() call in
* sched_unlock() because we were within a critical
* section then.
*/
@ -560,7 +560,10 @@ void leave_critical_section(irqstate_t flags)
* out!
*/
up_release_pending();
if (nxsched_merge_pending())
{
up_switch_context(this_task(), rtcb);
}
}
}

View file

@ -133,14 +133,17 @@ int sched_unlock(void)
*
* REVISIT: If this CPU is only one that holds the IRQ lock, then
* we should go ahead and release the pending tasks. See the logic
* leave_critical_section(): It will call up_release_pending()
* leave_critical_section(): It will call nxsched_merge_pending()
* BEFORE it clears IRQ lock.
*/
if (!nxsched_islocked_global() && !irq_cpu_locked(cpu) &&
g_pendingtasks.head != NULL)
{
up_release_pending();
if (nxsched_merge_pending())
{
up_switch_context(this_task(), rtcb);
}
}
#if CONFIG_RR_INTERVAL > 0
@ -155,7 +158,7 @@ int sched_unlock(void)
rtcb->timeslice == 0)
{
/* Yes.. that is the situation. But one more thing. The call
* to up_release_pending() above may have actually replaced
* to nxsched_merge_pending() above may have actually replaced
* the task at the head of the ready-to-run list. In that
* case, we need only to reset the timeslice value back to the
* maximum.
@ -195,7 +198,7 @@ int sched_unlock(void)
nxsched_sporadic_lowpriority(rtcb);
#ifdef CONFIG_SCHED_TICKLESS
/* Make sure that the call to up_release_pending() did not
/* Make sure that the call to nxsched_merge_pending() did not
* change the currently active task.
*/
@ -271,7 +274,10 @@ int sched_unlock(void)
if (g_pendingtasks.head != NULL)
{
up_release_pending();
if (nxsched_merge_pending())
{
up_switch_context(this_task(), rtcb);
}
}
#if CONFIG_RR_INTERVAL > 0
@ -286,7 +292,7 @@ int sched_unlock(void)
rtcb->timeslice == 0)
{
/* Yes.. that is the situation. But one more thing: The call
* to up_release_pending() above may have actually replaced
* to nxsched_merge_pending() above may have actually replaced
* the task at the head of the ready-to-run list. In that
* case, we need only to reset the timeslice value back to the
* maximum.
@ -326,7 +332,7 @@ int sched_unlock(void)
nxsched_sporadic_lowpriority(rtcb);
#ifdef CONFIG_SCHED_TICKLESS
/* Make sure that the call to up_release_pending() did not
/* Make sure that the call to nxsched_merge_pending() did not
* change the currently active task.
*/