blob: 0ac8d30e9e3d04ca847b3a77ed2d76cf959ffd3a [file] [log] [blame]
sewardj362cf842012-06-07 08:59:53 +00001
2/*---------------------------------------------------------------*/
3/*--- begin libvex_guest_mips32.h ---*/
4/*---------------------------------------------------------------*/
5
6/*
7 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
9
Elliott Hughesed398002017-06-21 14:41:24 -070010 Copyright (C) 2010-2017 RT-RK
sewardj362cf842012-06-07 08:59:53 +000011 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"
sewardj362cf842012-06-07 08:59:53 +000035
36
37/*---------------------------------------------------------------*/
38/*--- Vex's representation of the MIPS32 CPU state. ---*/
39/*---------------------------------------------------------------*/
40
41typedef
42 struct {
Elliott Hughesed398002017-06-21 14:41:24 -070043 /* 0 */ UInt host_EvC_FAILADDR;
44 /* 4 */ UInt host_EvC_COUNTER;
45
sewardj362cf842012-06-07 08:59:53 +000046 /* CPU Registers */
Elliott Hughesed398002017-06-21 14:41:24 -070047 /* 8 */ UInt guest_r0; /* Hardwired to 0. */
48 /* 12 */ UInt guest_r1; /* Assembler temporary */
49 /* 16 */ UInt guest_r2; /* Values for function returns ...*/
50 /* 20 */ UInt guest_r3; /* ... and expression evaluation */
51 /* 24 */ UInt guest_r4; /* Function arguments */
52 /* 28 */ UInt guest_r5;
53 /* 32 */ UInt guest_r6;
54 /* 36 */ UInt guest_r7;
55 /* 40 */ UInt guest_r8; /* Temporaries */
56 /* 44 */ UInt guest_r9;
57 /* 48 */ UInt guest_r10;
58 /* 52 */ UInt guest_r11;
59 /* 56 */ UInt guest_r12;
60 /* 60 */ UInt guest_r13;
61 /* 64 */ UInt guest_r14;
62 /* 68 */ UInt guest_r15;
63 /* 72 */ UInt guest_r16; /* Saved temporaries */
64 /* 76 */ UInt guest_r17;
65 /* 80 */ UInt guest_r18;
66 /* 84 */ UInt guest_r19;
67 /* 88 */ UInt guest_r20;
68 /* 92 */ UInt guest_r21;
69 /* 96 */ UInt guest_r22;
70 /* 100 */ UInt guest_r23;
71 /* 104 */ UInt guest_r24; /* Temporaries */
72 /* 108 */ UInt guest_r25;
73 /* 112 */ UInt guest_r26; /* Reserved for OS kernel */
74 /* 116 */ UInt guest_r27;
75 /* 120 */ UInt guest_r28; /* Global pointer */
76 /* 124 */ UInt guest_r29; /* Stack pointer */
77 /* 128 */ UInt guest_r30; /* Frame pointer */
78 /* 132 */ UInt guest_r31; /* Return address */
79 /* 136 */ UInt guest_PC; /* Program counter */
80 /* 140 */ UInt guest_HI; /* Multiply and divide reg higher result */
81 /* 144 */ UInt guest_LO; /* Multiply and divide reg lower result */
82 /* 148 */ UInt _padding1;
sewardj362cf842012-06-07 08:59:53 +000083
84 /* FPU Registers */
Elliott Hughesed398002017-06-21 14:41:24 -070085 /* 152 */ ULong guest_f0; /* Floating point general purpose registers */
86 /* 160 */ ULong guest_f1;
87 /* 168 */ ULong guest_f2;
88 /* 176 */ ULong guest_f3;
89 /* 184 */ ULong guest_f4;
90 /* 192 */ ULong guest_f5;
91 /* 200 */ ULong guest_f6;
92 /* 208 */ ULong guest_f7;
93 /* 216 */ ULong guest_f8;
94 /* 224 */ ULong guest_f9;
95 /* 232 */ ULong guest_f10;
96 /* 240 */ ULong guest_f11;
97 /* 248 */ ULong guest_f12;
98 /* 256 */ ULong guest_f13;
99 /* 264 */ ULong guest_f14;
100 /* 272 */ ULong guest_f15;
101 /* 280 */ ULong guest_f16;
102 /* 288 */ ULong guest_f17;
103 /* 296 */ ULong guest_f18;
104 /* 304 */ ULong guest_f19;
105 /* 312 */ ULong guest_f20;
106 /* 320 */ ULong guest_f21;
107 /* 328 */ ULong guest_f22;
108 /* 336 */ ULong guest_f23;
109 /* 344 */ ULong guest_f24;
110 /* 352 */ ULong guest_f25;
111 /* 360 */ ULong guest_f26;
112 /* 368 */ ULong guest_f27;
113 /* 376 */ ULong guest_f28;
114 /* 384 */ ULong guest_f29;
115 /* 392 */ ULong guest_f30;
116 /* 400 */ ULong guest_f31;
dejanj0e006f22014-02-19 11:56:29 +0000117
Elliott Hughesed398002017-06-21 14:41:24 -0700118 /* 408 */ UInt guest_FIR;
119 /* 412 */ UInt guest_FCCR;
120 /* 416 */ UInt guest_FEXR;
121 /* 420 */ UInt guest_FENR;
122 /* 424 */ UInt guest_FCSR;
sewardj362cf842012-06-07 08:59:53 +0000123
124 /* TLS pointer for the thread. It's read-only in user space.
125 On Linux it is set in user space by various thread-related
126 syscalls.
127 User Local Register.
128 This register provides read access to the coprocessor 0
129 UserLocal register, if it is implemented. In some operating
130 environments, the UserLocal register is a pointer to a
131 thread-specific storage block.
132 */
Elliott Hughesed398002017-06-21 14:41:24 -0700133 /* 428 */ UInt guest_ULR;
sewardj362cf842012-06-07 08:59:53 +0000134
florian6ef84be2012-08-26 03:20:07 +0000135 /* Emulation notes */
Elliott Hughesed398002017-06-21 14:41:24 -0700136 /* 432 */ UInt guest_EMNOTE;
sewardj362cf842012-06-07 08:59:53 +0000137
Elliott Hughesed398002017-06-21 14:41:24 -0700138 /* For clflush: record start and length of area to invalidate. */
139 /* 436 */ UInt guest_CMSTART;
140 /* 440 */ UInt guest_CMLEN;
141 /* 444 */ UInt guest_NRADDR;
sewardj362cf842012-06-07 08:59:53 +0000142
Elliott Hughesed398002017-06-21 14:41:24 -0700143 /* 448 */ UInt guest_COND;
dejanjc3fee0d2013-07-25 09:08:03 +0000144
dejanjc3fee0d2013-07-25 09:08:03 +0000145 /* MIPS32 DSP ASE(r2) specific registers. */
Elliott Hughesed398002017-06-21 14:41:24 -0700146 /* 452 */ UInt guest_DSPControl;
147 /* 456 */ ULong guest_ac0;
148 /* 464 */ ULong guest_ac1;
149 /* 472 */ ULong guest_ac2;
150 /* 480 */ ULong guest_ac3;
dejanj0e006f22014-02-19 11:56:29 +0000151
Elliott Hughesed398002017-06-21 14:41:24 -0700152 /* 488 */ UInt guest_CP0_status;
Elliott Hughesa0664b92017-04-18 17:46:52 -0700153
Elliott Hughesed398002017-06-21 14:41:24 -0700154 /* 492 */ UInt guest_LLaddr;
155 /* 496 */ UInt guest_LLdata;
156
157 /* 500 */ UInt _padding2[3];
sewardj362cf842012-06-07 08:59:53 +0000158} VexGuestMIPS32State;
159/*---------------------------------------------------------------*/
160/*--- Utility functions for MIPS32 guest stuff. ---*/
161/*---------------------------------------------------------------*/
162
Elliott Hughesed398002017-06-21 14:41:24 -0700163/* ALL THE FOLLOWING ARE VISIBLE TO LIBRARY CLIENT. */
sewardj362cf842012-06-07 08:59:53 +0000164
165/* Initialise all guest MIPS32 state. */
166
167extern
168void LibVEX_GuestMIPS32_initialise ( /*OUT*/VexGuestMIPS32State* vex_state );
169
Elliott Hughesa0664b92017-04-18 17:46:52 -0700170/* FR bit of CP0_STATUS_FR register */
171#define MIPS_CP0_STATUS_FR (1ul << 26)
sewardj362cf842012-06-07 08:59:53 +0000172
173#endif /* ndef __LIBVEX_PUB_GUEST_MIPS32_H */
174
175
176/*---------------------------------------------------------------*/
177/*--- libvex_guest_mips32.h ---*/
178/*---------------------------------------------------------------*/