LCOV - code coverage report
Current view: top level - backends - aarch64_regs.c (source / functions) Coverage Total Hit
Test: elfutils-0.193 Lines: 92.6 % 27 25
Test Date: 2025-08-30 14:31:09 Functions: 100.0 % 2 2
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
Branches: 73.3 % 15 11

             Branch data     Line data    Source code
       1                 :             : /* Register names and numbers for AArch64 DWARF.
       2                 :             :    Copyright (C) 2013, 2014 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 <stdio.h>
      34                 :             : #include <string.h>
      35                 :             : #include <dwarf.h>
      36                 :             : #include <stdarg.h>
      37                 :             : 
      38                 :             : #define BACKEND aarch64_
      39                 :             : #include "libebl_CPU.h"
      40                 :             : 
      41                 :             : __attribute__ ((format (printf, 7, 8)))
      42                 :             : static ssize_t
      43                 :         622 : do_regtype (const char *setname, int type,
      44                 :             :            const char **setnamep, int *typep,
      45                 :             :            char *name, size_t namelen, const char *fmt, ...)
      46                 :             : {
      47                 :         622 :   *setnamep = setname;
      48                 :         622 :   *typep = type;
      49                 :             : 
      50                 :         622 :   va_list ap;
      51                 :         622 :   va_start (ap, fmt);
      52         [ +  - ]:         622 :   int s = vsnprintf (name, namelen, fmt, ap);
      53                 :         622 :   va_end(ap);
      54                 :             : 
      55   [ +  -  +  - ]:         622 :   if (s < 0 || (unsigned) s >= namelen)
      56                 :             :     return -1;
      57                 :         622 :   return s + 1;
      58                 :             : }
      59                 :             : 
      60                 :             : ssize_t
      61                 :         878 : aarch64_register_info (Ebl *ebl __attribute__ ((unused)),
      62                 :             :                        int regno, char *name, size_t namelen,
      63                 :             :                        const char **prefix, const char **setnamep,
      64                 :             :                        int *bits, int *typep)
      65                 :             : {
      66         [ +  + ]:         878 :   if (name == NULL)
      67                 :             :     return 128;
      68                 :             : 
      69                 :             : 
      70                 :         870 :   *prefix = "";
      71                 :         870 :   *bits = 64;
      72                 :             : 
      73                 :             : #define regtype(setname, type, ...) \
      74                 :             :     do_regtype(setname, type, setnamep, typep, name, namelen, __VA_ARGS__)
      75                 :             : 
      76   [ +  +  +  +  :         870 :   switch (regno)
                +  -  + ]
      77                 :             :     {
      78                 :         332 :     case 0 ... 30:
      79                 :         332 :       return regtype ("integer", DW_ATE_signed, "x%d", regno);
      80                 :             : 
      81                 :          26 :     case 31:
      82                 :          26 :       return regtype ("integer", DW_ATE_address, "sp");
      83                 :             : 
      84                 :             :     case 32:
      85                 :             :       return 0;
      86                 :             : 
      87                 :           4 :     case 33:
      88                 :           4 :       return regtype ("integer", DW_ATE_address, "elr");
      89                 :             : 
      90                 :           4 :     case 34:
      91                 :           4 :       return regtype ("integer", DW_ATE_unsigned, "ra_sign_state");
      92                 :             : 
      93                 :             :     case 35 ... 63:
      94                 :             :       return 0;
      95                 :             : 
      96                 :         256 :     case 64 ... 95:
      97                 :             :       /* FP/SIMD register file supports a variety of data types--it
      98                 :             :          can be thought of as a register holding a single integer or
      99                 :             :          floating-point value, or a vector of 8-, 16-, 32- or 64-bit
     100                 :             :          integers.  128-bit quad-word is the only singular value that
     101                 :             :          covers the whole register, so mark the register thus.  */
     102                 :         256 :       *bits = 128;
     103                 :         256 :       return regtype ("FP/SIMD", DW_ATE_unsigned, "v%d", regno - 64);
     104                 :             : 
     105                 :             :     case 96 ... 127:
     106                 :             :       return 0;
     107                 :             : 
     108                 :           0 :     default:
     109                 :           0 :       return -1;
     110                 :             :     }
     111                 :             : }
        

Generated by: LCOV version 2.0-1