xtensa: inline up_switch_context
Signed-off-by: chenxiaoyi <chenxiaoyi@xiaomi.com> Signed-off-by: hujun5 <hujun5@xiaomi.com>
This commit is contained in:
parent
060fda032b
commit
f313ee5715
5 changed files with 11 additions and 82 deletions
|
@ -39,6 +39,7 @@
|
|||
#include <sys/types.h>
|
||||
#ifndef __ASSEMBLY__
|
||||
# include <stdbool.h>
|
||||
# include <arch/syscall.h>
|
||||
#endif
|
||||
|
||||
#include <arch/types.h>
|
||||
|
@ -448,6 +449,15 @@ noinstrument_function static inline_function bool up_interrupt_context(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#define up_switch_context(tcb, rtcb) \
|
||||
do { \
|
||||
if (!up_interrupt_context()) \
|
||||
{ \
|
||||
sys_call0(SYS_switch_context); \
|
||||
} \
|
||||
UNUSED(rtcb); \
|
||||
} while (0)
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_getusrpc
|
||||
****************************************************************************/
|
||||
|
|
|
@ -71,7 +71,6 @@ list(
|
|||
xtensa_releasestack.c
|
||||
xtensa_registerdump.c
|
||||
xtensa_sigdeliver.c
|
||||
xtensa_switchcontext.c
|
||||
xtensa_swint.c
|
||||
xtensa_stackframe.c
|
||||
xtensa_saveusercontext.c
|
||||
|
|
|
@ -36,7 +36,7 @@ CMN_CSRCS += xtensa_irqdispatch.c xtensa_lowputs.c xtensa_mdelay.c
|
|||
CMN_CSRCS += xtensa_modifyreg8.c xtensa_modifyreg16.c xtensa_modifyreg32.c
|
||||
CMN_CSRCS += xtensa_mpu.c xtensa_nputs.c xtensa_oneshot.c xtensa_perf.c
|
||||
CMN_CSRCS += xtensa_releasestack.c xtensa_registerdump.c xtensa_sigdeliver.c
|
||||
CMN_CSRCS += xtensa_switchcontext.c xtensa_swint.c xtensa_stackframe.c
|
||||
CMN_CSRCS += xtensa_swint.c xtensa_stackframe.c
|
||||
CMN_CSRCS += xtensa_saveusercontext.c xtensa_schedsigaction.c xtensa_udelay.c
|
||||
CMN_CSRCS += xtensa_usestack.c xtensa_tcbinfo.c
|
||||
|
||||
|
|
|
@ -109,8 +109,6 @@
|
|||
|
||||
#define xtensa_context_restore() sys_call0(SYS_restore_context)
|
||||
|
||||
#define xtensa_switchcontext() sys_call0(SYS_switch_context)
|
||||
|
||||
/* Interrupt codes from other CPUs: */
|
||||
|
||||
#define CPU_INTCODE_NONE 0
|
||||
|
|
|
@ -1,78 +0,0 @@
|
|||
/****************************************************************************
|
||||
* arch/xtensa/src/common/xtensa_switchcontext.c
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership. The
|
||||
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance with the
|
||||
* License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sched.h>
|
||||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/sched.h>
|
||||
#include <arch/chip/core-isa.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
#include "group/group.h"
|
||||
#include "clock/clock.h"
|
||||
#include "xtensa.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* 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)
|
||||
{
|
||||
/* Are we in an interrupt handler? */
|
||||
|
||||
if (!up_interrupt_context())
|
||||
{
|
||||
/* Switch context to the context of the task at the head of the
|
||||
* ready to run list.
|
||||
*/
|
||||
|
||||
xtensa_switchcontext();
|
||||
|
||||
/* 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.
|
||||
*/
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue