diff --git a/arch/arm64/src/common/CMakeLists.txt b/arch/arm64/src/common/CMakeLists.txt index 319677de30..3358c52b7b 100644 --- a/arch/arm64/src/common/CMakeLists.txt +++ b/arch/arm64/src/common/CMakeLists.txt @@ -34,8 +34,7 @@ list(APPEND SRCS arm64_initialize.c arm64_initialstate.c arm64_boot.c) list(APPEND SRCS arm64_nputs.c arm64_idle.c arm64_copystate.c arm64_createstack.c) list(APPEND SRCS arm64_releasestack.c arm64_stackframe.c arm64_usestack.c) -list(APPEND SRCS arm64_task_sched.c arm64_exit.c arm64_fork.c - arm64_switchcontext.c) +list(APPEND SRCS arm64_exit.c arm64_fork.c arm64_switchcontext.c) list(APPEND SRCS arm64_schedulesigaction.c arm64_sigdeliver.c) list(APPEND SRCS arm64_getintstack.c arm64_registerdump.c) list(APPEND SRCS arm64_perf.c arm64_tcbinfo.c) diff --git a/arch/arm64/src/common/Make.defs b/arch/arm64/src/common/Make.defs index 4bb12ec7eb..00cb0b7099 100644 --- a/arch/arm64/src/common/Make.defs +++ b/arch/arm64/src/common/Make.defs @@ -45,7 +45,7 @@ endif CMN_CSRCS = arm64_initialize.c arm64_initialstate.c arm64_boot.c CMN_CSRCS += arm64_nputs.c arm64_idle.c arm64_copystate.c arm64_createstack.c CMN_CSRCS += arm64_releasestack.c arm64_stackframe.c arm64_usestack.c -CMN_CSRCS += arm64_task_sched.c arm64_exit.c arm64_fork.c arm64_switchcontext.c +CMN_CSRCS += arm64_exit.c arm64_fork.c arm64_switchcontext.c CMN_CSRCS += arm64_schedulesigaction.c arm64_sigdeliver.c CMN_CSRCS += arm64_getintstack.c arm64_registerdump.c CMN_CSRCS += arm64_perf.c arm64_tcbinfo.c diff --git a/arch/arm64/src/common/arm64_internal.h b/arch/arm64/src/common/arm64_internal.h index 8d82fa0837..b05ff81044 100644 --- a/arch/arm64/src/common/arm64_internal.h +++ b/arch/arm64/src/common/arm64_internal.h @@ -32,6 +32,7 @@ # include # include # include +# include #endif #include "arm64_arch.h" @@ -116,6 +117,18 @@ # define SMP_STACK_WORDS (SMP_STACK_SIZE >> 2) #endif +/* Context switching */ + +#define arm64_fullcontextrestore(restoreregs) \ + do \ + { \ + sys_call1(SYS_restore_context, (uintptr_t)restoreregs); \ + } \ + while (1) + +#define arm64_switchcontext(saveregs, restoreregs) \ + sys_call2(SYS_switch_context, (uintptr_t)saveregs, (uintptr_t)restoreregs) + /**************************************************************************** * Public Types ****************************************************************************/ @@ -267,11 +280,6 @@ int arm64_psci_init(const char *method); void __start(void); void arm64_secondary_start(void); -/* Context switching */ - -void arm64_fullcontextrestore(uint64_t *restoreregs) noreturn_function; -void arm64_switchcontext(uint64_t **saveregs, uint64_t *restoreregs); - /* Signal handling **********************************************************/ void arm64_sigdeliver(void); diff --git a/arch/arm64/src/common/arm64_task_sched.c b/arch/arm64/src/common/arm64_task_sched.c deleted file mode 100644 index 69f27df8c1..0000000000 --- a/arch/arm64/src/common/arm64_task_sched.c +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** - * arch/arm64/src/common/arm64_task_sched.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 "arm64_internal.h" -#include "arm64_fatal.h" - -#ifdef CONFIG_ARCH_FPU -#include "arm64_fpu.h" -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: arm64_fullcontextrestore - * - * Description: - * Restore the current thread context. Full prototype is: - * - * void arm64_fullcontextrestore(uint64_t *restoreregs) noreturn_function; - * - * Returned Value: - * None - * - ****************************************************************************/ - -void arm64_fullcontextrestore(uint64_t *restoreregs) -{ - sys_call1(SYS_restore_context, (uintptr_t)restoreregs); - - __builtin_unreachable(); -} - -/**************************************************************************** - * Name: arm64_switchcontext - * - * Description: - * Save the current thread context and restore the specified context. - * - * Returned Value: - * None - * - ****************************************************************************/ - -void arm64_switchcontext(uint64_t **saveregs, uint64_t *restoreregs) -{ - sys_call2(SYS_switch_context, (uintptr_t)saveregs, (uintptr_t)restoreregs); -}