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, 2012 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 #include "pub_core_basics.h" // ThreadId 30 #include "server.h" // CORE_ADDR 31 32 /* defines the characteristics of the "low" valgrind target architecture. 33 In other words, struct valgrind_target_ops defines the functions and 34 data which are specific to the architecture (x86 or amd64 or 35 ppc32 or ...). */ 36 struct valgrind_target_ops 37 { 38 int num_regs; 39 struct reg *reg_defs; 40 41 int stack_pointer_regno; 42 /* register number of the stack pointer register */ 43 44 /* transfer the register regno from/to valgrind (guest state) 45 to/from buf 46 according to transfer_direction. 47 *mod set to True if destination content is modified by the transfer 48 otherwise it is set to False. */ 49 void (*transfer_register) (ThreadId tid, int regno, void * buf, 50 transfer_direction dir, int size, Bool *mod); 51 52 53 CORE_ADDR (*get_pc) (void); 54 void (*set_pc) (CORE_ADDR newpc); 55 56 /* What string to report to GDB when it asks for the architecture, 57 or NULL not to answer. */ 58 const char *arch_string; 59 60 /* Returns the target xml description of the set of registers. 61 For some architectures (e.g. arm), it is mandatory 62 to give a description of the registers, otherwise 63 gdb does not understand the reply to the 'g' packet 64 (which is used to get the registers). 65 If shadow_mode, returns a target xml description 66 including the two shadow registers sets. 67 This is mandatory to use the option --vgdb-shadow-registers=yes. 68 Returns NULL if there is no target xml file*/ 69 const char* (*target_xml) (Bool shadow_mode); 70 71 }; 72 73 extern void x86_init_architecture (struct valgrind_target_ops *target); 74 extern void amd64_init_architecture (struct valgrind_target_ops *target); 75 extern void arm_init_architecture (struct valgrind_target_ops *target); 76 extern void arm64_init_architecture (struct valgrind_target_ops *target); 77 extern void ppc32_init_architecture (struct valgrind_target_ops *target); 78 extern void ppc64_init_architecture (struct valgrind_target_ops *target); 79 extern void s390x_init_architecture (struct valgrind_target_ops *target); 80 extern void mips32_init_architecture (struct valgrind_target_ops *target); 81 extern void mips64_init_architecture (struct valgrind_target_ops *target); 82 83 #endif 84