• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2022 Huawei Technologies Co., Ltd. All rights reserved.
3  *
4  * UniProton is licensed under Mulan PSL v2.
5  * You can use this software according to the terms and conditions of the Mulan PSL v2.
6  * You may obtain a copy of Mulan PSL v2 at:
7  *          http://license.coscl.org.cn/MulanPSL2
8  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
9  * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
10  * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
11  * See the Mulan PSL v2 for more details.
12  * Create: 2022-11-22
13  * Description: ARMV8 公共汇编宏文件。
14  */
15 #ifndef OS_ASM_CPU_ARMV8_EXTERNAL_H
16 #define OS_ASM_CPU_ARMV8_EXTERNAL_H
17 
18 /*
19  *  描述: 读取当前核号
20  *        使用mpidr 寄存器 (64bit) 根据核的线程模式获取核号
21  *        bit 63-40 39-32   31  30 29~25  24 23-16  15-8   7~0
22  *             res0  aff3  res1  u  res0  mt  aff2  aff1  aff0
23  */
24 .macro OsAsmGetCoreId, xArg
25     mrs \xArg, mpidr_el1
26     orr \xArg, \xArg, \xArg, lsr #0x8
27     and \xArg, \xArg, #0xff /* 截取核号部分 */
28 .endm
29 
30 #endif /* OS_ASM_CPU_ARMV8_EXTERNAL_H */
31