1 
2 /*---------------------------------------------------------------*/
3 /*--- begin                             libvex_guest_mips32.h ---*/
4 /*---------------------------------------------------------------*/
5 
6 /*
7    This file is part of Valgrind, a dynamic binary instrumentation
8    framework.
9 
10    Copyright (C) 2010-2015 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., 59 Temple Place, Suite 330, Boston, MA
26    02111-1307, USA.
27 
28    The GNU General Public License is contained in the file COPYING.
29 */
30 
31 #ifndef __LIBVEX_PUB_GUEST_MIPS32_H
32 #define __LIBVEX_PUB_GUEST_MIPS32_H
33 
34 #include "libvex_basictypes.h"
35 
36 
37 /*---------------------------------------------------------------*/
38 /*--- Vex's representation of the MIPS32 CPU state.           ---*/
39 /*---------------------------------------------------------------*/
40 
41 typedef
42    struct {
43       /* CPU Registers */
44       /* 0 */ UInt guest_r0;   /* Hardwired to 0 */
45       /* 4 */ UInt guest_r1;   /* Assembler temporary */
46       /* 8 */ UInt guest_r2;   /* Values for function returns ...*/
47       /* 12 */ UInt guest_r3;  /* ...and expression evaluation */
48       /* 16 */ UInt guest_r4;  /* Function arguments */
49       /* 20 */ UInt guest_r5;
50       /* 24 */ UInt guest_r6;
51       /* 28 */ UInt guest_r7;
52       /* 32 */ UInt guest_r8;  /* Temporaries */
53       /* 36 */ UInt guest_r9;
54       /* 40 */ UInt guest_r10;
55       /* 44 */ UInt guest_r11;
56       /* 48 */ UInt guest_r12;
57       /* 52 */ UInt guest_r13;
58       /* 56 */ UInt guest_r14;
59       /* 60 */ UInt guest_r15;
60       /* 64 */ UInt guest_r16;  /* Saved temporaries */
61       /* 68 */ UInt guest_r17;
62       /* 72 */ UInt guest_r18;
63       /* 76 */ UInt guest_r19;
64       /* 80 */ UInt guest_r20;
65       /* 84 */ UInt guest_r21;
66       /* 88 */ UInt guest_r22;
67       /* 92 */ UInt guest_r23;
68       /* 96 */ UInt guest_r24;  /* Temporaries */
69       /* 100 */ UInt guest_r25;
70       /* 104 */ UInt guest_r26;  /* Reserved for OS kernel */
71       /* 108 */ UInt guest_r27;
72       /* 112 */ UInt guest_r28;  /* Global pointer */
73       /* 116 */ UInt guest_r29;  /* Stack pointer */
74       /* 120 */ UInt guest_r30;  /* Frame pointer */
75       /* 124 */ UInt guest_r31;  /* Return address */
76       /* 128 */ UInt guest_PC;  /* Program counter */
77       /* 132 */ UInt guest_HI;  /* Multiply and divide register higher result */
78       /* 136 */ UInt guest_LO;  /* Multiply and divide register lower result */
79 
80       /* FPU Registers */
81       /* 144 */ ULong guest_f0;  /* Floating point general purpose registers */
82       /* 152 */ ULong guest_f1;
83       /* 160 */ ULong guest_f2;
84       /* 168 */ ULong guest_f3;
85       /* 176 */ ULong guest_f4;
86       /* 184 */ ULong guest_f5;
87       /* 192 */ ULong guest_f6;
88       /* 200 */ ULong guest_f7;
89       /* 208 */ ULong guest_f8;
90       /* 216 */ ULong guest_f9;
91       /* 224 */ ULong guest_f10;
92       /* 232 */ ULong guest_f11;
93       /* 240 */ ULong guest_f12;
94       /* 248 */ ULong guest_f13;
95       /* 256 */ ULong guest_f14;
96       /* 264 */ ULong guest_f15;
97       /* 272 */ ULong guest_f16;
98       /* 280 */ ULong guest_f17;
99       /* 288 */ ULong guest_f18;
100       /* 296 */ ULong guest_f19;
101       /* 304 */ ULong guest_f20;
102       /* 312 */ ULong guest_f21;
103       /* 320 */ ULong guest_f22;
104       /* 328 */ ULong guest_f23;
105       /* 336 */ ULong guest_f24;
106       /* 344 */ ULong guest_f25;
107       /* 352 */ ULong guest_f26;
108       /* 360 */ ULong guest_f27;
109       /* 368 */ ULong guest_f28;
110       /* 376 */ ULong guest_f29;
111       /* 384 */ ULong guest_f30;
112       /* 392 */ ULong guest_f31;
113 
114       /* 400 */ UInt guest_FIR;
115       /* 404 */ UInt guest_FCCR;
116       /* 408 */ UInt guest_FEXR;
117       /* 412 */ UInt guest_FENR;
118       /* 416 */ UInt guest_FCSR;
119 
120       /* TLS pointer for the thread. It's read-only in user space.
121          On Linux it is set in user space by various thread-related
122          syscalls.
123          User Local Register.
124          This register provides read access to the coprocessor 0
125          UserLocal register, if it is implemented. In some operating
126          environments, the UserLocal register is a pointer to a
127          thread-specific storage block.
128       */
129       /* 420 */ UInt guest_ULR;
130 
131       /* Emulation notes */
132       /* 424 */ UInt guest_EMNOTE;
133 
134       /* For clflush: record start and length of area to invalidate */
135       /* 428 */ UInt guest_CMSTART;
136       /* 432 */ UInt guest_CMLEN;
137       /* 436 */ UInt guest_NRADDR;
138 
139       /* 440 */ UInt host_EvC_FAILADDR;
140       /* 444 */ UInt host_EvC_COUNTER;
141       /* 448 */ UInt guest_COND;
142 
143       /* MIPS32 DSP ASE(r2) specific registers. */
144       /* 452 */ UInt guest_DSPControl;
145       /* 456 */ ULong guest_ac0;
146       /* 464 */ ULong guest_ac1;
147       /* 472 */ ULong guest_ac2;
148       /* 480 */ ULong guest_ac3;
149 
150         UInt padding;
151 } VexGuestMIPS32State;
152 /*---------------------------------------------------------------*/
153 /*--- Utility functions for MIPS32 guest stuff.               ---*/
154 /*---------------------------------------------------------------*/
155 
156 /* ALL THE FOLLOWING ARE VISIBLE TO LIBRARY CLIENT */
157 
158 /* Initialise all guest MIPS32 state. */
159 
160 extern
161 void LibVEX_GuestMIPS32_initialise ( /*OUT*/VexGuestMIPS32State* vex_state );
162 
163 
164 #endif /* ndef __LIBVEX_PUB_GUEST_MIPS32_H */
165 
166 
167 /*---------------------------------------------------------------*/
168 /*---                                   libvex_guest_mips32.h ---*/
169 /*---------------------------------------------------------------*/
170