• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 /*---------------------------------------------------------------*/
3 /*--- begin                             libvex_guest_mips64.h ---*/
4 /*---------------------------------------------------------------*/
5 
6 /*
7    This file is part of Valgrind, a dynamic binary instrumentation
8    framework.
9 
10    Copyright (C) 2010-2017 RT-RK
11       mips-valgrind@rt-rk.com
12 
13    This program is free software; you can redistribute it and/or
14    modify it under the terms of the GNU General Public License as
15    published by the Free Software Foundation; either version 2 of the
16    License, or (at your option) any later version.
17 
18    This program is distributed in the hope that it will be useful, but
19    WITHOUT ANY WARRANTY; without even the implied warranty of
20    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21    General Public License for more details.
22 
23    You should have received a copy of the GNU General Public License
24    along with this program; if not, write to the Free Software
25    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26    02110-1301, USA.
27 
28    The GNU General Public License is contained in the file COPYING.
29 
30    Neither the names of the U.S. Department of Energy nor the
31    University of California nor the names of its contributors may be
32    used to endorse or promote products derived from this software
33    without prior written permission.
34 */
35 
36 #ifndef __LIBVEX_PUB_GUEST_MIPS64_H
37 #define __LIBVEX_PUB_GUEST_MIPS64_H
38 
39 #include "libvex_basictypes.h"
40 #include "libvex_emnote.h"
41 
42 
43 /*---------------------------------------------------------------*/
44 /*--- Vex's representation of the MIPS64 CPU state.           ---*/
45 /*---------------------------------------------------------------*/
46 
47 typedef
48    struct {
49       /*    0 */ ULong host_EvC_FAILADDR;
50       /*    8 */ UInt host_EvC_COUNTER;
51       /*   12 */ UInt _padding1;
52 
53       /* CPU Registers */
54       /*   16 */ ULong guest_r0;   /* Hardwired to 0. */
55       /*   24 */ ULong guest_r1;   /* Assembler temporary */
56       /*   32 */ ULong guest_r2;   /* Values for function returns ...*/
57       /*   40 */ ULong guest_r3;   /* ... and expression evaluation */
58       /*   48 */ ULong guest_r4;   /* Function arguments */
59       /*   56 */ ULong guest_r5;
60       /*   64 */ ULong guest_r6;
61       /*   72 */ ULong guest_r7;
62       /*   80 */ ULong guest_r8;
63       /*   88 */ ULong guest_r9;
64       /*   96 */ ULong guest_r10;
65       /*  104 */ ULong guest_r11;
66       /*  112 */ ULong guest_r12;  /* Temporaries */
67       /*  120 */ ULong guest_r13;
68       /*  128 */ ULong guest_r14;
69       /*  136 */ ULong guest_r15;
70       /*  144 */ ULong guest_r16;  /* Saved temporaries */
71       /*  152 */ ULong guest_r17;
72       /*  160 */ ULong guest_r18;
73       /*  168 */ ULong guest_r19;
74       /*  176 */ ULong guest_r20;
75       /*  184 */ ULong guest_r21;
76       /*  192 */ ULong guest_r22;
77       /*  200 */ ULong guest_r23;
78       /*  208 */ ULong guest_r24;  /* Temporaries */
79       /*  216 */ ULong guest_r25;
80       /*  224 */ ULong guest_r26;  /* Reserved for OS kernel */
81       /*  232 */ ULong guest_r27;
82       /*  240 */ ULong guest_r28;  /* Global pointer */
83       /*  248 */ ULong guest_r29;  /* Stack pointer */
84       /*  256 */ ULong guest_r30;  /* Frame pointer */
85       /*  264 */ ULong guest_r31;  /* Return address */
86       /*  272 */ ULong guest_PC;   /* Program counter */
87       /*  280 */ ULong guest_HI;   /* Multiply and divide reg higher result */
88       /*  288 */ ULong guest_LO;   /* Multiply and divide reg lower result */
89 
90       /* FPU Registers */
91       /*  296 */ ULong guest_f0;   /* Floating point gen. purpose registers */
92       /*  304 */ ULong guest_f1;
93       /*  312 */ ULong guest_f2;
94       /*  320 */ ULong guest_f3;
95       /*  328 */ ULong guest_f4;
96       /*  336 */ ULong guest_f5;
97       /*  344 */ ULong guest_f6;
98       /*  352 */ ULong guest_f7;
99       /*  360 */ ULong guest_f8;
100       /*  368 */ ULong guest_f9;
101       /*  376 */ ULong guest_f10;
102       /*  384 */ ULong guest_f11;
103       /*  392 */ ULong guest_f12;
104       /*  400 */ ULong guest_f13;
105       /*  408 */ ULong guest_f14;
106       /*  416 */ ULong guest_f15;
107       /*  424 */ ULong guest_f16;
108       /*  432 */ ULong guest_f17;
109       /*  440 */ ULong guest_f18;
110       /*  448 */ ULong guest_f19;
111       /*  456 */ ULong guest_f20;
112       /*  464 */ ULong guest_f21;
113       /*  472 */ ULong guest_f22;
114       /*  480 */ ULong guest_f23;
115       /*  488 */ ULong guest_f24;
116       /*  496 */ ULong guest_f25;
117       /*  504 */ ULong guest_f26;
118       /*  512 */ ULong guest_f27;
119       /*  520 */ ULong guest_f28;
120       /*  528 */ ULong guest_f29;
121       /*  536 */ ULong guest_f30;
122       /*  544 */ ULong guest_f31;
123 
124       /*  552 */ UInt guest_FIR;
125       /*  556 */ UInt guest_FCCR;
126       /*  560 */ UInt guest_FEXR;
127       /*  564 */ UInt guest_FENR;
128       /*  568 */ UInt guest_FCSR;
129       /*  572 */ UInt guest_CP0_status;
130 
131       /* TLS pointer for the thread. It's read-only in user space. On Linux it
132          is set in user space by various thread-related syscalls.
133          User Local Register.
134          This register provides read access to the coprocessor 0
135          UserLocal register, if it is implemented. In some operating
136          environments, the UserLocal register is a pointer to a thread-specific
137          storage block.
138       */
139       /*  576 */ ULong guest_ULR;
140 
141       /* Emulation notes */
142       /*  584 */ UInt guest_EMNOTE;
143       /*  588 */ UInt guest_COND;
144 
145       /* For clflush: record start and length of area to invalidate */
146       /*  592 */ ULong guest_CMSTART;
147       /*  600 */ ULong guest_CMLEN;
148 
149       /*  608 */ ULong guest_NRADDR;
150 
151       /*  616 */ ULong guest_LLaddr;
152       /*  624 */ ULong guest_LLdata;
153 
154       /*  632 */ ULong _padding2;
155 } VexGuestMIPS64State;
156 
157 /*---------------------------------------------------------------*/
158 /*--- Utility functions for MIPS64 guest stuff.               ---*/
159 /*---------------------------------------------------------------*/
160 
161 /* ALL THE FOLLOWING ARE VISIBLE TO LIBRARY CLIENT. */
162 
163 /* Initialise all guest MIPS64 state. */
164 
165 extern
166 void LibVEX_GuestMIPS64_initialise ( /*OUT*/VexGuestMIPS64State* vex_state );
167 
168 /* FR bit of CP0_STATUS_FR register */
169 #define MIPS_CP0_STATUS_FR (1ul << 26)
170 
171 #endif /* ndef __LIBVEX_PUB_GUEST_MIPS64_H */
172 
173 /*---------------------------------------------------------------*/
174 /*---                                   libvex_guest_mips64.h ---*/
175 /*---------------------------------------------------------------*/
176 
177