2 /*---------------------------------------------------------------*/
3 /*--- begin libvex_guest_mips32.h ---*/
4 /*---------------------------------------------------------------*/
7 This file is part of Valgrind, a dynamic binary instrumentation
10 Copyright (C) 2010-2017 RT-RK
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.
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.
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, see <http://www.gnu.org/licenses/>.
25 The GNU General Public License is contained in the file COPYING.
28 #ifndef __LIBVEX_PUB_GUEST_MIPS32_H
29 #define __LIBVEX_PUB_GUEST_MIPS32_H
31 #include "libvex_basictypes.h"
34 /*---------------------------------------------------------------*/
35 /*--- Vex's representation of the MIPS32 CPU state. ---*/
36 /*---------------------------------------------------------------*/
40 /* 0 */ UInt host_EvC_FAILADDR
;
41 /* 4 */ UInt host_EvC_COUNTER
;
44 /* 8 */ UInt guest_r0
; /* Hardwired to 0. */
45 /* 12 */ UInt guest_r1
; /* Assembler temporary */
46 /* 16 */ UInt guest_r2
; /* Values for function returns ...*/
47 /* 20 */ UInt guest_r3
; /* ... and expression evaluation */
48 /* 24 */ UInt guest_r4
; /* Function arguments */
49 /* 28 */ UInt guest_r5
;
50 /* 32 */ UInt guest_r6
;
51 /* 36 */ UInt guest_r7
;
52 /* 40 */ UInt guest_r8
; /* Temporaries */
53 /* 44 */ UInt guest_r9
;
54 /* 48 */ UInt guest_r10
;
55 /* 52 */ UInt guest_r11
;
56 /* 56 */ UInt guest_r12
;
57 /* 60 */ UInt guest_r13
;
58 /* 64 */ UInt guest_r14
;
59 /* 68 */ UInt guest_r15
;
60 /* 72 */ UInt guest_r16
; /* Saved temporaries */
61 /* 76 */ UInt guest_r17
;
62 /* 80 */ UInt guest_r18
;
63 /* 84 */ UInt guest_r19
;
64 /* 88 */ UInt guest_r20
;
65 /* 92 */ UInt guest_r21
;
66 /* 96 */ UInt guest_r22
;
67 /* 100 */ UInt guest_r23
;
68 /* 104 */ UInt guest_r24
; /* Temporaries */
69 /* 108 */ UInt guest_r25
;
70 /* 112 */ UInt guest_r26
; /* Reserved for OS kernel */
71 /* 116 */ UInt guest_r27
;
72 /* 120 */ UInt guest_r28
; /* Global pointer */
73 /* 124 */ UInt guest_r29
; /* Stack pointer */
74 /* 128 */ UInt guest_r30
; /* Frame pointer */
75 /* 132 */ UInt guest_r31
; /* Return address */
76 /* 136 */ UInt guest_PC
; /* Program counter */
77 /* 140 */ UInt guest_HI
; /* Multiply and divide reg higher result */
78 /* 144 */ UInt guest_LO
; /* Multiply and divide reg lower result */
79 /* 148 */ UInt _padding1
;
82 /* 152 */ ULong guest_f0
; /* Floating point general purpose registers */
83 /* 160 */ ULong guest_f1
;
84 /* 168 */ ULong guest_f2
;
85 /* 176 */ ULong guest_f3
;
86 /* 184 */ ULong guest_f4
;
87 /* 192 */ ULong guest_f5
;
88 /* 200 */ ULong guest_f6
;
89 /* 208 */ ULong guest_f7
;
90 /* 216 */ ULong guest_f8
;
91 /* 224 */ ULong guest_f9
;
92 /* 232 */ ULong guest_f10
;
93 /* 240 */ ULong guest_f11
;
94 /* 248 */ ULong guest_f12
;
95 /* 256 */ ULong guest_f13
;
96 /* 264 */ ULong guest_f14
;
97 /* 272 */ ULong guest_f15
;
98 /* 280 */ ULong guest_f16
;
99 /* 288 */ ULong guest_f17
;
100 /* 296 */ ULong guest_f18
;
101 /* 304 */ ULong guest_f19
;
102 /* 312 */ ULong guest_f20
;
103 /* 320 */ ULong guest_f21
;
104 /* 328 */ ULong guest_f22
;
105 /* 336 */ ULong guest_f23
;
106 /* 344 */ ULong guest_f24
;
107 /* 352 */ ULong guest_f25
;
108 /* 360 */ ULong guest_f26
;
109 /* 368 */ ULong guest_f27
;
110 /* 376 */ ULong guest_f28
;
111 /* 384 */ ULong guest_f29
;
112 /* 392 */ ULong guest_f30
;
113 /* 400 */ ULong guest_f31
;
115 /* 408 */ UInt guest_FIR
;
116 /* 412 */ UInt guest_FCCR
;
117 /* 416 */ UInt guest_FEXR
;
118 /* 420 */ UInt guest_FENR
;
119 /* 424 */ UInt guest_FCSR
;
121 /* TLS pointer for the thread. It's read-only in user space.
122 On Linux it is set in user space by various thread-related
125 This register provides read access to the coprocessor 0
126 UserLocal register, if it is implemented. In some operating
127 environments, the UserLocal register is a pointer to a
128 thread-specific storage block.
130 /* 428 */ UInt guest_ULR
;
132 /* Emulation notes */
133 /* 432 */ UInt guest_EMNOTE
;
135 /* For clflush: record start and length of area to invalidate. */
136 /* 436 */ UInt guest_CMSTART
;
137 /* 440 */ UInt guest_CMLEN
;
138 /* 444 */ UInt guest_NRADDR
;
140 /* 448 */ UInt guest_COND
;
142 /* MIPS32 DSP ASE(r2) specific registers. */
143 /* 452 */ UInt guest_DSPControl
;
144 /* 456 */ ULong guest_ac0
;
145 /* 464 */ ULong guest_ac1
;
146 /* 472 */ ULong guest_ac2
;
147 /* 480 */ ULong guest_ac3
;
149 /* 488 */ UInt guest_CP0_status
;
150 /* 492 */ UInt guest_CP0_Config5
;
152 /* 496 */ UInt guest_LLaddr
;
153 /* 500 */ UInt guest_LLdata
;
155 /* MIPS32 MSA 128-bit vector registers */
156 /* 504 */ V128 guest_w0
;
157 /* 520 */ V128 guest_w1
;
158 /* 536 */ V128 guest_w2
;
159 /* 552 */ V128 guest_w3
;
160 /* 568 */ V128 guest_w4
;
161 /* 584 */ V128 guest_w5
;
162 /* 600 */ V128 guest_w6
;
163 /* 616 */ V128 guest_w7
;
164 /* 632 */ V128 guest_w8
;
165 /* 648 */ V128 guest_w9
;
166 /* 664 */ V128 guest_w10
;
167 /* 680 */ V128 guest_w11
;
168 /* 696 */ V128 guest_w12
;
169 /* 712 */ V128 guest_w13
;
170 /* 728 */ V128 guest_w14
;
171 /* 744 */ V128 guest_w15
;
172 /* 760 */ V128 guest_w16
;
173 /* 776 */ V128 guest_w17
;
174 /* 792 */ V128 guest_w18
;
175 /* 808 */ V128 guest_w19
;
176 /* 824 */ V128 guest_w20
;
177 /* 840 */ V128 guest_w21
;
178 /* 856 */ V128 guest_w22
;
179 /* 872 */ V128 guest_w23
;
180 /* 888 */ V128 guest_w24
;
181 /* 904 */ V128 guest_w25
;
182 /* 920 */ V128 guest_w26
;
183 /* 936 */ V128 guest_w27
;
184 /* 952 */ V128 guest_w28
;
185 /* 968 */ V128 guest_w29
;
186 /* 984 */ V128 guest_w30
;
187 /* 1000 */ V128 guest_w31
;
189 /* 1016 */ UInt guest_MSACSR
;
191 /* 1020 */ UInt _padding3
;
193 /* 1020 */ ULong guest_LLdata64
;
194 /* 1028 */ ULong _padding4
;
195 } VexGuestMIPS32State
;
196 /*---------------------------------------------------------------*/
197 /*--- Utility functions for MIPS32 guest stuff. ---*/
198 /*---------------------------------------------------------------*/
200 /* ALL THE FOLLOWING ARE VISIBLE TO LIBRARY CLIENT. */
202 /* Initialise all guest MIPS32 state. */
205 void LibVEX_GuestMIPS32_initialise ( /*OUT*/VexGuestMIPS32State
* vex_state
);
207 /* FR bit of CP0_STATUS_FR register */
208 #define MIPS_CP0_STATUS_FR (1ul << 26)
210 /* FRE bit of CP0_Config5 register */
211 #define MIPS_CONF5_FRE (1ul << 8)
213 #endif /* ndef __LIBVEX_PUB_GUEST_MIPS32_H */
216 /*---------------------------------------------------------------*/
217 /*--- libvex_guest_mips32.h ---*/
218 /*---------------------------------------------------------------*/