board/arch_fpu*: move arch_[get|cmp]fpu to common arch
rename the arch api: arch_getfpu -> up_saveusercontext arch_cmpfpu -> up_cmpfpu Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
parent
dc2e4b7024
commit
29005bd79f
@ -133,6 +133,8 @@
|
||||
#define XCPTCONTEXT_REGS (HW_XCPT_REGS + SW_XCPT_REGS)
|
||||
#define XCPTCONTEXT_SIZE (4 * XCPTCONTEXT_REGS)
|
||||
|
||||
#define FPU_CONTEXT_REGS SW_FPU_REGS
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
@ -151,6 +151,8 @@
|
||||
#define XCPTCONTEXT_REGS (HW_XCPT_REGS + SW_XCPT_REGS)
|
||||
#define XCPTCONTEXT_SIZE (HW_XCPT_SIZE + SW_XCPT_SIZE)
|
||||
|
||||
#define FPU_CONTEXT_REGS SW_FPU_REGS
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
@ -139,6 +139,8 @@
|
||||
#define XCPTCONTEXT_REGS (HW_XCPT_REGS + SW_XCPT_REGS)
|
||||
#define XCPTCONTEXT_SIZE (4 * XCPTCONTEXT_REGS)
|
||||
|
||||
#define FPU_CONTEXT_REGS SW_FPU_REGS
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
@ -157,6 +157,8 @@
|
||||
#define XCPTCONTEXT_REGS (HW_XCPT_REGS + SW_XCPT_REGS)
|
||||
#define XCPTCONTEXT_SIZE (HW_XCPT_SIZE + SW_XCPT_SIZE)
|
||||
|
||||
#define FPU_CONTEXT_REGS SW_FPU_REGS
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
@ -105,6 +105,7 @@ CMN_CSRCS += arm_cache.c
|
||||
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += arm_savefpu.S arm_restorefpu.S
|
||||
CMN_CSRCS += arm_fpucmp.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_STACK_COLORATION),y)
|
||||
|
@ -101,6 +101,7 @@ CMN_CSRCS += arm_cache.c
|
||||
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += arm_savefpu.S arm_restorefpu.S
|
||||
CMN_CSRCS += arm_fpucmp.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_STACK_COLORATION),y)
|
||||
|
59
arch/arm/src/common/arm_fpucmp.c
Normal file
59
arch/arm/src/common/arm_fpucmp.c
Normal file
@ -0,0 +1,59 @@
|
||||
/****************************************************************************
|
||||
* arch/arm/src/common/arm_fpucmp.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 <stdint.h>
|
||||
#include <string.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include "arm_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_FPU
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_fpucmp
|
||||
*
|
||||
* Description:
|
||||
* compare FPU areas from thread context
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
bool up_fpucmp(const void *saveregs1, const void *saveregs2)
|
||||
{
|
||||
const uint32_t *regs1 = saveregs1;
|
||||
const uint32_t *regs2 = saveregs2;
|
||||
|
||||
return memcmp(®s1[REG_S0],
|
||||
®s2[REG_S0], (4 * FPU_CONTEXT_REGS)) == 0;
|
||||
}
|
||||
#endif /* CONFIG_ARCH_FPU */
|
@ -63,6 +63,7 @@ endif
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += arm_fpu.S
|
||||
CMN_CSRCS += arm_fpuconfig.c
|
||||
CMN_CSRCS += arm_fpucmp.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARMV7M_ITMSYSLOG),y)
|
||||
|
@ -59,6 +59,7 @@ endif
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += arm_fpu.S
|
||||
CMN_CSRCS += arm_fpuconfig.c
|
||||
CMN_CSRCS += arm_fpucmp.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARMV7M_ITMSYSLOG),y)
|
||||
|
@ -58,6 +58,7 @@ endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_CSRCS += arm_fpuconfig.c
|
||||
CMN_CSRCS += arm_fpucmp.c
|
||||
endif
|
||||
|
||||
CHIP_CSRCS = eoss3_start.c eoss3_gpio.c eoss3_lowputc.c eoss3_clockconfig.c
|
||||
|
@ -125,6 +125,7 @@ endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += arm_savefpu.S arm_restorefpu.S
|
||||
CMN_CSRCS += arm_fpucmp.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_STACK_COLORATION),y)
|
||||
|
@ -73,6 +73,7 @@ CMN_CSRCS += arm_cache.c
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += arm_fpu.S
|
||||
CMN_CSRCS += arm_fpuconfig.c
|
||||
CMN_CSRCS += arm_fpucmp.c
|
||||
endif
|
||||
|
||||
# Required i.MX RT files
|
||||
|
@ -77,6 +77,7 @@ endif
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += arm_fpu.S
|
||||
CMN_CSRCS += arm_fpuconfig.c
|
||||
CMN_CSRCS += arm_fpucmp.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARMV7M_ITMSYSLOG),y)
|
||||
|
@ -75,6 +75,7 @@ endif
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += arm_fpu.S
|
||||
CMN_CSRCS += arm_fpuconfig.c
|
||||
CMN_CSRCS += arm_fpucmp.c
|
||||
endif
|
||||
|
||||
# Required LPC17xx files
|
||||
|
@ -63,6 +63,7 @@ endif
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += arm_fpu.S
|
||||
CMN_CSRCS += arm_fpuconfig.c
|
||||
CMN_CSRCS += arm_fpucmp.c
|
||||
endif
|
||||
|
||||
CHIP_CSRCS = lpc43_allocateheap.c lpc43_cgu.c lpc43_clrpend.c lpc43_gpio.c
|
||||
|
@ -63,6 +63,7 @@ endif
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += arm_fpu.S
|
||||
CMN_CSRCS += arm_fpuconfig.c
|
||||
CMN_CSRCS += arm_fpucmp.c
|
||||
endif
|
||||
|
||||
CHIP_CSRCS = lpc54_start.c lpc54_clockconfig.c lpc54_irq.c lpc54_clrpend.c
|
||||
|
@ -61,6 +61,7 @@ endif
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += arm_fpu.S
|
||||
CMN_CSRCS += arm_fpuconfig.c
|
||||
CMN_CSRCS += arm_fpucmp.c
|
||||
endif
|
||||
|
||||
# Common MAX326XX Source Files
|
||||
|
@ -71,6 +71,7 @@ endif
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += arm_fpu.S
|
||||
CMN_CSRCS += arm_fpuconfig.c
|
||||
CMN_CSRCS += arm_fpucmp.c
|
||||
endif
|
||||
|
||||
CHIP_CSRCS = nrf52_start.c nrf52_clockconfig.c nrf52_irq.c nrf52_utils.c
|
||||
|
@ -40,6 +40,7 @@ endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_CSRCS += arm_fpuconfig.c
|
||||
CMN_CSRCS += arm_fpucmp.c
|
||||
endif
|
||||
|
||||
# Source files common to all S32K1xx chip families.
|
||||
|
@ -67,6 +67,7 @@ endif
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += arm_fpu.S
|
||||
CMN_CSRCS += arm_fpuconfig.c
|
||||
CMN_CSRCS += arm_fpucmp.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SCHED_BACKTRACE),y)
|
||||
|
@ -107,6 +107,7 @@ CMN_CSRCS += arm_cache.c
|
||||
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += arm_savefpu.S arm_restorefpu.S
|
||||
CMN_CSRCS += arm_fpucmp.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_STACK_COLORATION),y)
|
||||
|
@ -57,6 +57,7 @@ endif
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += arm_fpu.S
|
||||
CMN_CSRCS += arm_fpuconfig.c
|
||||
CMN_CSRCS += arm_fpucmp.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SCHED_BACKTRACE),y)
|
||||
|
@ -62,6 +62,7 @@ CMN_CSRCS += arm_cache.c
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += arm_fpu.S
|
||||
CMN_CSRCS += arm_fpuconfig.c
|
||||
CMN_CSRCS += arm_fpucmp.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_RAMVECTORS),y)
|
||||
|
@ -71,6 +71,7 @@ endif
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += arm_fpu.S
|
||||
CMN_CSRCS += arm_fpuconfig.c
|
||||
CMN_CSRCS += arm_fpucmp.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARMV7M_ITMSYSLOG),y)
|
||||
|
@ -62,6 +62,7 @@ CMN_CSRCS += arm_cache.c
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += arm_fpu.S
|
||||
CMN_CSRCS += arm_fpuconfig.c
|
||||
CMN_CSRCS += arm_fpucmp.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_RAMVECTORS),y)
|
||||
|
@ -62,6 +62,7 @@ CMN_CSRCS += arm_cache.c
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += arm_fpu.S
|
||||
CMN_CSRCS += arm_fpuconfig.c
|
||||
CMN_CSRCS += arm_fpucmp.c
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_ARCH_IDLE_CUSTOM),y)
|
||||
|
@ -56,6 +56,7 @@ CMN_CSRCS += arm_vectors.c
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += arm_fpu.S
|
||||
CMN_CSRCS += arm_fpuconfig.c
|
||||
CMN_CSRCS += arm_fpucmp.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_RAMVECTORS),y)
|
||||
|
@ -61,6 +61,7 @@ CMN_CSRCS += arm_vectors.c
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += arm_fpu.S
|
||||
CMN_CSRCS += arm_fpuconfig.c
|
||||
CMN_CSRCS += arm_fpucmp.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_RAMVECTORS),y)
|
||||
|
@ -61,6 +61,7 @@ CMN_CSRCS += arm_vectors.c
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += arm_fpu.S
|
||||
CMN_CSRCS += arm_fpuconfig.c
|
||||
CMN_CSRCS += arm_fpucmp.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_RAMVECTORS),y)
|
||||
|
@ -50,6 +50,7 @@ CMN_CSRCS += arm_vectors.c
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += arm_fpu.S
|
||||
CMN_CSRCS += arm_fpuconfig.c
|
||||
CMN_CSRCS += arm_fpucmp.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_RAMVECTORS),y)
|
||||
|
@ -73,6 +73,7 @@ CMN_CSRCS += arm_cache.c
|
||||
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += arm_savefpu.S arm_restorefpu.S
|
||||
CMN_CSRCS += arm_fpucmp.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_SCHED_BACKTRACE),y)
|
||||
|
@ -76,6 +76,7 @@ endif
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += arm_fpu.S
|
||||
CMN_CSRCS += arm_fpuconfig.c
|
||||
CMN_CSRCS += arm_fpucmp.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARMV7M_ITMSYSLOG),y)
|
||||
|
@ -47,6 +47,7 @@ endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += riscv_fpu.S
|
||||
CMN_CSRCS += riscv_fpucmp.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_HAVE_VFORK),y)
|
||||
|
@ -47,6 +47,7 @@ endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += riscv_fpu.S
|
||||
CMN_CSRCS += riscv_fpucmp.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_HAVE_VFORK),y)
|
||||
|
59
arch/risc-v/src/common/riscv_fpucmp.c
Normal file
59
arch/risc-v/src/common/riscv_fpucmp.c
Normal file
@ -0,0 +1,59 @@
|
||||
/****************************************************************************
|
||||
* arch/risc-v/src/common/riscv_fpucmp.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 <stdint.h>
|
||||
#include <string.h>
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
#include "riscv_internal.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_FPU
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_fpucmp
|
||||
*
|
||||
* Description:
|
||||
* compare FPU areas from thread context
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
bool up_fpucmp(const void *saveregs1, const void *saveregs2)
|
||||
{
|
||||
const uintptr_t *regs1 = saveregs1;
|
||||
const uintptr_t *regs2 = saveregs2;
|
||||
|
||||
return memcmp(®s1[INT_XCPT_REGS], ®s2[INT_XCPT_REGS],
|
||||
INT_REG_SIZE * FPU_XCPT_REGS) == 0;
|
||||
}
|
||||
#endif /* CONFIG_ARCH_FPU */
|
@ -48,6 +48,7 @@ endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += riscv_fpu.S
|
||||
CMN_CSRCS += riscv_fpucmp.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_HAVE_VFORK),y)
|
||||
|
@ -60,6 +60,7 @@ endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_FPU),y)
|
||||
CMN_ASRCS += riscv_fpu.S
|
||||
CMN_CSRCS += riscv_fpucmp.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ARCH_RV_ISA_A),y)
|
||||
|
@ -2573,6 +2573,20 @@ void up_perf_convert(uint32_t elapsed, FAR struct timespec *ts);
|
||||
|
||||
int up_saveusercontext(FAR void *saveregs);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: up_fpucmp
|
||||
*
|
||||
* Description:
|
||||
* compare FPU areas from thread context
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_FPU
|
||||
bool up_fpucmp(FAR const void *saveregs1, FAR const void *saveregs2);
|
||||
#else
|
||||
#define up_fpucmp(r1, r2) (true)
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user