Home | History | Annotate | Download | only in m_gdbserver
      1 /* Definitions of interface to the "low" (arch specific) functions
      2    needed for interfacing the Valgrind gdbserver with the Valgrind
      3    guest.
      4 
      5    Copyright (C) 2011
      6    Free Software Foundation, Inc.
      7 
      8    This file has been inspired from a file that is part of GDB.
      9    It has been modified to integrate it in valgrind
     10 
     11    This program is free software; you can redistribute it and/or modify
     12    it under the terms of the GNU General Public License as published by
     13    the Free Software Foundation; either version 2 of the License, or
     14    (at your option) any later version.
     15 
     16    This program is distributed in the hope that it will be useful,
     17    but WITHOUT ANY WARRANTY; without even the implied warranty of
     18    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     19    GNU General Public License for more details.
     20 
     21    You should have received a copy of the GNU General Public License
     22    along with this program; if not, write to the Free Software
     23    Foundation, Inc., 51 Franklin Street, Fifth Floor,
     24    Boston, MA 02110-1301, USA.  */
     25 
     26 #ifndef VALGRIND_LOW_H
     27 #define VALGRIND_LOW_H
     28 
     29 /* defines the characteristics of the "low" valgrind target architecture.
     30    In other words, struct valgrind_target_ops defines the functions and
     31    data which are specific to the architecture (x86 or amd64 or
     32    ppc32 or ...). */
     33 struct valgrind_target_ops
     34 {
     35    int num_regs;
     36    struct reg *reg_defs;
     37 
     38    int stack_pointer_regno;
     39    /* register number of the stack pointer register */
     40 
     41    /* transfer the register regno from/to valgrind (guest state)
     42       to/from buf
     43       according to transfer_direction.
     44       *mod set to True if destination content is modified by the transfer
     45       otherwise it is set to False. */
     46    void (*transfer_register) (ThreadId tid, int regno, void * buf,
     47                               transfer_direction dir, int size, Bool *mod);
     48 
     49 
     50    CORE_ADDR (*get_pc) (void);
     51    void (*set_pc) (CORE_ADDR newpc);
     52 
     53    /* What string to report to GDB when it asks for the architecture,
     54       or NULL not to answer.  */
     55    const char *arch_string;
     56 
     57    /* Returns the target xml description of the set of registers.
     58       For some architectures (e.g. arm), it is mandatory
     59       to give a description of the registers, otherwise
     60       gdb does not understand the reply to the 'g' packet
     61       (which is used to get the registers).
     62       If shadow_mode, returns a target xml description
     63       including the two shadow registers sets.
     64       This is mandatory to use the option --vgdb-shadow-registers=yes.
     65       Returns NULL if there is no target xml file*/
     66    char* (*target_xml) (Bool shadow_mode);
     67 
     68 };
     69 
     70 extern void x86_init_architecture (struct valgrind_target_ops *target);
     71 extern void amd64_init_architecture (struct valgrind_target_ops *target);
     72 extern void arm_init_architecture (struct valgrind_target_ops *target);
     73 extern void ppc32_init_architecture (struct valgrind_target_ops *target);
     74 extern void ppc64_init_architecture (struct valgrind_target_ops *target);
     75 extern void s390x_init_architecture (struct valgrind_target_ops *target);
     76 extern void mips32_init_architecture (struct valgrind_target_ops *target);
     77 
     78 #endif
     79