arch/xtensa: Move xtensa_save_context to up_saveusercontext for

consistency with other archs.

Signed-off-by: Abdelatif Guettouche <abdelatif.guettouche@espressif.com>
This commit is contained in:
Abdelatif Guettouche 2022-04-20 17:44:13 +02:00 committed by Xiang Xiao
parent 0831539af1
commit 64e4c9ca02
6 changed files with 54 additions and 4 deletions

View File

@ -115,9 +115,6 @@
/* Context switching via system calls ***************************************/
#define xtensa_context_save(regs)\
sys_call1(SYS_save_context, (uintptr_t)regs)
#define xtensa_context_restore(regs)\
sys_call1(SYS_restore_context, (uintptr_t)regs)

View File

@ -300,7 +300,7 @@ void xtensa_dumpstate(void)
}
else
{
xtensa_context_save(rtcb->xcp.regs);
up_saveusercontext(rtcb->xcp.regs);
}
/* Dump the registers (if available) */

View File

@ -0,0 +1,50 @@
/****************************************************************************
* arch/xtensa/src/common/xtensa_saveusercontext.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <arch/syscall.h>
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: up_saveusercontext
*
* Description:
* Save the current thread context. Full prototype is:
*
* int up_saveusercontext(void *saveregs);
*
* Returned Value:
* 0: Normal return
* 1: Context switch return
*
****************************************************************************/
int up_saveusercontext(void *saveregs)
{
return sys_call1(SYS_save_context, (uintptr_t)saveregs);
}

View File

@ -40,6 +40,7 @@ CMN_CSRCS += xtensa_puts.c xtensa_releasepending.c xtensa_releasestack.c
CMN_CSRCS += xtensa_reprioritizertr.c 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_saveusercontext.c
# Configuration-dependent common XTENSA files

View File

@ -40,6 +40,7 @@ CMN_CSRCS += xtensa_puts.c xtensa_releasepending.c xtensa_releasestack.c
CMN_CSRCS += xtensa_reprioritizertr.c 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_saveusercontext.c
# Configuration-dependent common XTENSA files

View File

@ -40,6 +40,7 @@ CMN_CSRCS += xtensa_puts.c xtensa_releasepending.c xtensa_releasestack.c
CMN_CSRCS += xtensa_reprioritizertr.c 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_saveusercontext.c
# Configuration-dependent common XTENSA files