Files
SDK_SG200x_V2/fsbl/include/cpu/asm_macros_common.S
carbon 0545e9dc6d init version 2024-05-07
commit d1edce71135cc6d98c0a4b5729774542b676e769
Author: sophgo-forum-service <forum_service@sophgo.com>
Date:   Fri Mar 15 16:07:33 2024 +0800

    [fix] recommend using ssh method to clone repo.
    [fix] fix sensor driver repo branch name.
2024-05-07 19:36:36 +08:00

61 lines
1.6 KiB
ArmAsm

/*
* Copyright (c) 2013-2016, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef __ASM_MACROS_COMMON_S__
#define __ASM_MACROS_COMMON_S__
/*
* This macro is used to create a function label and place the
* code into a separate text section based on the function name
* to enable elimination of unused code during linking. It also adds
* basic debug information to enable call stack printing most of the
* time.
*/
.macro func _name
/*
* Add Call Frame Information entry in the .debug_frame section for
* debugger consumption. This enables callstack printing in debuggers.
* This does not use any space in the final loaded binary, only in the
* ELF file.
* Note that a function manipulating the CFA pointer location (i.e. the
* x29 frame pointer on AArch64) should declare it using the
* appropriate .cfi* directives, or be prepared to have a degraded
* debugging experience.
*/
.cfi_sections .debug_frame
.section .text.\_name, "ax"
.type \_name, %function
.func \_name
/*
* .cfi_startproc and .cfi_endproc are needed to output entries in
* .debug_frame
*/
.cfi_startproc
\_name:
.endm
/*
* This macro is used to mark the end of a function.
*/
.macro endfunc _name
.endfunc
.cfi_endproc
.size \_name, . - \_name
.endm
/*
* Helper assembler macro to count trailing zeros. The output is
* populated in the `TZ_COUNT` symbol.
*/
.macro count_tz _value, _tz_count
.if \_value
count_tz "(\_value >> 1)", "(\_tz_count + 1)"
.else
.equ TZ_COUNT, (\_tz_count - 1)
.endif
.endm
#endif /* __ASM_MACROS_COMMON_S__ */