sewardj | 362cf84 | 2012-06-07 08:59:53 +0000 | [diff] [blame] | 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 | |
sewardj | 785952d | 2015-08-21 11:29:16 +0000 | [diff] [blame] | 10 | Copyright (C) 2010-2015 RT-RK |
sewardj | 362cf84 | 2012-06-07 08:59:53 +0000 | [diff] [blame] | 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" |
sewardj | 362cf84 | 2012-06-07 08:59:53 +0000 | [diff] [blame] | 35 | |
| 36 | |
| 37 | /*---------------------------------------------------------------*/ |
| 38 | /*--- Vex's representation of the MIPS32 CPU state. ---*/ |
| 39 | /*---------------------------------------------------------------*/ |
| 40 | |
| 41 | typedef |
| 42 | struct { |
| 43 | /* CPU Registers */ |
dejanj | 0e006f2 | 2014-02-19 11:56:29 +0000 | [diff] [blame] | 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 */ |
sewardj | 362cf84 | 2012-06-07 08:59:53 +0000 | [diff] [blame] | 79 | |
| 80 | /* FPU Registers */ |
dejanj | 0e006f2 | 2014-02-19 11:56:29 +0000 | [diff] [blame] | 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; |
sewardj | 362cf84 | 2012-06-07 08:59:53 +0000 | [diff] [blame] | 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 | */ |
dejanj | 0e006f2 | 2014-02-19 11:56:29 +0000 | [diff] [blame] | 129 | /* 420 */ UInt guest_ULR; |
sewardj | 362cf84 | 2012-06-07 08:59:53 +0000 | [diff] [blame] | 130 | |
florian | 6ef84be | 2012-08-26 03:20:07 +0000 | [diff] [blame] | 131 | /* Emulation notes */ |
dejanj | 0e006f2 | 2014-02-19 11:56:29 +0000 | [diff] [blame] | 132 | /* 424 */ UInt guest_EMNOTE; |
sewardj | 362cf84 | 2012-06-07 08:59:53 +0000 | [diff] [blame] | 133 | |
| 134 | /* For clflush: record start and length of area to invalidate */ |
sewardj | 05f5e01 | 2014-05-04 10:52:11 +0000 | [diff] [blame] | 135 | /* 428 */ UInt guest_CMSTART; |
| 136 | /* 432 */ UInt guest_CMLEN; |
dejanj | 0e006f2 | 2014-02-19 11:56:29 +0000 | [diff] [blame] | 137 | /* 436 */ UInt guest_NRADDR; |
sewardj | 362cf84 | 2012-06-07 08:59:53 +0000 | [diff] [blame] | 138 | |
dejanj | 0e006f2 | 2014-02-19 11:56:29 +0000 | [diff] [blame] | 139 | /* 440 */ UInt host_EvC_FAILADDR; |
| 140 | /* 444 */ UInt host_EvC_COUNTER; |
| 141 | /* 448 */ UInt guest_COND; |
dejanj | c3fee0d | 2013-07-25 09:08:03 +0000 | [diff] [blame] | 142 | |
dejanj | c3fee0d | 2013-07-25 09:08:03 +0000 | [diff] [blame] | 143 | /* MIPS32 DSP ASE(r2) specific registers. */ |
dejanj | 0e006f2 | 2014-02-19 11:56:29 +0000 | [diff] [blame] | 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 | |
Elliott Hughes | a0664b9 | 2017-04-18 17:46:52 -0700 | [diff] [blame^] | 150 | /* 488 */ UInt guest_CP0_status; |
| 151 | |
| 152 | /* 492 */ UInt padding; |
sewardj | 362cf84 | 2012-06-07 08:59:53 +0000 | [diff] [blame] | 153 | } VexGuestMIPS32State; |
| 154 | /*---------------------------------------------------------------*/ |
| 155 | /*--- Utility functions for MIPS32 guest stuff. ---*/ |
| 156 | /*---------------------------------------------------------------*/ |
| 157 | |
| 158 | /* ALL THE FOLLOWING ARE VISIBLE TO LIBRARY CLIENT */ |
| 159 | |
| 160 | /* Initialise all guest MIPS32 state. */ |
| 161 | |
| 162 | extern |
| 163 | void LibVEX_GuestMIPS32_initialise ( /*OUT*/VexGuestMIPS32State* vex_state ); |
| 164 | |
Elliott Hughes | a0664b9 | 2017-04-18 17:46:52 -0700 | [diff] [blame^] | 165 | /* FR bit of CP0_STATUS_FR register */ |
| 166 | #define MIPS_CP0_STATUS_FR (1ul << 26) |
sewardj | 362cf84 | 2012-06-07 08:59:53 +0000 | [diff] [blame] | 167 | |
| 168 | #endif /* ndef __LIBVEX_PUB_GUEST_MIPS32_H */ |
| 169 | |
| 170 | |
| 171 | /*---------------------------------------------------------------*/ |
| 172 | /*--- libvex_guest_mips32.h ---*/ |
| 173 | /*---------------------------------------------------------------*/ |