1 /* 2 * Copyright (c) 2009-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: 2009-12-26 13 * Description: ARM汇编宏, 如initRnd等。 14 */ 15 #ifndef PRT_ASM_ARM_EXTERNAL_H 16 #define PRT_ASM_ARM_EXTERNAL_H 17 18 /* 19 * 描述 : stack_chk_guard支持用户传入seed写入函数宏 20 * argA argB argC 需要使用处传入三个可用寄存器 21 */ 22 .macro InitChkGuardRnd argA, argB, argC 23 ldr \argA, = g_memCanaryRdm /* 用户传入seed */ 24 ldr \argB, = __stack_chk_guard 25 ldr \argC, [\argA] 26 cmp \argC, #0 27 beq 1f 28 str \argC, [\argB] /* RND写入 */ 29 mov \argC, #0 30 str \argC, [\argA] /* 销毁 */ 31 1: 32 .endm 33 34 #endif /* PRT_ASM_ARM_EXTERNAL_H */ 35