LCOV - code coverage report
Current view: top level - backends - aarch64_cfi.c (source / functions) Hit Total Coverage
Test: elfutils-0.183 Lines: 7 7 100.0 %
Date: 2021-02-07 19:08:58 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* arm64 ABI-specified defaults for DWARF CFI.
       2                 :            :    Copyright (C) 2013, 2018 Red Hat, Inc.
       3                 :            :    This file is part of elfutils.
       4                 :            : 
       5                 :            :    This file is free software; you can redistribute it and/or modify
       6                 :            :    it under the terms of either
       7                 :            : 
       8                 :            :      * the GNU Lesser General Public License as published by the Free
       9                 :            :        Software Foundation; either version 3 of the License, or (at
      10                 :            :        your option) any later version
      11                 :            : 
      12                 :            :    or
      13                 :            : 
      14                 :            :      * the GNU General Public License as published by the Free
      15                 :            :        Software Foundation; either version 2 of the License, or (at
      16                 :            :        your option) any later version
      17                 :            : 
      18                 :            :    or both in parallel, as here.
      19                 :            : 
      20                 :            :    elfutils is distributed in the hope that it will be useful, but
      21                 :            :    WITHOUT ANY WARRANTY; without even the implied warranty of
      22                 :            :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      23                 :            :    General Public License for more details.
      24                 :            : 
      25                 :            :    You should have received copies of the GNU General Public License and
      26                 :            :    the GNU Lesser General Public License along with this program.  If
      27                 :            :    not, see <http://www.gnu.org/licenses/>.  */
      28                 :            : 
      29                 :            : #ifdef HAVE_CONFIG_H
      30                 :            : # include <config.h>
      31                 :            : #endif
      32                 :            : 
      33                 :            : #include <dwarf.h>
      34                 :            : 
      35                 :            : #define BACKEND aarch64_
      36                 :            : #include "libebl_CPU.h"
      37                 :            : 
      38                 :            : 
      39                 :            : /* ABI-specified state of DWARF CFI based on:
      40                 :            : 
      41                 :            :    "DWARF for the ARM 64 bit architecture (AArch64) 1.0"
      42                 :            : http://infocenter.arm.com/help/topic/com.arm.doc.ihi0057b/IHI0057B_aadwarf64.pdf
      43                 :            : 
      44                 :            :    "Procedure Call Standard for the ARM 64 bit Architecture 1.0"
      45                 :            : http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055b/IHI0055B_aapcs64.pdf
      46                 :            : */
      47                 :            : 
      48                 :            : int
      49                 :          8 : aarch64_abi_cfi (Ebl *ebl __attribute__ ((unused)), Dwarf_CIE *abi_info)
      50                 :            : {
      51                 :          8 :   static const uint8_t abi_cfi[] =
      52                 :            :     {
      53                 :            :       /* The initial Canonical Frame Address is the value of the
      54                 :            :          Stack Pointer (r31) as setup in the previous frame. */
      55                 :            :       DW_CFA_def_cfa, ULEB128_7 (30), ULEB128_7 (0),
      56                 :            : 
      57                 :            : #define SV(n) DW_CFA_same_value, ULEB128_7 (n)
      58                 :            :       /* Callee-saved regs r19-r28.  */
      59                 :            :       SV (19), SV (20), SV (21), SV (22), SV (23),
      60                 :            :       SV (24), SV (25), SV (26), SV (27), SV (28),
      61                 :            : 
      62                 :            :       /* The Frame Pointer (FP, r29) and Link Register (LR, r30).  */
      63                 :            :       SV (29), SV (30),
      64                 :            : 
      65                 :            :       /* The Stack Pointer (r31) is restored from CFA address by default.  */
      66                 :            :       DW_CFA_val_offset, ULEB128_7 (31), ULEB128_7 (0),
      67                 :            : 
      68                 :            :       /* Callee-saved fpregs v8-v15.  v0 == 64.  */
      69                 :            :       SV (72), SV (73), SV (74), SV (75),
      70                 :            :       SV (76), SV (77), SV (78), SV (79),
      71                 :            : #undef SV
      72                 :            : 
      73                 :            :       /* XXX Note: registers intentionally unused by the program,
      74                 :            :          for example as a consequence of the procedure call standard
      75                 :            :          should be initialized as if by DW_CFA_same_value.  */
      76                 :            :     };
      77                 :            : 
      78                 :          8 :   abi_info->initial_instructions = abi_cfi;
      79                 :          8 :   abi_info->initial_instructions_end = &abi_cfi[sizeof abi_cfi];
      80                 :          8 :   abi_info->data_alignment_factor = -4;
      81                 :            : 
      82                 :          8 :   abi_info->return_address_register = 30; /* lr.  */
      83                 :            : 
      84                 :          8 :   return 0;
      85                 :            : }

Generated by: LCOV version 1.13