LCOV - code coverage report
Current view: top level - backends - riscv_initreg.c (source / functions) Coverage Total Hit
Test: elfutils-0.193 Lines: 0.0 % 2 0
Test Date: 2025-08-30 14:31:09 Functions: 0.0 % 1 0
Legend: Lines:     hit not hit

            Line data    Source code
       1              : /* Fetch live process registers from TID.
       2              :    This file is part of elfutils.
       3              : 
       4              :    This file is free software; you can redistribute it and/or modify
       5              :    it under the terms of either
       6              : 
       7              :      * the GNU Lesser General Public License as published by the Free
       8              :        Software Foundation; either version 3 of the License, or (at
       9              :        your option) any later version
      10              : 
      11              :    or
      12              : 
      13              :      * the GNU General Public License as published by the Free
      14              :        Software Foundation; either version 2 of the License, or (at
      15              :        your option) any later version
      16              : 
      17              :    or both in parallel, as here.
      18              : 
      19              :    elfutils is distributed in the hope that it will be useful, but
      20              :    WITHOUT ANY WARRANTY; without even the implied warranty of
      21              :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      22              :    General Public License for more details.
      23              : 
      24              :    You should have received copies of the GNU General Public License and
      25              :    the GNU Lesser General Public License along with this program.  If
      26              :    not, see <http://www.gnu.org/licenses/>.  */
      27              : 
      28              : #ifdef HAVE_CONFIG_H
      29              : # include <config.h>
      30              : #endif
      31              : 
      32              : #include "system.h"
      33              : #include <assert.h>
      34              : #if defined __riscv && defined __linux__
      35              : # include <sys/uio.h>
      36              : # include <sys/procfs.h>
      37              : # include <sys/ptrace.h>
      38              : #endif
      39              : 
      40              : #define BACKEND riscv_
      41              : #include "libebl_CPU.h"
      42              : 
      43              : bool
      44            0 : riscv_set_initial_registers_tid (pid_t tid __attribute__ ((unused)),
      45              :                                  ebl_tid_registers_t *setfunc __attribute__ ((unused)),
      46              :                                  void *arg __attribute__ ((unused)))
      47              : {
      48              : #if !defined __riscv || !defined __linux__
      49            0 :   return false;
      50              : #else /* __riscv */
      51              : 
      52              :   /* General registers.  */
      53              :   elf_gregset_t gregs;
      54              :   struct iovec iovec;
      55              :   iovec.iov_base = &gregs;
      56              :   iovec.iov_len = sizeof (gregs);
      57              :   if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, &iovec) != 0)
      58              :     return false;
      59              : 
      60              :   /* X0 is constant 0.  */
      61              :   Dwarf_Word zero = 0;
      62              :   if (! setfunc (0, 1, &zero, arg))
      63              :     return false;
      64              : 
      65              :   /* X1..X31.  */
      66              :   if (! setfunc (1, 32, (Dwarf_Word *) &gregs[1], arg))
      67              :     return false;
      68              : 
      69              :   /* PC.  */
      70              :   if (! setfunc (-1, 1, (Dwarf_Word *) &gregs[0], arg))
      71              :     return false;
      72              : 
      73              :   /* FP registers not yet supported.  */
      74              : 
      75              :   return true;
      76              : #endif /* __riscv */
      77              : }
        

Generated by: LCOV version 2.0-1