1/* 2 * Copyright (c) 2023 Institute of Parallel And Distributed Systems (IPADS), Shanghai Jiao Tong University (SJTU) 3 * Licensed under the Mulan PSL v2. 4 * You can use this software according to the terms and conditions of the Mulan PSL v2. 5 * You may obtain a copy of Mulan PSL v2 at: 6 * http://license.coscl.org.cn/MulanPSL2 7 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR 8 * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR 9 * PURPOSE. 10 * See the Mulan PSL v2 for more details. 11 */ 12#include <common/asm.h> 13#include <arch/machine/smp.h> 14 15.macro switch_to_cpu_stack 16 mrs x24, TPIDR_EL1 17 add x24, x24, #OFFSET_LOCAL_CPU_STACK 18 ldr x24, [x24] 19 mov sp, x24 20.endm 21 22BEGIN_FUNC(smc_call) 23 /* switch to SMC page table (va == pa) */ 24 ldr x5, =smc_ttbr0_el1 25 ldr x5, [x5] 26 msr ttbr0_el1, x5 27 isb 28 29 smc #0 30END_FUNC(smc_call) 31 32BEGIN_FUNC(yield_smc_entry) 33 switch_to_cpu_stack 34 b handle_yield_smc 35END_FUNC(yield_smc_entry) 36