LCOV - code coverage report
Current view: top level - backends - arm_cfi.c (source / functions) Hit Total Coverage
Test: elfutils-0.189 Lines: 7 7 100.0 %
Date: 2023-06-17 01:14:47 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                 :            : /* arm ABI-specified defaults for DWARF CFI.
       2                 :            :    Copyright (C) 2013 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 arm_
      36                 :            : #include "libebl_CPU.h"
      37                 :            : 
      38                 :            : 
      39                 :            : /* ABI-specified state of DWARF CFI based on:
      40                 :            : 
      41                 :            :    "DWARF for the ARM Architecture ABI r2.09"
      42                 :            : http://infocenter.arm.com/help/topic/com.arm.doc.ihi0040b/IHI0040B_aadwarf.pdf
      43                 :            : 
      44                 :            :    "Procedure Call Standard for the ARM Architecture ABI r2.09"
      45                 :            : http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042e/IHI0042E_aapcs.pdf
      46                 :            : */
      47                 :            : 
      48                 :            : int
      49                 :          2 : arm_abi_cfi (Ebl *ebl __attribute__ ((unused)), Dwarf_CIE *abi_info)
      50                 :            : {
      51                 :          2 :   static const uint8_t abi_cfi[] =
      52                 :            :     {
      53                 :            :       /* The initial Canonical Frame Address is the value of the
      54                 :            :          Stack Pointer (r13) as setup in the previous frame. */
      55                 :            :       DW_CFA_def_cfa, ULEB128_7 (13), ULEB128_7 (0),
      56                 :            : 
      57                 :            :       /* The Stack Pointer (r13) is restored from CFA address by default.  */
      58                 :            :       DW_CFA_val_offset, ULEB128_7 (13), ULEB128_7 (0),
      59                 :            : 
      60                 :            : #define SV(n) DW_CFA_same_value, ULEB128_7 (n)
      61                 :            :       /* Callee-saved regs r4-r8, r10, r11.  */
      62                 :            :       SV (4), SV (5), SV (6), SV (7), SV (8), SV (10), SV (11),
      63                 :            : 
      64                 :            :       /* The link register contains the return address setup by caller.  */
      65                 :            :       SV (14),
      66                 :            :       DW_CFA_register, ULEB128_7 (15), ULEB128_7 (14), /* pc = lr */
      67                 :            : #undef SV
      68                 :            : 
      69                 :            :       /* VFP S16-S31/D8-D15/Q4-Q7 are callee saved.
      70                 :            :          And uleb128 encoded with two bytes.  */
      71                 :            : #define ULEB128_8_2(x) ((x & 0x7f) | 0x80), 0x02
      72                 :            : #define SV(n) DW_CFA_same_value, ULEB128_8_2 (n)
      73                 :            :       SV (264), SV (265), SV (266), SV (267),
      74                 :            :       SV (268), SV (269), SV (270), SV (271),
      75                 :            : 
      76                 :            :       /* XXX Note: registers intentionally unused by the program,
      77                 :            :          for example as a consequence of the procedure call standard
      78                 :            :          should be initialized as if by DW_CFA_same_value.  */
      79                 :            :     };
      80                 :            : #undef ULEB128_8_2
      81                 :            : #undef SV
      82                 :            : 
      83                 :          2 :   abi_info->initial_instructions = abi_cfi;
      84                 :          2 :   abi_info->initial_instructions_end = &abi_cfi[sizeof abi_cfi];
      85                 :          2 :   abi_info->data_alignment_factor = 4;
      86                 :            : 
      87                 :          2 :   abi_info->return_address_register = 15; /* pc.  */
      88                 :            : 
      89                 :          2 :   return 0;
      90                 :            : }

Generated by: LCOV version 1.16