diff --git a/Documentation/components/paging.rst b/Documentation/components/paging.rst index 5aa55fb87ec..455ac76da7f 100644 --- a/Documentation/components/paging.rst +++ b/Documentation/components/paging.rst @@ -102,7 +102,7 @@ function will perform the following operations: with the page fill worker must be "`locked <#MemoryOrg>`__" and always present in memory. #. **Block the currently executing task**. This function will call - ``up_block_task()`` to block the task at the head of the ready-to-run + ``up_switch_context()`` to block the task at the head of the ready-to-run list. This should cause an interrupt level context switch to the next highest priority task. The blocked task will be marked with state ``TSTATE_WAIT_PAGEFILL`` and will be retained in the @@ -373,8 +373,8 @@ Most standard, architecture-specific functions are declared in ``include/nuttx/arch.h``. However, for the case of this paging logic, the architecture specific functions are declared in ``include/nuttx/page.h``. Standard, architecture-specific functions that -should already be provided in the architecture port are :c:func:`up_block_task` -and :c:func:`up_unblock_task`. New, additional functions that must be +should already be provided in the architecture port are +:c:func:`up_switch_context`. New, additional functions that must be implemented just for on-demand paging support are: .. c:function:: int up_checkmapping(FAR struct tcb_s *tcb) diff --git a/Documentation/reference/os/arch.rst b/Documentation/reference/os/arch.rst index 4db8f496441..45dd69cba73 100644 --- a/Documentation/reference/os/arch.rst +++ b/Documentation/reference/os/arch.rst @@ -174,7 +174,7 @@ APIs Exported by Architecture-Specific Logic to NuttX and threads must have come from memory that is accessible to user -.. c:function:: void up_unblock_task(FAR struct tcb_s *tcb, FAR struct tcb_s *rtcb) +.. c:function:: void up_switch_context(FAR struct tcb_s *tcb, FAR struct tcb_s *rtcb) A task is currently in the ready-to-run list but has been preppe to execute. Restore its context, and start execution. @@ -186,18 +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_block_task(FAR struct tcb_s *rtcb) - - The currently executing task has already removed from ready-to-run list. - Save its context and switch to the next running task at the head of the - ready-to-run list. - - This function is called only from the NuttX scheduling logic. - Interrupts will always be disabled when this function is called. - - :param rtcb: Reference to the running task which is different to the - task (next running task) at the head of the list. - .. c:function:: void up_release_pending(void) When tasks become ready-to-run but cannot run diff --git a/arch/arm/src/common/Make.defs b/arch/arm/src/common/Make.defs index c20e7a137e4..b0c1ffbc5dd 100644 --- a/arch/arm/src/common/Make.defs +++ b/arch/arm/src/common/Make.defs @@ -20,14 +20,14 @@ # Common ARM files -CMN_CSRCS += arm_allocateheap.c arm_assert.c arm_blocktask.c +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_releasestack.c arm_saveusercontext.c CMN_CSRCS += arm_stackframe.c -CMN_CSRCS += arm_vfork.c arm_unblocktask.c arm_usestack.c +CMN_CSRCS += arm_vfork.c arm_switchcontext.c arm_usestack.c ifneq ($(CONFIG_ALARM_ARCH),y) ifneq ($(CONFIG_TIMER_ARCH),y) diff --git a/arch/arm/src/common/arm_blocktask.c b/arch/arm/src/common/arm_blocktask.c deleted file mode 100644 index 1db14cb6d85..00000000000 --- a/arch/arm/src/common/arm_blocktask.c +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************************** - * arch/arm/src/common/arm_blocktask.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 - -#include -#include -#include -#include - -#include -#include - -#include "sched/sched.h" -#include "group/group.h" -#include "arm_internal.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: up_block_task - * - * Description: - * The currently executing task has already removed from ready-to-run list. - * Save its context and switch to the next running task at the head of the - * ready-to-run list. - * - * Input Parameters: - * rtcb: Reference to the running task which is different to the - * task (next running task) at the head of the list. - * - ****************************************************************************/ - -void up_block_task(struct tcb_s *rtcb) -{ - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(rtcb); - - /* Are we in an interrupt handler? */ - - 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(); - - /* Reset 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(); - - /* Reset 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. - */ - } -} diff --git a/arch/arm/src/common/arm_unblocktask.c b/arch/arm/src/common/arm_switchcontext.c similarity index 96% rename from arch/arm/src/common/arm_unblocktask.c rename to arch/arm/src/common/arm_switchcontext.c index af53886a1aa..4104ae16f56 100644 --- a/arch/arm/src/common/arm_unblocktask.c +++ b/arch/arm/src/common/arm_switchcontext.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/common/arm_unblocktask.c + * arch/arm/src/common/arm_switchcontext.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -40,7 +40,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_unblock_task + * Name: up_switch_context * * Description: * A task is currently in the ready-to-run list but has been prepped @@ -53,7 +53,7 @@ * ****************************************************************************/ -void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb) +void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) { /* Update scheduler parameters */ diff --git a/arch/arm64/src/common/Make.defs b/arch/arm64/src/common/Make.defs index 3839593628f..1b137b0fb32 100644 --- a/arch/arm64/src/common/Make.defs +++ b/arch/arm64/src/common/Make.defs @@ -46,7 +46,7 @@ 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_unblocktask.c arm64_blocktask.c +CMN_CSRCS += arm64_releasepending.c arm64_switchcontext.c CMN_CSRCS += arm64_assert.c arm64_schedulesigaction.c arm64_backtrace.c CMN_CSRCS += arm64_sigdeliver.c diff --git a/arch/arm64/src/common/arm64_blocktask.c b/arch/arm64/src/common/arm64_blocktask.c deleted file mode 100644 index 85f9490760c..00000000000 --- a/arch/arm64/src/common/arm64_blocktask.c +++ /dev/null @@ -1,112 +0,0 @@ -/**************************************************************************** - * arch/arm64/src/common/arm64_blocktask.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 - -#include -#include -#include -#include - -#include -#include - -#include "sched/sched.h" -#include "group/group.h" -#include "arm64_internal.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: up_block_task - * - * Description: - * The currently executing task has already removed from ready-to-run list. - * Save its context and switch to the next running task at the head of the - * ready-to-run list. - * - * Input Parameters: - * rtcb: Reference to the running task which is different to the - * task (next running task) at the head of the list. - * - ****************************************************************************/ - -void up_block_task(struct tcb_s *rtcb) -{ - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(rtcb); - - /* Are we in an interrupt handler? */ - - 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(); - - /* Reset 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(); - - /* Reset 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. - */ - } -} diff --git a/arch/arm64/src/common/arm64_unblocktask.c b/arch/arm64/src/common/arm64_switchcontext.c similarity index 95% rename from arch/arm64/src/common/arm64_unblocktask.c rename to arch/arm64/src/common/arm64_switchcontext.c index c91eddfed3a..2d36fb7facc 100644 --- a/arch/arm64/src/common/arm64_unblocktask.c +++ b/arch/arm64/src/common/arm64_switchcontext.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm64/src/common/arm64_unblocktask.c + * arch/arm64/src/common/arm64_switchcontext.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -40,7 +40,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_unblock_task + * Name: up_switch_context * * Description: * A task is currently in the ready-to-run list but has been prepped @@ -53,7 +53,7 @@ * ****************************************************************************/ -void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb) +void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) { /* Update scheduler parameters */ diff --git a/arch/avr/src/at32uc3/Make.defs b/arch/avr/src/at32uc3/Make.defs index 111569f5c09..a8e7d484699 100644 --- a/arch/avr/src/at32uc3/Make.defs +++ b/arch/avr/src/at32uc3/Make.defs @@ -24,14 +24,14 @@ HEAD_ASRC = avr_nommuhead.S # Common AVR/AVR32 files -CMN_ASRCS = avr_exceptions.S avr_fullcontextrestore.S avr_switchcontext.S -CMN_CSRCS = avr_assert.c avr_allocateheap.c avr_blocktask.c avr_copystate.c +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_schedulesigaction.c avr_sigdeliver.c avr_stackframe.c -CMN_CSRCS += avr_unblocktask.c avr_usestack.c avr_doirq.c avr_nputs.c +CMN_CSRCS += avr_switchcontext.c avr_usestack.c avr_doirq.c avr_nputs.c # Configuration-dependent common files diff --git a/arch/avr/src/at90usb/Make.defs b/arch/avr/src/at90usb/Make.defs index 5045f3bb33e..41e4e1444d8 100644 --- a/arch/avr/src/at90usb/Make.defs +++ b/arch/avr/src/at90usb/Make.defs @@ -24,14 +24,14 @@ HEAD_ASRC = at90usb_head.S # Common AVR files -CMN_ASRCS = avr_switchcontext.S -CMN_CSRCS = avr_allocateheap.c avr_assert.c avr_blocktask.c avr_copystate.c +CMN_ASRCS = avr_doswitch.S +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_schedulesigaction.c avr_sigdeliver.c -CMN_CSRCS += avr_stackframe.c avr_udelay.c avr_unblocktask.c avr_usestack.c +CMN_CSRCS += avr_stackframe.c avr_udelay.c avr_switchcontext.c avr_usestack.c # Configuration-dependent common files diff --git a/arch/avr/src/atmega/Make.defs b/arch/avr/src/atmega/Make.defs index 35890bf7e45..c163df1c533 100644 --- a/arch/avr/src/atmega/Make.defs +++ b/arch/avr/src/atmega/Make.defs @@ -24,14 +24,14 @@ HEAD_ASRC = atmega_head.S # Common AVR files -CMN_ASRCS = avr_switchcontext.S -CMN_CSRCS = avr_allocateheap.c avr_assert.c avr_blocktask.c avr_copystate.c +CMN_ASRCS = avr_doswitch.S +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_schedulesigaction.c avr_sigdeliver.c -CMN_CSRCS += avr_stackframe.c avr_udelay.c avr_unblocktask.c avr_usestack.c +CMN_CSRCS += avr_stackframe.c avr_udelay.c avr_switchcontext.c avr_usestack.c # Configuration-dependent common files diff --git a/arch/avr/src/avr/avr_blocktask.c b/arch/avr/src/avr/avr_blocktask.c deleted file mode 100644 index 344b271ac85..00000000000 --- a/arch/avr/src/avr/avr_blocktask.c +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** - * arch/avr/src/avr/avr_blocktask.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 - -#include -#include -#include -#include - -#include -#include - -#include "sched/sched.h" -#include "avr_internal.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: up_block_task - * - * Description: - * The currently executing task has already removed from ready-to-run list. - * Save its context and switch to the next running task at the head of the - * ready-to-run list. - * - * Input Parameters: - * rtcb: Reference to the running task which is different to the - * task (next running task) at the head of the list. - * - ****************************************************************************/ - -void up_block_task(struct tcb_s *rtcb) -{ - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(rtcb); - - /* Are we in an interrupt handler? */ - - 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(); - - /* Reset 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(); - - /* Reset 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. - */ - } -} diff --git a/arch/avr/src/avr/avr_switchcontext.S b/arch/avr/src/avr/avr_doswitch.S similarity index 98% rename from arch/avr/src/avr/avr_switchcontext.S rename to arch/avr/src/avr/avr_doswitch.S index 61b26789e3b..d7f1e0e1711 100644 --- a/arch/avr/src/avr/avr_switchcontext.S +++ b/arch/avr/src/avr/avr_doswitch.S @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/avr/src/avr/avr_switchcontext.S + * arch/avr/src/avr/avr_doswitch.S * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -36,7 +36,7 @@ * Public Symbols ************************************************************************************/ - .file "avr_switchcontext.S" + .file "avr_doswitch.S" /************************************************************************************ * Macros diff --git a/arch/avr/src/avr/avr_unblocktask.c b/arch/avr/src/avr/avr_switchcontext.c similarity index 95% rename from arch/avr/src/avr/avr_unblocktask.c rename to arch/avr/src/avr/avr_switchcontext.c index 00ee9cc206d..263d5ce4cbd 100644 --- a/arch/avr/src/avr/avr_unblocktask.c +++ b/arch/avr/src/avr/avr_switchcontext.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/avr/src/avr/avr_unblocktask.c + * arch/avr/src/avr/avr_switchcontext.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -39,7 +39,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_unblock_task + * Name: up_switch_context * * Description: * A task is currently in the ready-to-run list but has been prepped @@ -52,7 +52,7 @@ * ****************************************************************************/ -void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb) +void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) { /* Update scheduler parameters */ diff --git a/arch/avr/src/avr/excptmacros.h b/arch/avr/src/avr/excptmacros.h index d301fbabc0b..457658bd2ba 100644 --- a/arch/avr/src/avr/excptmacros.h +++ b/arch/avr/src/avr/excptmacros.h @@ -546,7 +546,7 @@ * interrupt_enable - return sequence. * * NOTE: since actual returning is handled by this macro it has been - * removed from avr_fullcontextrestore function (avr_switchcontext.S) + * removed from avr_fullcontextrestore function (avr_doswitch.S) */ /* If interrupts shall be enabled go to 'restore remaining and reti' code diff --git a/arch/avr/src/avr32/avr_blocktask.c b/arch/avr/src/avr32/avr_blocktask.c deleted file mode 100644 index 8ce9585a680..00000000000 --- a/arch/avr/src/avr32/avr_blocktask.c +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************** - * arch/avr/src/avr32/avr_blocktask.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 - -#include -#include -#include -#include - -#include -#include - -#include "sched/sched.h" -#include "group/group.h" -#include "avr_internal.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: up_block_task - * - * Description: - * The currently executing task has already removed from ready-to-run list. - * Save its context and switch to the next running task at the head of the - * ready-to-run list. - * - * Input Parameters: - * rtcb: Reference to the running task which is different to the - * task (next running task) at the head of the list. - * - ****************************************************************************/ - -void up_block_task(struct tcb_s *rtcb) -{ - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(rtcb); - - /* Are we in an interrupt handler? */ - - 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(); - - /* Reset scheduler parameters */ - - nxsched_resume_scheduler(rtcb); - - /* Then switch contexts. Any new address environment needed by - * the new thread will be instantiated before the return from - * interrupt. - */ - - avr_restorestate(rtcb->xcp.regs); - } - - /* No, then we will need to perform the user context switch */ - - else - { - /* Get 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 - /* Reset scheduler parameters */ - - nxsched_resume_scheduler(nexttcb); - - /* Then switch contexts */ - - 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. - */ - } -} diff --git a/arch/avr/src/avr32/avr_switchcontext.S b/arch/avr/src/avr32/avr_doswitch.S similarity index 98% rename from arch/avr/src/avr32/avr_switchcontext.S rename to arch/avr/src/avr32/avr_doswitch.S index 4eb815c88aa..8faae9dacba 100644 --- a/arch/avr/src/avr32/avr_switchcontext.S +++ b/arch/avr/src/avr32/avr_doswitch.S @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/avr/src/avr32/avr_switchcontext.S + * arch/avr/src/avr32/avr_doswitch.S * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -34,7 +34,7 @@ * Public Symbols ************************************************************************************/ - .file "avr_switchcontext.S" + .file "avr_doswitch.S" /************************************************************************************ * Macros diff --git a/arch/avr/src/avr32/avr_unblocktask.c b/arch/avr/src/avr32/avr_switchcontext.c similarity index 96% rename from arch/avr/src/avr32/avr_unblocktask.c rename to arch/avr/src/avr32/avr_switchcontext.c index ed99d3dd5c3..cdd80ae3f39 100644 --- a/arch/avr/src/avr32/avr_unblocktask.c +++ b/arch/avr/src/avr32/avr_switchcontext.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/avr/src/avr32/avr_unblocktask.c + * arch/avr/src/avr32/avr_switchcontext.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -40,7 +40,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_unblock_task + * Name: up_switch_context * * Description: * A task is currently in the ready-to-run list but has been prepped @@ -53,7 +53,7 @@ * ****************************************************************************/ -void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb) +void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) { /* Update scheduler parameters */ diff --git a/arch/ceva/src/common/ceva_blocktask.c b/arch/ceva/src/common/ceva_blocktask.c deleted file mode 100644 index df80b01dded..00000000000 --- a/arch/ceva/src/common/ceva_blocktask.c +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************** - * arch/ceva/src/common/ceva_blocktask.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 -#include - -#include "sched/sched.h" -#include "ceva_internal.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: up_block_task - * - * Description: - * The currently executing task has already removed from ready-to-run list. - * Save its context and switch to the next running task at the head of the - * ready-to-run list. - * - * Inputs: - * rtcb: Reference to the running task which is different to the - * task (next running task) at the head of the list. - * - ****************************************************************************/ - -void up_block_task(struct tcb_s *rtcb) -{ - /* Update scheduler parameters */ - - sched_suspend_scheduler(rtcb); - - /* Are we in an interrupt handler? */ - - 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(); - - /* Reset 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(); - - /* Reset 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. - */ - } -} diff --git a/arch/ceva/src/common/ceva_switchcontext.c b/arch/ceva/src/common/ceva_switchcontext.c index d013cff3d42..981e520d01f 100644 --- a/arch/ceva/src/common/ceva_switchcontext.c +++ b/arch/ceva/src/common/ceva_switchcontext.c @@ -22,8 +22,10 @@ * Included Files ****************************************************************************/ +#include #include +#include "sched/sched.h" #include "ceva_internal.h" /**************************************************************************** @@ -50,3 +52,64 @@ void ceva_switchcontext(uint32_t **saveregs, uint32_t *restoreregs) sys_call2(SYS_switch_context, (uintptr_t)saveregs, (uintptr_t)restoreregs); } + +/**************************************************************************** + * Name: up_switch_context + * + * Description: + * A task is currently in the ready-to-run list but has been prepped + * to execute. Restore its context, and start execution. + * + * Input Parameters: + * tcb: Refers to the head task of the ready-to-run list + * which will be executed. + * rtcb: Refers to the running task which will be blocked. + * + ****************************************************************************/ + +void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) +{ + /* Update scheduler parameters */ + + sched_suspend_scheduler(rtcb); + + /* Are we in an interrupt handler? */ + + 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; + + /* Update scheduler parameters */ + + sched_resume_scheduler(tcb); + + /* Then switch contexts */ + + CURRENT_REGS = tcb->xcp.regs; + } + + /* No, then we will need to perform the user context switch */ + + else + { + /* Update scheduler parameters */ + + sched_resume_scheduler(tcb); + + /* Switch context to the context of the task at the head of the + * ready to run list. + */ + + ceva_switchcontext(&rtcb->xcp.regs, tcb->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. + */ + } +} diff --git a/arch/ceva/src/common/ceva_unblocktask.c b/arch/ceva/src/common/ceva_unblocktask.c deleted file mode 100644 index 701f8b4f7fb..00000000000 --- a/arch/ceva/src/common/ceva_unblocktask.c +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** - * arch/ceva/src/common/ceva_unblocktask.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 - -#include -#include - -#include "sched/sched.h" -#include "ceva_internal.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: up_unblock_task - * - * Description: - * A task is currently in the ready-to-run list but has been prepped - * to execute. Restore its context, and start execution. - * - * Input Parameters: - * tcb: Refers to the head task of the ready-to-run list - * which will be executed. - * rtcb: Refers to the running task which will be blocked. - * - ****************************************************************************/ - -void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb) -{ - /* Update scheduler parameters */ - - sched_suspend_scheduler(rtcb); - - /* Are we in an interrupt handler? */ - - 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; - - /* Update scheduler parameters */ - - sched_resume_scheduler(tcb); - - /* Then switch contexts */ - - CURRENT_REGS = tcb->xcp.regs; - } - - /* No, then we will need to perform the user context switch */ - - else - { - /* Update scheduler parameters */ - - sched_resume_scheduler(tcb); - - /* Switch context to the context of the task at the head of the - * ready to run list. - */ - - ceva_switchcontext(&rtcb->xcp.regs, tcb->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. - */ - } -} diff --git a/arch/hc/src/common/hc_blocktask.c b/arch/hc/src/common/hc_blocktask.c deleted file mode 100644 index 75859f229a9..00000000000 --- a/arch/hc/src/common/hc_blocktask.c +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************** - * arch/hc/src/common/hc_blocktask.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 - -#include -#include -#include -#include - -#include -#include - -#include "sched/sched.h" -#include "group/group.h" -#include "hc_internal.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: up_block_task - * - * Description: - * The currently executing task has already removed from ready-to-run list. - * Save its context and switch to the next running task at the head of the - * ready-to-run list. - * - * Input Parameters: - * rtcb: Reference to the running task which is different to the - * task (next running task) at the head of the list. - * - ****************************************************************************/ - -void up_block_task(struct tcb_s *rtcb) -{ - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(rtcb); - - /* Are we in an interrupt handler? */ - - 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(); - - /* Reset 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 user C context into the TCB at the (old) head of the - * ready-to-run Task list. 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 - /* Reset scheduler parameters */ - - nxsched_resume_scheduler(rtcb); - - /* Then switch contexts */ - - hc_fullcontextrestore(rtcb->xcp.regs); - } -} diff --git a/arch/hc/src/common/hc_unblocktask.c b/arch/hc/src/common/hc_switchcontext.c similarity index 96% rename from arch/hc/src/common/hc_unblocktask.c rename to arch/hc/src/common/hc_switchcontext.c index 075c68b8f64..1005924e660 100644 --- a/arch/hc/src/common/hc_unblocktask.c +++ b/arch/hc/src/common/hc_switchcontext.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/hc/src/common/hc_unblocktask.c + * arch/hc/src/common/hc_switchcontext.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -40,7 +40,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_unblock_task + * Name: up_switch_context * * Description: * A task is currently in the ready-to-run list but has been prepped @@ -53,7 +53,7 @@ * ****************************************************************************/ -void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb) +void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) { /* Update scheduler parameters */ diff --git a/arch/hc/src/m9s12/Make.defs b/arch/hc/src/m9s12/Make.defs index 30de67436d4..1e322d41e92 100644 --- a/arch/hc/src/m9s12/Make.defs +++ b/arch/hc/src/m9s12/Make.defs @@ -20,11 +20,11 @@ HEAD_ASRC = m9s12_vectors.S -CMN_CSRCS = hc_allocateheap.c hc_blocktask.c hc_copystate.c hc_createstack.c +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_stackframe.c hc_udelay.c hc_unblocktask.c hc_usestack.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 CHIP_CSRCS = m9s12_assert.c m9s12_gpio.c m9s12_gpioirq.c m9s12_initialstate.c diff --git a/arch/mips/src/mips32/mips_blocktask.c b/arch/mips/src/mips32/mips_blocktask.c deleted file mode 100644 index 1e2c2d7ece8..00000000000 --- a/arch/mips/src/mips32/mips_blocktask.c +++ /dev/null @@ -1,115 +0,0 @@ -/**************************************************************************** - * arch/mips/src/mips32/mips_blocktask.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 - -#include -#include -#include -#include -#include - -#include -#include - -#include "sched/sched.h" -#include "group/group.h" -#include "mips_internal.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: up_block_task - * - * Description: - * The currently executing task has already removed from ready-to-run list. - * Save its context and switch to the next running task at the head of the - * ready-to-run list. - * - * Input Parameters: - * rtcb: Reference to the running task which is different to the - * task (next running task) at the head of the list. - * - ****************************************************************************/ - -void up_block_task(struct tcb_s *rtcb) -{ - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(rtcb); - - /* Are we in an interrupt handler? */ - - 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(); - - /* Reset 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 - { - /* Get the context of the task at the head of the ready to - * run list. - */ - - struct tcb_s *nexttcb = this_task(); - - /* Reset 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. - */ - } -} diff --git a/arch/mips/src/mips32/mips_unblocktask.c b/arch/mips/src/mips32/mips_switchcontext.c similarity index 95% rename from arch/mips/src/mips32/mips_unblocktask.c rename to arch/mips/src/mips32/mips_switchcontext.c index 2bd58b6429b..dc7121748cb 100644 --- a/arch/mips/src/mips32/mips_unblocktask.c +++ b/arch/mips/src/mips32/mips_switchcontext.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/mips/src/mips32/mips_unblocktask.c + * arch/mips/src/mips32/mips_switchcontext.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -42,7 +42,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_unblock_task + * Name: up_switch_context * * Description: * A task is currently in the ready-to-run list but has been prepped @@ -55,7 +55,7 @@ * ****************************************************************************/ -void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb) +void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) { /* Update scheduler parameters */ diff --git a/arch/mips/src/pic32mx/Make.defs b/arch/mips/src/pic32mx/Make.defs index ce134defa13..82023f6ef36 100644 --- a/arch/mips/src/pic32mx/Make.defs +++ b/arch/mips/src/pic32mx/Make.defs @@ -25,13 +25,13 @@ HEAD_ASRC = pic32mx_head.S # Common MIPS files CMN_ASRCS = mips_syscall0.S vfork.S -CMN_CSRCS = mips_allocateheap.c mips_assert.c mips_blocktask.c mips_copystate.c +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_schedulesigaction.c mips_sigdeliver.c -CMN_CSRCS += mips_stackframe.c mips_swint0.c mips_udelay.c mips_unblocktask.c +CMN_CSRCS += mips_stackframe.c mips_swint0.c mips_udelay.c mips_switchcontext.c CMN_CSRCS += mips_usestack.c mips_vfork.c # Configuration dependent common files diff --git a/arch/mips/src/pic32mz/Make.defs b/arch/mips/src/pic32mz/Make.defs index f0f54f77f81..9479b2f58b4 100644 --- a/arch/mips/src/pic32mz/Make.defs +++ b/arch/mips/src/pic32mz/Make.defs @@ -25,13 +25,13 @@ HEAD_ASRC = pic32mz_head.S # Common MIPS files CMN_ASRCS = mips_syscall0.S vfork.S mips_cache.S -CMN_CSRCS = mips_allocateheap.c mips_assert.c mips_blocktask.c mips_copystate.c +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_schedulesigaction.c mips_sigdeliver.c -CMN_CSRCS += mips_stackframe.c mips_swint0.c mips_udelay.c mips_unblocktask.c +CMN_CSRCS += mips_stackframe.c mips_swint0.c mips_udelay.c mips_switchcontext.c CMN_CSRCS += mips_usestack.c mips_vfork.c # Configuration dependent common files diff --git a/arch/misoc/src/lm32/Make.defs b/arch/misoc/src/lm32/Make.defs index 337a6a0f18c..278187830bf 100644 --- a/arch/misoc/src/lm32/Make.defs +++ b/arch/misoc/src/lm32/Make.defs @@ -27,11 +27,11 @@ CMN_CSRCS += misoc_timerisr.c misoc_net.c misoc_flushcache.c CHIP_ASRCS = lm32_syscall.S -CHIP_CSRCS = lm32_allocateheap.c lm32_assert.c lm32_blocktask.c +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_releasestack.c lm32_stackframe.c lm32_swint.c -CHIP_CSRCS += lm32_unblocktask.c +CHIP_CSRCS += lm32_switchcontext.c CHIP_CSRCS += lm32_schedulesigaction.c lm32_sigdeliver.c CHIP_CSRCS += lm32_flushcache.c lm32_usetack.c diff --git a/arch/misoc/src/lm32/lm32_blocktask.c b/arch/misoc/src/lm32/lm32_blocktask.c deleted file mode 100644 index 624617473d3..00000000000 --- a/arch/misoc/src/lm32/lm32_blocktask.c +++ /dev/null @@ -1,115 +0,0 @@ -/**************************************************************************** - * arch/misoc/src/lm32/lm32_blocktask.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 - -#include -#include -#include -#include -#include - -#include -#include - -#include "sched/sched.h" -#include "group/group.h" -#include "lm32.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: up_block_task - * - * Description: - * The currently executing task has already removed from ready-to-run list. - * Save its context and switch to the next running task at the head of the - * ready-to-run list. - * - * Input Parameters: - * rtcb: Reference to the running task which is different to the - * task (next running task) at the head of the list. - * - ****************************************************************************/ - -void up_block_task(struct tcb_s *rtcb) -{ - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(rtcb); - - /* Are we in an interrupt handler? */ - - 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(); - - /* Reset 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 - { - /* Get the context of the task at the head of the ready to - * run list. - */ - - struct tcb_s *nexttcb = this_task(); - - /* Reset 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. - */ - } -} diff --git a/arch/misoc/src/lm32/lm32_unblocktask.c b/arch/misoc/src/lm32/lm32_switchcontext.c similarity index 95% rename from arch/misoc/src/lm32/lm32_unblocktask.c rename to arch/misoc/src/lm32/lm32_switchcontext.c index e2f4c9aa277..a37cff9d9df 100644 --- a/arch/misoc/src/lm32/lm32_unblocktask.c +++ b/arch/misoc/src/lm32/lm32_switchcontext.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/misoc/src/lm32/lm32_unblocktask.c + * arch/misoc/src/lm32/lm32_switchcontext.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -42,7 +42,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_unblock_task + * Name: up_switch_context * * Description: * A task is currently in the ready-to-run list but has been prepped @@ -55,7 +55,7 @@ * ****************************************************************************/ -void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb) +void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) { /* Update scheduler parameters */ diff --git a/arch/misoc/src/minerva/Make.defs b/arch/misoc/src/minerva/Make.defs index 52ce077a35a..1603b1e90e9 100644 --- a/arch/misoc/src/minerva/Make.defs +++ b/arch/misoc/src/minerva/Make.defs @@ -27,11 +27,11 @@ CMN_CSRCS += misoc_timerisr.c misoc_net.c misoc_flushcache.c CHIP_ASRCS = minerva_syscall.S -CHIP_CSRCS = minerva_allocateheap.c minerva_assert.c minerva_blocktask.c +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_releasestack.c minerva_stackframe.c minerva_swint.c -CHIP_CSRCS += minerva_unblocktask.c +CHIP_CSRCS += minerva_switchcontext.c CHIP_CSRCS += minerva_schedulesigaction.c minerva_sigdeliver.c CHIP_CSRCS += minerva_flushcache.c minerva_doexceptions.c minerva_usetack.c diff --git a/arch/misoc/src/minerva/minerva_blocktask.c b/arch/misoc/src/minerva/minerva_blocktask.c deleted file mode 100644 index 9627a9ea20d..00000000000 --- a/arch/misoc/src/minerva/minerva_blocktask.c +++ /dev/null @@ -1,115 +0,0 @@ -/**************************************************************************** - * arch/misoc/src/minerva/minerva_blocktask.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 - -#include -#include -#include -#include -#include - -#include -#include - -#include "sched/sched.h" -#include "group/group.h" -#include "minerva.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: up_block_task - * - * Description: - * The currently executing task has already removed from ready-to-run list. - * Save its context and switch to the next running task at the head of the - * ready-to-run list. - * - * Input Parameters: - * rtcb: Reference to the running task which is different to the - * task (next running task) at the head of the list. - * - ****************************************************************************/ - -void up_block_task(struct tcb_s *rtcb) -{ - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(rtcb); - - /* Are we in an interrupt handler? */ - - 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(); - - /* Reset 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 - { - /* Get the context of the task at the head of the ready to run - * list. - */ - - struct tcb_s *nexttcb = this_task(); - - /* Reset 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. - */ - } -} diff --git a/arch/misoc/src/minerva/minerva_unblocktask.c b/arch/misoc/src/minerva/minerva_switchcontext.c similarity index 95% rename from arch/misoc/src/minerva/minerva_unblocktask.c rename to arch/misoc/src/minerva/minerva_switchcontext.c index 91a719369f6..29329e806e1 100644 --- a/arch/misoc/src/minerva/minerva_unblocktask.c +++ b/arch/misoc/src/minerva/minerva_switchcontext.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/misoc/src/minerva/minerva_unblocktask.c + * arch/misoc/src/minerva/minerva_switchcontext.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -42,7 +42,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_unblock_task + * Name: up_switch_context * * Description: * A task is currently in the ready-to-run list but has been prepped @@ -55,7 +55,7 @@ * ****************************************************************************/ -void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb) +void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) { /* Update scheduler parameters */ diff --git a/arch/or1k/src/common/or1k_blocktask.c b/arch/or1k/src/common/or1k_blocktask.c deleted file mode 100644 index 6775b2cb869..00000000000 --- a/arch/or1k/src/common/or1k_blocktask.c +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************** - * arch/or1k/src/common/or1k_blocktask.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 - -#include -#include -#include -#include - -#include -#include - -#include "sched/sched.h" -#include "group/group.h" -#include "or1k_internal.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: up_block_task - * - * Description: - * The currently executing task has already removed from ready-to-run list. - * Save its context and switch to the next running task at the head of the - * ready-to-run list. - * - * Input Parameters: - * rtcb: Reference to the running task which is different to the - * task (next running task) at the head of the list. - * - ****************************************************************************/ - -void up_block_task(struct tcb_s *rtcb) -{ - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(rtcb); - - /* Are we in an interrupt handler? */ - - 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(); - - /* Reset 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 user C context into the TCB at the (old) head of the - * ready-to-run Task list. 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 - /* Reset scheduler parameters */ - - nxsched_resume_scheduler(rtcb); - - /* Then switch contexts */ - - or1k_fullcontextrestore(rtcb->xcp.regs); - } -} diff --git a/arch/or1k/src/common/or1k_unblocktask.c b/arch/or1k/src/common/or1k_switchcontext.c similarity index 96% rename from arch/or1k/src/common/or1k_unblocktask.c rename to arch/or1k/src/common/or1k_switchcontext.c index eefa03d1ea0..174aee24fbd 100644 --- a/arch/or1k/src/common/or1k_unblocktask.c +++ b/arch/or1k/src/common/or1k_switchcontext.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/or1k/src/common/or1k_unblocktask.c + * arch/or1k/src/common/or1k_switchcontext.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -40,7 +40,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_unblock_task + * Name: up_switch_context * * Description: * A task is currently in the ready-to-run list but has been prepped @@ -53,7 +53,7 @@ * ****************************************************************************/ -void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb) +void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) { /* Update scheduler parameters */ diff --git a/arch/or1k/src/mor1kx/Make.defs b/arch/or1k/src/mor1kx/Make.defs index 9474446386f..5558fc513eb 100644 --- a/arch/or1k/src/mor1kx/Make.defs +++ b/arch/or1k/src/mor1kx/Make.defs @@ -29,8 +29,7 @@ CMN_CSRCS = or1k_initialize.c \ or1k_releasestack.c \ or1k_stackframe.c \ or1k_initialstate.c \ - or1k_blocktask.c \ - or1k_unblocktask.c \ + or1k_switchcontext.c \ or1k_releasepending.c \ or1k_schedulesigaction.c \ or1k_copyfullstate.c \ diff --git a/arch/renesas/src/common/renesas_blocktask.c b/arch/renesas/src/common/renesas_blocktask.c deleted file mode 100644 index 01a3342f667..00000000000 --- a/arch/renesas/src/common/renesas_blocktask.c +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************** - * arch/renesas/src/common/renesas_blocktask.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 - -#include -#include -#include -#include -#include -#include - -#include "sched/sched.h" -#include "group/group.h" -#include "renesas_internal.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: up_block_task - * - * Description: - * The currently executing task has already removed from ready-to-run list. - * Save its context and switch to the next running task at the head of the - * ready-to-run list. - * - * Input Parameters: - * rtcb: Reference to the running task which is different to the - * task (next running task) at the head of the list. - * - ****************************************************************************/ - -void up_block_task(struct tcb_s *rtcb) -{ - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(rtcb); - - /* Are we in an interrupt handler? */ - - 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(); - - /* Reset 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 user C context into the TCB at the (old) head of the - * ready-to-run Task list. 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 - /* Reset scheduler parameters */ - - nxsched_resume_scheduler(rtcb); - - /* Then switch contexts */ - - renesas_fullcontextrestore(rtcb->xcp.regs); - } -} diff --git a/arch/renesas/src/common/renesas_unblocktask.c b/arch/renesas/src/common/renesas_switchcontext.c similarity index 96% rename from arch/renesas/src/common/renesas_unblocktask.c rename to arch/renesas/src/common/renesas_switchcontext.c index c86a26aeb8d..3cea2e64bce 100644 --- a/arch/renesas/src/common/renesas_unblocktask.c +++ b/arch/renesas/src/common/renesas_switchcontext.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/renesas/src/common/renesas_unblocktask.c + * arch/renesas/src/common/renesas_switchcontext.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -40,7 +40,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_unblock_task + * Name: up_switch_context * * Description: * A task is currently in the ready-to-run list but has been prepped @@ -53,7 +53,7 @@ * ****************************************************************************/ -void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb) +void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) { /* Update scheduler parameters */ diff --git a/arch/renesas/src/m16c/Make.defs b/arch/renesas/src/m16c/Make.defs index 56835468e96..0ecbe779888 100644 --- a/arch/renesas/src/m16c/Make.defs +++ b/arch/renesas/src/m16c/Make.defs @@ -20,11 +20,11 @@ HEAD_ASRC = m16c_head.S -CMN_CSRCS = renesas_allocateheap.c renesas_assert.c renesas_blocktask.c +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_stackframe.c renesas_udelay.c renesas_unblocktask.c renesas_usestack.c +CMN_CSRCS += renesas_stackframe.c renesas_udelay.c renesas_switchcontext.c renesas_usestack.c CHIP_ASRCS = m16c_vectors.S CHIP_CSRCS = m16c_initialstate.c m16c_copystate.c m16c_lowputc.c m16c_irq.c diff --git a/arch/renesas/src/rx65n/Make.defs b/arch/renesas/src/rx65n/Make.defs index 8f41f3cb80b..8c9bbd8a686 100644 --- a/arch/renesas/src/rx65n/Make.defs +++ b/arch/renesas/src/rx65n/Make.defs @@ -20,11 +20,11 @@ HEAD_ASRC = rx65n_head.S -CMN_CSRCS = renesas_allocateheap.c renesas_assert.c renesas_blocktask.c +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_stackframe.c renesas_udelay.c renesas_unblocktask.c renesas_usestack.c +CMN_CSRCS += renesas_stackframe.c renesas_udelay.c renesas_switchcontext.c renesas_usestack.c CHIP_ASRCS = rx65n_vector.S CHIP_CSRCS = rx65n_lowputc.c rx65n_serial.c rx65n_copystate.c rx65n_irq.c diff --git a/arch/renesas/src/sh1/Make.defs b/arch/renesas/src/sh1/Make.defs index 0cc778a1d43..310fb8b0743 100644 --- a/arch/renesas/src/sh1/Make.defs +++ b/arch/renesas/src/sh1/Make.defs @@ -20,13 +20,13 @@ HEAD_ASRC = sh1_head.S -CMN_CSRCS = renesas_allocateheap.c renesas_assert.c renesas_blocktask.c +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_stackframe.c renesas_udelay.c CMN_CSRCS += sh1_schedulesigaction.c sh1_sigdeliver.c -CMN_CSRCS += renesas_unblocktask.c renesas_usestack.c +CMN_CSRCS += renesas_switchcontext.c renesas_usestack.c CHIP_ASRCS = sh1_vector.S sh1_saveusercontext.S CHIP_CSRCS = sh1_lowputc.c sh1_irq.c sh1_serial.c sh1_initialstate.c diff --git a/arch/risc-v/src/common/Make.defs b/arch/risc-v/src/common/Make.defs index bcfdb10da68..fd65ec824af 100644 --- a/arch/risc-v/src/common/Make.defs +++ b/arch/risc-v/src/common/Make.defs @@ -28,11 +28,11 @@ CMN_ASRCS += riscv_vectors.S riscv_exception_common.S riscv_mhartid.S # Specify C code within the common directory to be included 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_blocktask.c riscv_copystate.c riscv_initialstate.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_unblocktask.c riscv_usestack.c +CMN_CSRCS += riscv_sigdeliver.c riscv_switchcontext.c riscv_usestack.c CMN_CSRCS += riscv_idle.c riscv_tcbinfo.c riscv_cpuidlestack.c CMN_CSRCS += riscv_exception.c riscv_getnewintctx.c riscv_doirq.c CMN_CSRCS += riscv_saveusercontext.c diff --git a/arch/risc-v/src/common/riscv_blocktask.c b/arch/risc-v/src/common/riscv_blocktask.c deleted file mode 100644 index 94d3207a679..00000000000 --- a/arch/risc-v/src/common/riscv_blocktask.c +++ /dev/null @@ -1,115 +0,0 @@ -/**************************************************************************** - * arch/risc-v/src/common/riscv_blocktask.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 - -#include -#include -#include -#include -#include - -#include -#include - -#include "sched/sched.h" -#include "group/group.h" -#include "riscv_internal.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: up_block_task - * - * Description: - * The currently executing task has already removed from ready-to-run list. - * Save its context and switch to the next running task at the head of the - * ready-to-run list. - * - * Input Parameters: - * rtcb: Reference to the running task which is different to the - * task (next running task) at the head of the list. - * - ****************************************************************************/ - -void up_block_task(struct tcb_s *rtcb) -{ - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(rtcb); - - /* Are we in an interrupt handler? */ - - 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(); - - /* Reset 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 - { - /* Get the context of the task at the head of the ready to - * run list. - */ - - struct tcb_s *nexttcb = this_task(); - - /* Reset 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. - */ - } -} diff --git a/arch/risc-v/src/common/riscv_unblocktask.c b/arch/risc-v/src/common/riscv_switchcontext.c similarity index 95% rename from arch/risc-v/src/common/riscv_unblocktask.c rename to arch/risc-v/src/common/riscv_switchcontext.c index e77b2375856..30ea84a00f6 100644 --- a/arch/risc-v/src/common/riscv_unblocktask.c +++ b/arch/risc-v/src/common/riscv_switchcontext.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/risc-v/src/common/riscv_unblocktask.c + * arch/risc-v/src/common/riscv_switchcontext.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -42,7 +42,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_unblock_task + * Name: up_switch_context * * Description: * A task is currently in the ready-to-run list but has been prepped @@ -55,7 +55,7 @@ * ****************************************************************************/ -void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb) +void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) { /* Update scheduler parameters */ diff --git a/arch/sim/src/Makefile b/arch/sim/src/Makefile index f0b17f4406a..dc37e28d54d 100644 --- a/arch/sim/src/Makefile +++ b/arch/sim/src/Makefile @@ -59,7 +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_unblocktask.c sim_blocktask.c sim_releasepending.c +CSRCS += sim_switchcontext.c sim_releasepending.c CSRCS += sim_exit.c sim_schedulesigaction.c CSRCS += sim_heap.c sim_uart.c sim_assert.c sim_nputs.c CSRCS += sim_copyfullstate.c diff --git a/arch/sim/src/sim/sim_blocktask.c b/arch/sim/src/sim/sim_blocktask.c deleted file mode 100644 index 9a65db43eea..00000000000 --- a/arch/sim/src/sim/sim_blocktask.c +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** - * arch/sim/src/sim/sim_blocktask.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 - -#include -#include -#include -#include - -#include -#include - -#include "sched/sched.h" -#include "sim_internal.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: up_block_task - * - * Description: - * The currently executing task has already removed from ready-to-run list. - * Save its context and switch to the next running task at the head of the - * ready-to-run list. - * - * Input Parameters: - * rtcb: Reference to the running task which is different to the - * task (next running task) at the head of the list. - * - ****************************************************************************/ - -void up_block_task(struct tcb_s *rtcb) -{ - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(rtcb); - - /* TODO */ - - if (CURRENT_REGS) - { - ASSERT(false); - } - - /* Copy the exception context into the TCB at the (old) head of the - * ready-to-run Task list. 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); - - /* Reset 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(); - } -} diff --git a/arch/sim/src/sim/sim_unblocktask.c b/arch/sim/src/sim/sim_switchcontext.c similarity index 96% rename from arch/sim/src/sim/sim_unblocktask.c rename to arch/sim/src/sim/sim_switchcontext.c index c372f87b690..a3dee9c9379 100644 --- a/arch/sim/src/sim/sim_unblocktask.c +++ b/arch/sim/src/sim/sim_switchcontext.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/sim/src/sim/sim_unblocktask.c + * arch/sim/src/sim/sim_switchcontext.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -39,7 +39,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_unblock_task + * Name: up_switch_context * * Description: * A task is currently in the ready-to-run list but has been prepped @@ -52,7 +52,7 @@ * ****************************************************************************/ -void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb) +void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) { sinfo("Unblocking TCB=%p\n", tcb); diff --git a/arch/sparc/src/sparc_v8/Make.defs b/arch/sparc/src/sparc_v8/Make.defs index a76b7c66d5c..d72eb04e74a 100644 --- a/arch/sparc/src/sparc_v8/Make.defs +++ b/arch/sparc/src/sparc_v8/Make.defs @@ -23,11 +23,11 @@ include common/Make.defs CMN_ASRCS += sparc_v8_syscall.S -CMN_CSRCS += sparc_v8_blocktask.c sparc_v8_copystate.c sparc_v8_doirq.c +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_sigdeliver.c sparc_v8_swint1.c sparc_v8_systemreset.c -CMN_CSRCS += sparc_v8_unblocktask.c +CMN_CSRCS += sparc_v8_switchcontext.c # Configuration-dependent common files diff --git a/arch/sparc/src/sparc_v8/sparc_v8_blocktask.c b/arch/sparc/src/sparc_v8/sparc_v8_blocktask.c deleted file mode 100644 index 833ba8f669d..00000000000 --- a/arch/sparc/src/sparc_v8/sparc_v8_blocktask.c +++ /dev/null @@ -1,115 +0,0 @@ -/**************************************************************************** - * arch/sparc/src/sparc_v8/sparc_v8_blocktask.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 - -#include -#include -#include -#include -#include - -#include -#include - -#include "sched/sched.h" -#include "group/group.h" -#include "sparc_internal.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: up_block_task - * - * Description: - * The currently executing task has already removed from ready-to-run list. - * Save its context and switch to the next running task at the head of the - * ready-to-run list. - * - * Input Parameters: - * rtcb: Reference to the running task which is different to the - * task (next running task) at the head of the list. - * - ****************************************************************************/ - -void up_block_task(struct tcb_s *rtcb) -{ - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(rtcb); - - /* Are we in an interrupt handler? */ - - 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(); - - /* Reset scheduler parameters */ - - nxsched_resume_scheduler(rtcb); - - /* Then switch contexts. Any necessary address environment - * changes will be made when the interrupt returns. - */ - - sparc_restorestate(rtcb->xcp.regs); - } - - /* No, then we will need to perform the user context switch */ - - else - { - /* Get the context of the task at the head of the ready to - * run list. - */ - - struct tcb_s *nexttcb = this_task(); - - /* Reset scheduler parameters */ - - nxsched_resume_scheduler(nexttcb); - - /* Then switch contexts */ - - 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. - */ - } -} diff --git a/arch/sparc/src/sparc_v8/sparc_v8_unblocktask.c b/arch/sparc/src/sparc_v8/sparc_v8_switchcontext.c similarity index 95% rename from arch/sparc/src/sparc_v8/sparc_v8_unblocktask.c rename to arch/sparc/src/sparc_v8/sparc_v8_switchcontext.c index 52496252e98..040a9964024 100644 --- a/arch/sparc/src/sparc_v8/sparc_v8_unblocktask.c +++ b/arch/sparc/src/sparc_v8/sparc_v8_switchcontext.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/sparc/src/sparc_v8/sparc_v8_unblocktask.c + * arch/sparc/src/sparc_v8/sparc_v8_switchcontext.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -42,7 +42,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_unblock_task + * Name: up_switch_context * * Description: * A task is currently in the ready-to-run list but has been prepped @@ -55,7 +55,7 @@ * ****************************************************************************/ -void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb) +void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) { /* Update scheduler parameters */ diff --git a/arch/x86/src/common/x86_blocktask.c b/arch/x86/src/common/x86_blocktask.c deleted file mode 100644 index b191a1ea3b3..00000000000 --- a/arch/x86/src/common/x86_blocktask.c +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************** - * arch/x86/src/common/x86_blocktask.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 - -#include -#include -#include -#include - -#include -#include - -#include "sched/sched.h" -#include "group/group.h" -#include "x86_internal.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: up_block_task - * - * Description: - * The currently executing task has already removed from ready-to-run list. - * Save its context and switch to the next running task at the head of the - * ready-to-run list. - * - * Input Parameters: - * rtcb: Reference to the running task which is different to the - * task (next running task) at the head of the list. - * - ****************************************************************************/ - -void up_block_task(struct tcb_s *rtcb) -{ - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(rtcb); - - /* Are we in an interrupt handler? */ - - 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(); - - /* Reset 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 user C context into the TCB at the (old) head of the - * ready-to-run Task list. 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 - /* Reset scheduler parameters */ - - nxsched_resume_scheduler(rtcb); - - /* Then switch contexts */ - - x86_fullcontextrestore(rtcb->xcp.regs); - } -} diff --git a/arch/x86/src/common/x86_unblocktask.c b/arch/x86/src/common/x86_switchcontext.c similarity index 96% rename from arch/x86/src/common/x86_unblocktask.c rename to arch/x86/src/common/x86_switchcontext.c index 31be5813923..d13919932aa 100644 --- a/arch/x86/src/common/x86_unblocktask.c +++ b/arch/x86/src/common/x86_switchcontext.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/x86/src/common/x86_unblocktask.c + * arch/x86/src/common/x86_switchcontext.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -40,7 +40,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_unblock_task + * Name: up_switch_context * * Description: * A task is currently in the ready-to-run list but has been prepped @@ -53,7 +53,7 @@ * ****************************************************************************/ -void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb) +void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) { /* Update scheduler parameters */ diff --git a/arch/x86/src/qemu/Make.defs b/arch/x86/src/qemu/Make.defs index 30d4b2ca8bb..45b8ce14325 100644 --- a/arch/x86/src/qemu/Make.defs +++ b/arch/x86/src/qemu/Make.defs @@ -27,10 +27,10 @@ HEAD_ASRC = qemu_head.S CMN_ASRCS = i486_utils.S i486_syscall6.S CMN_CSRCS += i486_createstack.c i486_initialstate.c -CMN_CSRCS += x86_allocateheap.c x86_assert.c x86_blocktask.c x86_copystate.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_unblocktask.c +CMN_CSRCS += x86_nputs.c x86_releasepending.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 diff --git a/arch/x86_64/src/common/x86_64_blocktask.c b/arch/x86_64/src/common/x86_64_blocktask.c deleted file mode 100644 index 60468e77d91..00000000000 --- a/arch/x86_64/src/common/x86_64_blocktask.c +++ /dev/null @@ -1,122 +0,0 @@ -/**************************************************************************** - * arch/x86_64/src/common/x86_64_blocktask.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 - -#include -#include -#include -#include - -#include -#include - -#include "sched/sched.h" -#include "group/group.h" -#include "x86_64_internal.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: up_block_task - * - * Description: - * The currently executing task has already removed from ready-to-run list. - * Save its context and switch to the next running task at the head of the - * ready-to-run list. - * - * Input Parameters: - * rtcb: Reference to the running task which is different to the - * task (next running task) at the head of the list. - * - ****************************************************************************/ - -void up_block_task(struct tcb_s *rtcb) -{ - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(rtcb); - - /* Are we in an interrupt handler? */ - - 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); - - /* Reset 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 user C context into the TCB at the (old) head of the - * ready-to-run Task list. 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 - /* Reset scheduler parameters */ - - nxsched_resume_scheduler(rtcb); - - /* Then switch contexts */ - - x86_64_fullcontextrestore(rtcb->xcp.regs); - } -} diff --git a/arch/x86_64/src/common/x86_64_unblocktask.c b/arch/x86_64/src/common/x86_64_switchcontext.c similarity index 96% rename from arch/x86_64/src/common/x86_64_unblocktask.c rename to arch/x86_64/src/common/x86_64_switchcontext.c index 498edb7f304..2231fc1082e 100644 --- a/arch/x86_64/src/common/x86_64_unblocktask.c +++ b/arch/x86_64/src/common/x86_64_switchcontext.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/x86_64/src/common/x86_64_unblocktask.c + * arch/x86_64/src/common/x86_64_switchcontext.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -42,7 +42,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_unblock_task + * Name: up_switch_context * * Description: * A task is currently in the ready-to-run list but has been prepped @@ -55,7 +55,7 @@ * ****************************************************************************/ -void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb) +void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) { /* Update scheduler parameters */ diff --git a/arch/x86_64/src/intel64/Make.defs b/arch/x86_64/src/intel64/Make.defs index 83c7a211735..1df40c2f267 100644 --- a/arch/x86_64/src/intel64/Make.defs +++ b/arch/x86_64/src/intel64/Make.defs @@ -20,10 +20,10 @@ # Common x86_64 and intel64 files -CMN_CSRCS += x86_64_allocateheap.c x86_64_assert.c x86_64_blocktask.c x86_64_copystate.c +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_unblocktask.c +CMN_CSRCS += x86_64_releasepending.c 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 diff --git a/arch/xtensa/src/common/Make.defs b/arch/xtensa/src/common/Make.defs index 00a67d8dad2..afc7e3fab31 100644 --- a/arch/xtensa/src/common/Make.defs +++ b/arch/xtensa/src/common/Make.defs @@ -27,7 +27,7 @@ HEAD_ASRC += xtensa_int_handlers.S xtensa_user_handler.S CMN_ASRCS = xtensa_context.S xtensa_cpuint.S xtensa_panic.S -CMN_CSRCS = xtensa_assert.c xtensa_blocktask.c +CMN_CSRCS = xtensa_assert.c 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 @@ -35,7 +35,7 @@ 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_schedsigaction.c CMN_CSRCS += xtensa_sigdeliver.c xtensa_stackframe.c xtensa_udelay.c -CMN_CSRCS += xtensa_unblocktask.c xtensa_usestack.c xtensa_swint.c +CMN_CSRCS += xtensa_switchcontext.c xtensa_usestack.c xtensa_swint.c CMN_CSRCS += xtensa_saveusercontext.c # Configuration-dependent common Xtensa files diff --git a/arch/xtensa/src/common/xtensa_blocktask.c b/arch/xtensa/src/common/xtensa_blocktask.c deleted file mode 100644 index 4c75cf099d4..00000000000 --- a/arch/xtensa/src/common/xtensa_blocktask.c +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** - * arch/xtensa/src/common/xtensa_blocktask.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 - -#include -#include -#include -#include - -#include -#include -#include - -#include "sched/sched.h" -#include "group/group.h" -#include "xtensa.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: up_block_task - * - * Description: - * The currently executing task has already removed from ready-to-run list. - * Save its context and switch to the next running task at the head of the - * ready-to-run list. - * - * Input Parameters: - * rtcb: Reference to the running task which is different to the - * task (next running task) at the head of the list. - * - ****************************************************************************/ - -void up_block_task(struct tcb_s *rtcb) -{ - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(rtcb); - - /* Are we in an interrupt handler? */ - - 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(); - - /* Reset 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(); - - /* Switch context to the context of the task at the head of the - * ready to run list. - */ - - nxsched_resume_scheduler(nexttcb); - - /* Then switch contexts */ - - 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. - */ - } -} diff --git a/arch/xtensa/src/common/xtensa_unblocktask.c b/arch/xtensa/src/common/xtensa_switchcontext.c similarity index 95% rename from arch/xtensa/src/common/xtensa_unblocktask.c rename to arch/xtensa/src/common/xtensa_switchcontext.c index 5f453cedb43..eb6b49d6037 100644 --- a/arch/xtensa/src/common/xtensa_unblocktask.c +++ b/arch/xtensa/src/common/xtensa_switchcontext.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/xtensa/src/common/xtensa_unblocktask.c + * arch/xtensa/src/common/xtensa_switchcontext.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -42,7 +42,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_unblock_task + * Name: up_switch_context * * Description: * A task is currently in the ready-to-run list but has been prepped @@ -55,7 +55,7 @@ * ****************************************************************************/ -void up_unblock_task(struct tcb_s *tcb, struct tcb_s *rtcb) +void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) { /* Update scheduler parameters */ diff --git a/arch/z16/src/common/z16_blocktask.c b/arch/z16/src/common/z16_blocktask.c deleted file mode 100644 index b6d593b5ce1..00000000000 --- a/arch/z16/src/common/z16_blocktask.c +++ /dev/null @@ -1,110 +0,0 @@ -/**************************************************************************** - * arch/z16/src/common/z16_blocktask.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 - -#include -#include -#include -#include - -#include -#include - -#include "sched/sched.h" -#include "z16_internal.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: up_block_task - * - * Description: - * The currently executing task has already removed from ready-to-run list. - * Save its context and switch to the next running task at the head of the - * ready-to-run list. - * - * Input Parameters: - * rtcb: Reference to the running task which is different to the - * task (next running task) at the head of the list. - * - ****************************************************************************/ - -void up_block_task(FAR struct tcb_s *rtcb) -{ - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(rtcb); - - /* Are we in an interrupt handler? */ - - if (IN_INTERRUPT) - { - /* Yes, then we have to do things differently. - * Just copy the current registers 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(); - - /* Reset 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 user C context into the TCB at the (old) head of the - * ready-to-run Task list. 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(); - - /* Reset scheduler parameters */ - - nxsched_resume_scheduler(rtcb); - - /* Then switch contexts */ - - RESTORE_USERCONTEXT(rtcb); - } -} diff --git a/arch/z16/src/common/z16_unblocktask.c b/arch/z16/src/common/z16_switchcontext.c similarity index 95% rename from arch/z16/src/common/z16_unblocktask.c rename to arch/z16/src/common/z16_switchcontext.c index b24d8c414c6..f076ba37011 100644 --- a/arch/z16/src/common/z16_unblocktask.c +++ b/arch/z16/src/common/z16_switchcontext.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/z16/src/common/z16_unblocktask.c + * arch/z16/src/common/z16_switchcontext.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -41,7 +41,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_unblock_task + * Name: up_switch_context * * Description: * A task is currently in the ready-to-run list but has been prepped @@ -54,7 +54,7 @@ * ****************************************************************************/ -void up_unblock_task(FAR struct tcb_s *tcb, FAR struct tcb_s *rtcb) +void up_switch_context(FAR struct tcb_s *tcb, FAR struct tcb_s *rtcb) { /* Update scheduler parameters */ diff --git a/arch/z16/src/z16f/Make.defs b/arch/z16/src/z16f/Make.defs index 422bdfa75e7..d862abd78eb 100644 --- a/arch/z16/src/z16f/Make.defs +++ b/arch/z16/src/z16f/Make.defs @@ -21,10 +21,10 @@ HEAD_SSRC = z16f_head.S CMN_CSRCS = z16_allocateheap.c z16_initialize.c z16_schedulesigaction.c -CMN_CSRCS += z16_assert.c z16_initialstate.c z16_sigdeliver.c z16_blocktask.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_unblocktask.c z16_doirq.c z16_releasepending.c z16_usestack.c +CMN_CSRCS += z16_switchcontext.c z16_doirq.c z16_releasepending.c z16_usestack.c CMN_CSRCS += z16_exit.c z16_releasestack.c z16_stackframe.c z16_idle.c CMN_CSRCS += z16_nputs.c diff --git a/arch/z80/src/common/z80_blocktask.c b/arch/z80/src/common/z80_blocktask.c deleted file mode 100644 index 9cf83eb48cf..00000000000 --- a/arch/z80/src/common/z80_blocktask.c +++ /dev/null @@ -1,122 +0,0 @@ -/**************************************************************************** - * arch/z80/src/common/z80_blocktask.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 - -#include -#include -#include -#include - -#include -#include - -#include "chip/switch.h" -#include "sched/sched.h" -#include "group/group.h" -#include "z80_internal.h" - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: up_block_task - * - * Description: - * The currently executing task has already removed from ready-to-run list. - * Save its context and switch to the next running task at the head of the - * ready-to-run list. - * - * Input Parameters: - * rtcb: Reference to the running task which is different to the - * task (next running task) at the head of the list. - * - ****************************************************************************/ - -void up_block_task(FAR struct tcb_s *rtcb) -{ - /* Update scheduler parameters */ - - nxsched_suspend_scheduler(rtcb); - - /* Are we in an interrupt handler? */ - - if (IN_INTERRUPT()) - { - /* Yes, then we have to do things differently. - * Just copy the current registers 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(); - - /* Reset 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 user C context into the TCB at the (old) head of the - * ready-to-run Task list. 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 - /* Reset scheduler parameters */ - - nxsched_resume_scheduler(rtcb); - - /* Then switch contexts */ - - RESTORE_USERCONTEXT(rtcb); - } -} diff --git a/arch/z80/src/common/z80_unblocktask.c b/arch/z80/src/common/z80_switchcontext.c similarity index 96% rename from arch/z80/src/common/z80_unblocktask.c rename to arch/z80/src/common/z80_switchcontext.c index 55fc1b2d346..6415eca1ef7 100644 --- a/arch/z80/src/common/z80_unblocktask.c +++ b/arch/z80/src/common/z80_switchcontext.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/z80/src/common/z80_unblocktask.c + * arch/z80/src/common/z80_switchcontext.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -43,7 +43,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_unblock_task + * Name: up_switch_context * * Description: * A task is currently in the ready-to-run list but has been prepped @@ -56,7 +56,7 @@ * ****************************************************************************/ -void up_unblock_task(FAR struct tcb_s *tcb, FAR struct tcb_s *rtcb) +void up_switch_context(FAR struct tcb_s *tcb, FAR struct tcb_s *rtcb) { /* Update scheduler parameters */ diff --git a/arch/z80/src/ez80/Make.defs b/arch/z80/src/ez80/Make.defs index a360cbeb7e7..637113c4245 100644 --- a/arch/z80/src/ez80/Make.defs +++ b/arch/z80/src/ez80/Make.defs @@ -19,8 +19,8 @@ ############################################################################ CMN_CSRCS = z80_initialize.c z80_allocateheap.c z80_createstack.c -CMN_CSRCS += z80_releasestack.c z80_interruptcontext.c z80_blocktask.c -CMN_CSRCS += z80_unblocktask.c z80_exit.c z80_releasepending.c +CMN_CSRCS += z80_releasestack.c z80_interruptcontext.c +CMN_CSRCS += z80_switchcontext.c z80_exit.c z80_releasepending.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 diff --git a/arch/z80/src/z180/Make.defs b/arch/z80/src/z180/Make.defs index 42a2dc0d795..748203e6c7e 100644 --- a/arch/z80/src/z180/Make.defs +++ b/arch/z80/src/z180/Make.defs @@ -26,11 +26,11 @@ HEAD_ASRC = z180_head.asm endif endif -CMN_CSRCS = z80_allocateheap.c z80_assert.c z80_blocktask.c z80_createstack.c +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_releasestack.c z80_stackframe.c -CMN_CSRCS += z80_unblocktask.c z80_udelay.c z80_usestack.c z80_nputs.c +CMN_CSRCS += z80_switchcontext.c z80_udelay.c z80_usestack.c z80_nputs.c CHIP_ASRCS = z180_restoreusercontext.asm z180_saveusercontext.asm CHIP_ASRCS += z180_vectcommon.asm diff --git a/arch/z80/src/z8/Make.defs b/arch/z80/src/z8/Make.defs index f70dbcfff7c..4e9c9e5e281 100644 --- a/arch/z80/src/z8/Make.defs +++ b/arch/z80/src/z8/Make.defs @@ -21,8 +21,8 @@ HEAD_SSRC = z8_head.S CMN_CSRCS = z80_initialize.c z80_allocateheap.c z80_createstack.c -CMN_CSRCS += z80_releasestack.c z80_interruptcontext.c z80_blocktask.c -CMN_CSRCS += z80_unblocktask.c z80_exit.c z80_releasepending.c +CMN_CSRCS += z80_releasestack.c z80_interruptcontext.c +CMN_CSRCS += z80_switchcontext.c z80_exit.c z80_releasepending.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 diff --git a/arch/z80/src/z80/Make.defs b/arch/z80/src/z80/Make.defs index 620264a1d4f..749b0f2d7f0 100644 --- a/arch/z80/src/z80/Make.defs +++ b/arch/z80/src/z80/Make.defs @@ -27,8 +27,8 @@ endif endif CMN_CSRCS = z80_initialize.c z80_allocateheap.c z80_createstack.c -CMN_CSRCS += z80_releasestack.c z80_interruptcontext.c z80_blocktask.c -CMN_CSRCS += z80_unblocktask.c z80_exit.c z80_releasepending.c +CMN_CSRCS += z80_releasestack.c z80_interruptcontext.c +CMN_CSRCS += z80_switchcontext.c z80_exit.c z80_releasepending.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 diff --git a/boards/arm/phy62xx/phy6222/scripts/flash.ld b/boards/arm/phy62xx/phy6222/scripts/flash.ld index d48f31847c2..4e25dcde3ee 100644 --- a/boards/arm/phy62xx/phy6222/scripts/flash.ld +++ b/boards/arm/phy62xx/phy6222/scripts/flash.ld @@ -139,7 +139,7 @@ SECTIONS *libarch.a:phy62xx_ble_hcitl.o(.text.phy62xx_ble_init) *libarch.a:phy62xx_ble_hcitl.o(.text.HCI_ProcessEvent1) *libarch.a:up_idle.o(.text .text.*) - *libarch.a:up_idle.o(.text.up_block_task) + *libarch.a:up_idle.o(.text.up_switch_context) *libarch.a:arm_switchcontext.o(.text .text.*) *libarch.a:arm_fullcontextrestore.o(.text .text.*) *libarch.a:arm_fullcontextrestore.o(.text .text.*) diff --git a/include/nuttx/arch.h b/include/nuttx/arch.h index 24e35a8d801..976d0ab8d1d 100644 --- a/include/nuttx/arch.h +++ b/include/nuttx/arch.h @@ -384,7 +384,7 @@ FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size); void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype); /**************************************************************************** - * Name: up_unblock_task + * Name: up_switch_context * * Description: * A task is currently in the ready-to-run list but has been prepped @@ -401,26 +401,7 @@ void up_release_stack(FAR struct tcb_s *dtcb, uint8_t ttype); * ****************************************************************************/ -void up_unblock_task(FAR struct tcb_s *tcb, FAR struct tcb_s *rtcb); - -/**************************************************************************** - * Name: up_block_task - * - * Description: - * The currently executing task has already removed from ready-to-run list. - * Save its context and switch to the next running task at the head of the - * ready-to-run list. - * - * This function is called only from the NuttX scheduling logic. - * Interrupts will always be disabled when this function is called. - * - * Input Parameters: - * rtcb: Reference to the running task which is different to the - * task (next running task) at the head of the list. - * - ****************************************************************************/ - -void up_block_task(FAR struct tcb_s *rtcb); +void up_switch_context(FAR struct tcb_s *tcb, FAR struct tcb_s *rtcb); /**************************************************************************** * Name: up_release_pending diff --git a/include/nuttx/page.h b/include/nuttx/page.h index 32d0d359561..05a9980ac0c 100644 --- a/include/nuttx/page.h +++ b/include/nuttx/page.h @@ -243,9 +243,9 @@ extern "C" * is resolved and all logic associated with the page fill worker * must be "locked" and always present in memory. * 2) Block the currently executing task. - * - Call up_block_task() to block the task at the head of the ready- - * to-run list. This should cause an interrupt level context switch - * to the next highest priority task. + * - Call up_switch_context() to block the task at the head of the + * ready-to-run list. This should cause an interrupt level context + * switch to the next highest priority task. * - The blocked task will be marked with state TSTATE_WAIT_PAGEFILL * and will be retained in the g_waitingforfill prioritized task * list. diff --git a/sched/group/group_continue.c b/sched/group/group_continue.c index b775ebbdbfc..542b6beddcb 100644 --- a/sched/group/group_continue.c +++ b/sched/group/group_continue.c @@ -75,7 +75,7 @@ static int group_continue_handler(pid_t pid, FAR void *arg) if (nxsched_add_readytorun(rtcb)) { - up_unblock_task(rtcb, tcb); + up_switch_context(rtcb, tcb); } } diff --git a/sched/mqueue/mq_rcvinternal.c b/sched/mqueue/mq_rcvinternal.c index ad1f74197fe..19112b58525 100644 --- a/sched/mqueue/mq_rcvinternal.c +++ b/sched/mqueue/mq_rcvinternal.c @@ -197,7 +197,7 @@ int nxmq_wait_receive(FAR struct mqueue_inode_s *msgq, if (switch_needed) { - up_block_task(rtcb); + up_switch_context(this_task(), rtcb); } /* When we resume at this point, either (1) the message queue @@ -330,7 +330,7 @@ ssize_t nxmq_do_receive(FAR struct mqueue_inode_s *msgq, if (nxsched_add_readytorun(btcb)) { - up_unblock_task(btcb, rtcb); + up_switch_context(btcb, rtcb); } } diff --git a/sched/mqueue/mq_sndinternal.c b/sched/mqueue/mq_sndinternal.c index 0df671bde97..fe0af476fbc 100644 --- a/sched/mqueue/mq_sndinternal.c +++ b/sched/mqueue/mq_sndinternal.c @@ -282,7 +282,7 @@ int nxmq_wait_send(FAR struct mqueue_inode_s *msgq, int oflags) if (switch_needed) { - up_block_task(rtcb); + up_switch_context(this_task(), rtcb); } /* When we resume at this point, either (1) the message queue @@ -436,7 +436,7 @@ int nxmq_do_send(FAR struct mqueue_inode_s *msgq, if (nxsched_add_readytorun(btcb)) { - up_unblock_task(btcb, rtcb); + up_switch_context(btcb, rtcb); } } diff --git a/sched/mqueue/mq_waitirq.c b/sched/mqueue/mq_waitirq.c index 58d78b22915..c784934cff9 100644 --- a/sched/mqueue/mq_waitirq.c +++ b/sched/mqueue/mq_waitirq.c @@ -105,6 +105,6 @@ void nxmq_wait_irq(FAR struct tcb_s *wtcb, int errcode) if (nxsched_add_readytorun(wtcb)) { - up_unblock_task(wtcb, rtcb); + up_switch_context(wtcb, rtcb); } } diff --git a/sched/mqueue/msgrcv.c b/sched/mqueue/msgrcv.c index d4def19463c..4a1abb6db97 100644 --- a/sched/mqueue/msgrcv.c +++ b/sched/mqueue/msgrcv.c @@ -140,7 +140,7 @@ static int msgrcv_wait(FAR struct msgq_s *msgq, FAR struct msgbuf_s **rcvmsg, if (switch_needed) { - up_block_task(rtcb); + up_switch_context(this_task(), rtcb); } /* When we resume at this point, either (1) the message queue @@ -271,7 +271,7 @@ ssize_t msgrcv(int msqid, FAR void *msgp, size_t msgsz, long msgtyp, if (nxsched_add_readytorun(btcb)) { - up_unblock_task(btcb, rtcb); + up_switch_context(btcb, rtcb); } } diff --git a/sched/mqueue/msgsnd.c b/sched/mqueue/msgsnd.c index 343137e9cd9..c5dac57e98a 100644 --- a/sched/mqueue/msgsnd.c +++ b/sched/mqueue/msgsnd.c @@ -106,7 +106,7 @@ static int msgsnd_wait(FAR struct msgq_s *msgq, int msgflg) if (switch_needed) { - up_block_task(rtcb); + up_switch_context(this_task(), rtcb); } /* When we resume at this point, either (1) the message queue @@ -264,7 +264,7 @@ int msgsnd(int msqid, FAR const void *msgp, size_t msgsz, int msgflg) if (nxsched_add_readytorun(btcb)) { - up_unblock_task(btcb, rtcb); + up_switch_context(btcb, rtcb); } } } diff --git a/sched/paging/pg_miss.c b/sched/paging/pg_miss.c index 6584323083c..fba79a74dde 100644 --- a/sched/paging/pg_miss.c +++ b/sched/paging/pg_miss.c @@ -57,9 +57,9 @@ * must be "locked" and always present in memory. * - ASSERT if an interrupt was executing at the time of the exception. * 2) Block the currently executing task. - * - Call up_block_task() to block the task at the head of the ready- - * to-run list. This should cause an interrupt level context switch - * to the next highest priority task. + * - Call up_switch_context() to block the task at the head of the + * ready-to-run list. This should cause an interrupt level context + * switch to the next highest priority task. * - The blocked task will be marked with state TSTATE_WAIT_PAGEFILL * and will be retained in the g_waitingforfill prioritized task * list. @@ -124,9 +124,9 @@ void pg_miss(void) DEBUGASSERT(g_pgworker != ftcb->pid); /* Block the currently executing task - * - Call up_block_task() to block the task at the head of the ready- - * to-run list. This should cause an interrupt level context switch - * to the next highest priority task. + * - Call up_switch_context() to block the task at the head of the + * ready-to-run list. This should cause an interrupt level context + * switch to the next highest priority task. * - The blocked task will be marked with state TSTATE_WAIT_PAGEFILL * and will be retained in the g_waitingforfill prioritized task list. * @@ -149,7 +149,7 @@ void pg_miss(void) if (switch_needed) { - up_block_task(ftcb); + up_switch_context(this_task(), ftcb); } /* Boost the page fill worker thread priority. diff --git a/sched/paging/pg_worker.c b/sched/paging/pg_worker.c index 82dbc6ed472..0ecdfcb9d05 100644 --- a/sched/paging/pg_worker.c +++ b/sched/paging/pg_worker.c @@ -295,7 +295,7 @@ static inline bool pg_dequeue(void) if (nxsched_add_readytorun(g_pftcb)) { - up_unblock_task(g_pftcb, wtcb); + up_switch_context(g_pftcb, wtcb); } } } @@ -492,7 +492,7 @@ static inline void pg_fillcomplete(void) if (nxsched_add_readytorun(g_pftcb)) { - up_unblock_task(g_pftcb, wtcb); + up_switch_context(g_pftcb, wtcb); } } @@ -595,7 +595,7 @@ int pg_worker(int argc, char *argv[]) if (nxsched_add_readytorun(g_pftcb)) { - up_unblock_task(g_pftcb, wtcb); + up_switch_context(g_pftcb, wtcb); } /* Yes .. Start the next asynchronous fill. Check the return @@ -680,7 +680,7 @@ int pg_worker(int argc, char *argv[]) if (nxsched_add_readytorun(g_pftcb)) { - up_unblock_task(g_pftcb, wtcb); + up_switch_context(g_pftcb, wtcb); } } diff --git a/sched/sched/sched_roundrobin.c b/sched/sched/sched_roundrobin.c index c174dbe78e5..b78e5efb204 100644 --- a/sched/sched/sched_roundrobin.c +++ b/sched/sched/sched_roundrobin.c @@ -149,7 +149,7 @@ uint32_t nxsched_process_roundrobin(FAR struct tcb_s *tcb, uint32_t ticks, if (nxsched_reprioritize_rtr(tcb, tcb->sched_priority)) { - up_block_task(rtcb); + up_switch_context(this_task(), rtcb); } } } diff --git a/sched/sched/sched_setpriority.c b/sched/sched/sched_setpriority.c index aa68e3eaac0..0ac0b93946f 100644 --- a/sched/sched/sched_setpriority.c +++ b/sched/sched/sched_setpriority.c @@ -146,7 +146,7 @@ static inline void nxsched_running_setpriority(FAR struct tcb_s *tcb, if (nxsched_reprioritize_rtr(tcb, sched_priority)) { - up_block_task(rtcb); + up_switch_context(this_task(), rtcb); } } @@ -230,7 +230,7 @@ static void nxsched_readytorun_setpriority(FAR struct tcb_s *tcb, if (nxsched_reprioritize_rtr(tcb, sched_priority)) { - up_block_task(rtcb); + up_switch_context(this_task(), rtcb); } } diff --git a/sched/sched/sched_suspend.c b/sched/sched/sched_suspend.c index c8725f261eb..53bd8f294a9 100644 --- a/sched/sched/sched_suspend.c +++ b/sched/sched/sched_suspend.c @@ -103,7 +103,7 @@ void nxsched_suspend(FAR struct tcb_s *tcb) if (switch_needed) { - up_block_task(rtcb); + up_switch_context(this_task(), rtcb); } } diff --git a/sched/semaphore/sem_holder.c b/sched/semaphore/sem_holder.c index d424e17ae78..9a79ab4ae72 100644 --- a/sched/semaphore/sem_holder.c +++ b/sched/semaphore/sem_holder.c @@ -335,7 +335,7 @@ static int nxsem_boostholderprio(FAR struct semholder_s *pholder, /* Raise the priority of the holder of the semaphore. This * cannot cause a context switch because we have preemption * disabled. The task will be marked "pending" and the switch - * will occur during up_block_task() processing. + * will occur during up_contex_switch() processing. */ nxsched_set_priority(htcb, rtcb->sched_priority); diff --git a/sched/semaphore/sem_post.c b/sched/semaphore/sem_post.c index 07dc2722ed3..1f9f9661160 100644 --- a/sched/semaphore/sem_post.c +++ b/sched/semaphore/sem_post.c @@ -161,7 +161,7 @@ int nxsem_post(FAR sem_t *sem) if (nxsched_add_readytorun(stcb)) { - up_unblock_task(stcb, rtcb); + up_switch_context(stcb, rtcb); } } #if 0 /* REVISIT: This can fire on IOB throttle semaphore */ diff --git a/sched/semaphore/sem_wait.c b/sched/semaphore/sem_wait.c index 421f37d92a2..df06d9c0f32 100644 --- a/sched/semaphore/sem_wait.c +++ b/sched/semaphore/sem_wait.c @@ -165,7 +165,7 @@ int nxsem_wait(FAR sem_t *sem) if (switch_needed) { - up_block_task(rtcb); + up_switch_context(this_task(), rtcb); } /* When we resume at this point, either (1) the semaphore has been diff --git a/sched/semaphore/sem_waitirq.c b/sched/semaphore/sem_waitirq.c index 5f732fa072a..2f0a0d8f541 100644 --- a/sched/semaphore/sem_waitirq.c +++ b/sched/semaphore/sem_waitirq.c @@ -109,6 +109,6 @@ void nxsem_wait_irq(FAR struct tcb_s *wtcb, int errcode) if (nxsched_add_readytorun(wtcb)) { - up_unblock_task(wtcb, rtcb); + up_switch_context(wtcb, rtcb); } } diff --git a/sched/signal/sig_dispatch.c b/sched/signal/sig_dispatch.c index 26eb31dcc22..6f8f3c120e6 100644 --- a/sched/signal/sig_dispatch.c +++ b/sched/signal/sig_dispatch.c @@ -381,7 +381,7 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info) if (nxsched_add_readytorun(stcb)) { - up_unblock_task(stcb, rtcb); + up_switch_context(stcb, rtcb); } leave_critical_section(flags); @@ -435,7 +435,7 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info) if (nxsched_add_readytorun(stcb)) { - up_unblock_task(stcb, rtcb); + up_switch_context(stcb, rtcb); } } @@ -499,7 +499,7 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info) if (nxsched_add_readytorun(stcb)) { - up_unblock_task(stcb, rtcb); + up_switch_context(stcb, rtcb); } #endif } diff --git a/sched/signal/sig_suspend.c b/sched/signal/sig_suspend.c index bb45c49b7ac..b11949b9796 100644 --- a/sched/signal/sig_suspend.c +++ b/sched/signal/sig_suspend.c @@ -138,7 +138,7 @@ int sigsuspend(FAR const sigset_t *set) if (switch_needed) { - up_block_task(rtcb); + up_switch_context(this_task(), rtcb); } /* We are running again, restore the original sigprocmask */ diff --git a/sched/signal/sig_timedwait.c b/sched/signal/sig_timedwait.c index 151842c29ab..77ab7634b9a 100644 --- a/sched/signal/sig_timedwait.c +++ b/sched/signal/sig_timedwait.c @@ -79,7 +79,7 @@ static void nxsig_timeout(wdparm_t arg) #ifdef CONFIG_SMP irqstate_t flags; - /* We must be in a critical section in order to call up_unblock_task() + /* We must be in a critical section in order to call up_switch_context() * below. If we are running on a single CPU architecture, then we know * interrupts a disabled an there is no need to explicitly call * enter_critical_section(). However, in the SMP case, @@ -118,7 +118,7 @@ static void nxsig_timeout(wdparm_t arg) if (nxsched_add_readytorun(wtcb)) { - up_unblock_task(wtcb, rtcb); + up_switch_context(wtcb, rtcb); } } @@ -146,7 +146,7 @@ void nxsig_wait_irq(FAR struct tcb_s *wtcb, int errcode) #ifdef CONFIG_SMP irqstate_t flags; - /* We must be in a critical section in order to call up_unblock_task() + /* We must be in a critical section in order to call up_switch_context() * below. If we are running on a single CPU architecture, then we know * interrupts a disabled an there is no need to explicitly call * enter_critical_section(). However, in the SMP case, @@ -185,7 +185,7 @@ void nxsig_wait_irq(FAR struct tcb_s *wtcb, int errcode) if (nxsched_add_readytorun(wtcb)) { - up_unblock_task(wtcb, rtcb); + up_switch_context(wtcb, rtcb); } } @@ -366,7 +366,7 @@ int nxsig_timedwait(FAR const sigset_t *set, FAR struct siginfo *info, if (switch_needed) { - up_block_task(rtcb); + up_switch_context(this_task(), rtcb); } /* We no longer need the watchdog */ @@ -408,7 +408,7 @@ int nxsig_timedwait(FAR const sigset_t *set, FAR struct siginfo *info, if (switch_needed) { - up_block_task(rtcb); + up_switch_context(this_task(), rtcb); } } diff --git a/sched/task/task_activate.c b/sched/task/task_activate.c index 97e6caba256..7fb6496183d 100644 --- a/sched/task/task_activate.c +++ b/sched/task/task_activate.c @@ -90,7 +90,7 @@ void nxtask_activate(FAR struct tcb_s *tcb) if (nxsched_add_readytorun(tcb)) { - up_unblock_task(tcb, rtcb); + up_switch_context(tcb, rtcb); } leave_critical_section(flags);