1 2 /*---------------------------------------------------------------*/ 3 /*--- begin libvex_guest_tilegx.h ---*/ 4 /*---------------------------------------------------------------*/ 5 6 /* 7 This file is part of Valgrind, a dynamic binary instrumentation 8 framework. 9 10 Copyright (C) 2010-2013 Tilera Corp. 11 12 This program is free software; you can redistribute it and/or 13 modify it under the terms of the GNU General Public License as 14 published by the Free Software Foundation; either version 2 of the 15 License, or (at your option) any later version. 16 17 This program is distributed in the hope that it will be useful, but 18 WITHOUT ANY WARRANTY; without even the implied warranty of 19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 General Public License for more details. 21 22 You should have received a copy of the GNU General Public License 23 along with this program; if not, write to the Free Software 24 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 25 02111-1307, USA. 26 27 The GNU General Public License is contained in the file COPYING. 28 */ 29 30 /* Contributed by Zhi-Gang Liu <zliu at tilera dot com> */ 31 32 #ifndef __LIBVEX_PUB_GUEST_TILEGX_H 33 #define __LIBVEX_PUB_GUEST_TILEGX_H 34 35 #include "libvex_basictypes.h" 36 #include "libvex_emnote.h" 37 38 #undef TILEGX_DEBUG 39 40 /*---------------------------------------------------------------*/ 41 /*--- Vex's representation of the tilegx CPU state. ---*/ 42 /*---------------------------------------------------------------*/ 43 44 typedef ULong ULONG; 45 46 typedef 47 struct { 48 /* CPU Registers */ 49 /* 0 */ ULONG guest_r0; 50 /* 8 */ ULONG guest_r1; 51 /* 16 */ ULONG guest_r2; 52 /* 24 */ ULONG guest_r3; 53 /* 32 */ ULONG guest_r4; 54 /* 40 */ ULONG guest_r5; 55 /* 48 */ ULONG guest_r6; 56 /* 56 */ ULONG guest_r7; 57 /* 64 */ ULONG guest_r8; 58 /* 72 */ ULONG guest_r9; 59 /* 80 */ ULONG guest_r10; 60 /* 88 */ ULONG guest_r11; 61 /* 96 */ ULONG guest_r12; 62 /* 104 */ ULONG guest_r13; 63 /* 112 */ ULONG guest_r14; 64 /* 120 */ ULONG guest_r15; 65 /* 128 */ ULONG guest_r16; 66 /* 136 */ ULONG guest_r17; 67 /* 144 */ ULONG guest_r18; 68 /* 152 */ ULONG guest_r19; 69 /* 160 */ ULONG guest_r20; 70 /* 168 */ ULONG guest_r21; 71 /* 176 */ ULONG guest_r22; 72 /* 184 */ ULONG guest_r23; 73 /* 192 */ ULONG guest_r24; 74 /* 200 */ ULONG guest_r25; 75 /* 208 */ ULONG guest_r26; 76 /* 216 */ ULONG guest_r27; 77 /* 224 */ ULONG guest_r28; 78 /* 232 */ ULONG guest_r29; 79 /* 240 */ ULONG guest_r30; 80 /* 248 */ ULONG guest_r31; 81 /* 256 */ ULONG guest_r32; 82 /* 264 */ ULONG guest_r33; 83 /* 272 */ ULONG guest_r34; 84 /* 280 */ ULONG guest_r35; 85 /* 288 */ ULONG guest_r36; 86 /* 296 */ ULONG guest_r37; 87 /* 304 */ ULONG guest_r38; 88 /* 312 */ ULONG guest_r39; 89 /* 320 */ ULONG guest_r40; 90 /* 328 */ ULONG guest_r41; 91 /* 336 */ ULONG guest_r42; 92 /* 344 */ ULONG guest_r43; 93 /* 352 */ ULONG guest_r44; 94 /* 360 */ ULONG guest_r45; 95 /* 368 */ ULONG guest_r46; 96 /* 376 */ ULONG guest_r47; 97 /* 384 */ ULONG guest_r48; 98 /* 392 */ ULONG guest_r49; 99 /* 400 */ ULONG guest_r50; 100 /* 408 */ ULONG guest_r51; 101 /* 416 */ ULONG guest_r52; /* FP */ 102 /* 424 */ ULONG guest_r53; 103 /* 432 */ ULONG guest_r54; /* SP */ 104 /* 440 */ ULONG guest_r55; /* LR */ 105 /* 448 */ ULONG guest_r56; /* zero */ 106 /* 456 */ ULONG guest_r57; /* Reserved */ 107 /* 464 */ ULONG guest_r58; /* Reserved */ 108 /* 472 */ ULONG guest_r59; /* Reserved */ 109 /* 480 */ ULONG guest_r60; /* Reserved */ 110 /* 488 */ ULONG guest_r61; /* Reserved */ 111 /* 496 */ ULONG guest_r62; /* Reserved */ 112 /* 504 */ ULONG guest_r63; /* Reserved */ 113 /* 512 */ ULONG guest_pc; 114 /* 520 */ ULONG guest_spare; /* Reserved */ 115 /* 528 */ ULONG guest_EMNOTE; 116 /* 536 */ ULONG guest_CMSTART; 117 /* 544 */ ULONG guest_CMLEN; 118 /* 552 */ ULONG guest_NRADDR; 119 /* 560 */ ULong guest_cmpexch; 120 /* 568 */ ULong guest_zero; 121 /* 576 */ ULong guest_ex_context_0; 122 /* 584 */ ULong guest_ex_context_1; 123 /* 592 */ ULong host_EvC_FAILADDR; 124 /* 600 */ ULong host_EvC_COUNTER; 125 /* 608 */ ULong guest_COND; 126 /* 616 */ ULong PAD; 127 128 } VexGuestTILEGXState; 129 130 #define OFFSET_tilegx_r(_N) (8 * (_N)) 131 132 /*---------------------------------------------------------------*/ 133 /*--- Utility functions for TILEGX guest stuff. ---*/ 134 /*---------------------------------------------------------------*/ 135 136 /* ALL THE FOLLOWING ARE VISIBLE TO LIBRARY CLIENT */ 137 138 /* Initialise all guest TILEGX state. */ 139 140 extern 141 void LibVEX_GuestTILEGX_initialise ( /*OUT*/VexGuestTILEGXState* vex_state ); 142 143 144 #endif /* __LIBVEX_PUB_GUEST_TILEGX_H */ 145 146 147 /*---------------------------------------------------------------*/ 148 /*--- libvex_guest_tilegx.h ---*/ 149 /*---------------------------------------------------------------*/ 150