1 /** 2 * Copyright (c) 2023-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef PANDA_RUNTIME_FIBERS_ARCH_ASM_MACROS_H 17 #define PANDA_RUNTIME_FIBERS_ARCH_ASM_MACROS_H 18 19 #include "runtime/arch/asm_support.h" 20 21 #if defined(PANDA_TARGET_ARM64) 22 #define FUNC_ALIGNMENT_BYTES 32 23 #elif defined(PANDA_TARGET_ARM32) 24 #define FUNC_ALIGNMENT_BYTES 16 25 #elif defined(PANDA_TARGET_X86) 26 #error "Unsupported target" 27 #elif defined(PANDA_TARGET_AMD64) 28 #define FUNC_ALIGNMENT_BYTES 16 29 #else 30 #error "Unsupported target" 31 #endif 32 33 #define FUNCTION_HEADER(name) \ 34 .globl name; \ 35 TYPE_FUNCTION(name); \ 36 .balign FUNC_ALIGNMENT_BYTES; \ 37 name##: 38 39 #define FUNCTION_START(name) FUNCTION_HEADER(name) 40 #define LOCAL_FUNCTION_START(name) \ 41 .hidden name; \ 42 FUNCTION_HEADER(name) 43 44 // CC-OFFNXT(G.PRE.09) code generation 45 // CC-OFFNXT(G.PRE.02) list generation 46 #define FUNCTION_END(name) .size name, .- name; 47 48 #endif /* PANDA_RUNTIME_FIBERS_ARCH_ASM_MACROS_H */