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