Home | History | Annotate | Download | only in pub
      1 
      2 /*---------------------------------------------------------------*/
      3 /*--- begin                             libvex_guest_mips64.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 (at) 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., 51 Franklin Street, Fifth Floor, Boston, MA
     26    02110-1301, USA.
     27 
     28    The GNU General Public License is contained in the file COPYING.
     29 
     30    Neither the names of the U.S. Department of Energy nor the
     31    University of California nor the names of its contributors may be
     32    used to endorse or promote products derived from this software
     33    without prior written permission.
     34 */
     35 
     36 #ifndef __LIBVEX_PUB_GUEST_MIPS64_H
     37 #define __LIBVEX_PUB_GUEST_MIPS64_H
     38 
     39 #include "libvex_basictypes.h"
     40 #include "libvex_emnote.h"
     41 
     42 
     43 /*---------------------------------------------------------------*/
     44 /*--- Vex's representation of the MIPS64 CPU state.           ---*/
     45 /*---------------------------------------------------------------*/
     46 
     47 typedef
     48    struct {
     49       /* CPU Registers */
     50       /*   0 */ ULong guest_r0;   /* Hardwired to 0 */
     51       /*   8 */ ULong guest_r1;   /* Assembler temporary */
     52       /*   16 */ ULong guest_r2;  /* Values for function returns ...*/
     53       /*   24 */ ULong guest_r3;  /* ...and expression evaluation */
     54       /*   32 */ ULong guest_r4;  /* Function arguments */
     55       /*   40 */ ULong guest_r5;
     56       /*   48 */ ULong guest_r6;
     57       /*   56 */ ULong guest_r7;
     58       /*   64 */ ULong guest_r8;
     59       /*   72 */ ULong guest_r9;
     60       /*   80 */ ULong guest_r10;
     61       /*   88 */ ULong guest_r11;
     62       /*   96 */ ULong guest_r12;  /* Temporaries */
     63       /*   104 */ ULong guest_r13;
     64       /*   112 */ ULong guest_r14;
     65       /*   120 */ ULong guest_r15;
     66       /*   128 */ ULong guest_r16;  /* Saved temporaries */
     67       /*   136 */ ULong guest_r17;
     68       /*   144 */ ULong guest_r18;
     69       /*   152 */ ULong guest_r19;
     70       /*   160 */ ULong guest_r20;
     71       /*   168 */ ULong guest_r21;
     72       /*   176 */ ULong guest_r22;
     73       /*   184 */ ULong guest_r23;
     74       /*   192 */ ULong guest_r24;  /* Temporaries */
     75       /*   200 */ ULong guest_r25;
     76       /*   208 */ ULong guest_r26;  /* Reserved for OS kernel */
     77       /*   216 */ ULong guest_r27;
     78       /*   224 */ ULong guest_r28;  /* Global pointer */
     79       /*   232 */ ULong guest_r29;  /* Stack pointer */
     80       /*   240 */ ULong guest_r30;  /* Frame pointer */
     81       /*   248 */ ULong guest_r31;  /* Return address */
     82       /*   256 */ ULong guest_PC;   /* Program counter */
     83       /*   264 */ ULong guest_HI;   /* Multiply and divide reg higher result */
     84       /*   272 */ ULong guest_LO;   /* Multiply and divide reg lower result */
     85 
     86       /* FPU Registers */
     87       /*   280 */ ULong guest_f0;   /* Floting point gen purpose registers */
     88       /*   288 */ ULong guest_f1;
     89       /*   296 */ ULong guest_f2;
     90       /*   304 */ ULong guest_f3;
     91       /*   312 */ ULong guest_f4;
     92       /*   320 */ ULong guest_f5;
     93       /*   328 */ ULong guest_f6;
     94       /*   336 */ ULong guest_f7;
     95       /*   344 */ ULong guest_f8;
     96       /*   352 */ ULong guest_f9;
     97       /*   360 */ ULong guest_f10;
     98       /*   368 */ ULong guest_f11;
     99       /*   376 */ ULong guest_f12;
    100       /*   384 */ ULong guest_f13;
    101       /*   392 */ ULong guest_f14;
    102       /*   400 */ ULong guest_f15;
    103       /*   408 */ ULong guest_f16;
    104       /*   416 */ ULong guest_f17;
    105       /*   424 */ ULong guest_f18;
    106       /*   432 */ ULong guest_f19;
    107       /*   440 */ ULong guest_f20;
    108       /*   448 */ ULong guest_f21;
    109       /*   456 */ ULong guest_f22;
    110       /*   464 */ ULong guest_f23;
    111       /*   472 */ ULong guest_f24;
    112       /*   480 */ ULong guest_f25;
    113       /*   488 */ ULong guest_f26;
    114       /*   496 */ ULong guest_f27;
    115       /*   504 */ ULong guest_f28;
    116       /*   512 */ ULong guest_f29;
    117       /*   520 */ ULong guest_f30;
    118       /*   528 */ ULong guest_f31;
    119 
    120       /*   536 */ UInt guest_FIR;
    121       /*   540 */ UInt guest_FCCR;
    122       /*   544 */ UInt guest_FEXR;
    123       /*   548 */ UInt guest_FENR;
    124       /*   552 */ UInt guest_FCSR;
    125 
    126       /* TLS pointer for the thread. It's read-only in user space. On Linux it
    127          is set in user space by various thread-related syscalls.
    128          User Local Register.
    129          This register provides read access to the coprocessor 0
    130          UserLocal register, if it is implemented. In some operating
    131          environments, the UserLocal register is a pointer to a thread-specific
    132          storage block.
    133        */
    134         ULong guest_ULR;         /* 560 */
    135 
    136       /* Emulation notes */
    137         UInt guest_EMNOTE;       /* 568 */
    138 
    139       /* For clflush: record start and length of area to invalidate */
    140         ULong guest_CMSTART;     /* 576 */
    141         ULong guest_CMLEN;       /* 584 */
    142 
    143         ULong guest_NRADDR;      /* 592 */
    144 
    145         ULong host_EvC_FAILADDR; /* 600 */
    146         UInt host_EvC_COUNTER;   /* 608 */
    147         UInt guest_COND;         /* 612 */
    148         UInt padding[2];
    149 } VexGuestMIPS64State;
    150 
    151 /*---------------------------------------------------------------*/
    152 /*--- Utility functions for MIPS64 guest stuff.               ---*/
    153 /*---------------------------------------------------------------*/
    154 
    155 /* ALL THE FOLLOWING ARE VISIBLE TO LIBRARY CLIENT */
    156 
    157 /* Initialise all guest MIPS64 state. */
    158 
    159 extern
    160 void LibVEX_GuestMIPS64_initialise ( /*OUT*/VexGuestMIPS64State* vex_state );
    161 
    162 #endif /* ndef __LIBVEX_PUB_GUEST_MIPS64_H */
    163 
    164 /*---------------------------------------------------------------*/
    165 /*---                                   libvex_guest_mips64.h ---*/
    166 /*---------------------------------------------------------------*/
    167 
    168