Home | History | Annotate | Download | only in pub
      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 
     10    Copyright (C) 2010-2012 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., 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"
     35 #include "libvex_emwarn.h"
     36 
     37 
     38 /*---------------------------------------------------------------*/
     39 /*--- Vex's representation of the MIPS32 CPU state.           ---*/
     40 /*---------------------------------------------------------------*/
     41 
     42 typedef
     43    struct {
     44       /* CPU Registers */
     45       /*   0 */ UInt guest_r0; /* Hardwired to 0 */
     46       /*   4 */ UInt guest_r1;   /* Assembler temporary */
     47       /*   8 */ UInt guest_r2;   /* Values for function returns ...*/
     48       /*   12 */ UInt guest_r3;   /* ...and expression evaluation */
     49       /*   16 */ UInt guest_r4;   /* Function arguments */
     50       /*   20 */ UInt guest_r5;
     51       /*   24 */ UInt guest_r6;
     52       /*   28 */ UInt guest_r7;
     53       /*   32 */ UInt guest_r8;   /* Temporaries */
     54       /*   36 */ UInt guest_r9;
     55       /*   40 */ UInt guest_r10;
     56       /*   44 */ UInt guest_r11;
     57       /*   48 */ UInt guest_r12;
     58       /*   52 */ UInt guest_r13;
     59       /*   56 */ UInt guest_r14;
     60       /*   60 */ UInt guest_r15;
     61       /*   64 */ UInt guest_r16;   /* Saved temporaries */
     62       /*   68 */ UInt guest_r17;
     63       /*   72 */ UInt guest_r18;
     64       /*   76 */ UInt guest_r19;
     65       /*   80 */ UInt guest_r20;
     66       /*   84 */ UInt guest_r21;
     67       /*   88 */ UInt guest_r22;
     68       /*   92 */ UInt guest_r23;
     69       /*   96 */ UInt guest_r24;   /* Temporaries */
     70       /*   100 */ UInt guest_r25;
     71       /*   104 */ UInt guest_r26;   /* Reserved for OS kernel */
     72       /*   108 */ UInt guest_r27;
     73       /*   112 */ UInt guest_r28;   /* Global pointer */
     74       /*   116 */ UInt guest_r29;   /* Stack pointer */
     75       /*   120 */ UInt guest_r30;   /* Frame pointer */
     76       /*   124 */ UInt guest_r31;   /* Return address */
     77       /*   128 */ UInt guest_PC;   /* Program counter */
     78       /*   132 */ UInt guest_HI;/* Multiply and divide register higher result */
     79       /*   136 */ UInt guest_LO;/* Multiply and divide register lower result */
     80 
     81       /* FPU Registers */
     82       /*   140 */ UInt guest_f0; /* Floting point general purpose registers */
     83       /*   144 */ UInt guest_f1;
     84       /*   148 */ UInt guest_f2;
     85       /*   152 */ UInt guest_f3;
     86       /*   156 */ UInt guest_f4;
     87       /*   160 */ UInt guest_f5;
     88       /*   164 */ UInt guest_f6;
     89       /*   168 */ UInt guest_f7;
     90       /*   172 */ UInt guest_f8;
     91       /*   176 */ UInt guest_f9;
     92       /*   180 */ UInt guest_f10;
     93       /*   184 */ UInt guest_f11;
     94       /*   188 */ UInt guest_f12;
     95       /*   192 */ UInt guest_f13;
     96       /*   196 */ UInt guest_f14;
     97       /*   200 */ UInt guest_f15;
     98       /*   204 */ UInt guest_f16;
     99       /*   208 */ UInt guest_f17;
    100       /*   212 */ UInt guest_f18;
    101       /*   216 */ UInt guest_f19;
    102       /*   220 */ UInt guest_f20;
    103       /*   224 */ UInt guest_f21;
    104       /*   228 */ UInt guest_f22;
    105       /*   232 */ UInt guest_f23;
    106       /*   236 */ UInt guest_f24;
    107       /*   240 */ UInt guest_f25;
    108       /*   244 */ UInt guest_f26;
    109       /*   248 */ UInt guest_f27;
    110       /*   252 */ UInt guest_f28;
    111       /*   256 */ UInt guest_f29;
    112       /*   260 */ UInt guest_f30;
    113       /*   264 */ UInt guest_f31;
    114 
    115       /*   268 */ UInt guest_FIR;
    116       /*   272 */ UInt guest_FCCR;
    117       /*   276 */ UInt guest_FEXR;
    118       /*   280 */ UInt guest_FENR;
    119       /*   284 */ UInt guest_FCSR;
    120 
    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
    123          syscalls.
    124          User Local Register.
    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.
    129       */
    130       /*   288 */ UInt guest_ULR;
    131 
    132       /* Emulation warnings */
    133           UInt   guest_EMWARN;  /* 292 */
    134 
    135       /* For clflush: record start and length of area to invalidate */
    136         UInt guest_TISTART;     /* 296 */
    137         UInt guest_TILEN;       /* 300 */
    138         UInt guest_NRADDR;      /* 304 */
    139 
    140         UInt host_EvC_FAILADDR; /* 308 */
    141         UInt host_EvC_COUNTER;  /* 312 */
    142         UInt guest_COND;        /* 316 */
    143 } VexGuestMIPS32State;
    144 /*---------------------------------------------------------------*/
    145 /*--- Utility functions for MIPS32 guest stuff.               ---*/
    146 /*---------------------------------------------------------------*/
    147 
    148 /* ALL THE FOLLOWING ARE VISIBLE TO LIBRARY CLIENT */
    149 
    150 /* Initialise all guest MIPS32 state. */
    151 
    152 extern
    153 void LibVEX_GuestMIPS32_initialise ( /*OUT*/VexGuestMIPS32State* vex_state );
    154 
    155 
    156 #endif /* ndef __LIBVEX_PUB_GUEST_MIPS32_H */
    157 
    158 
    159 /*---------------------------------------------------------------*/
    160 /*---                                   libvex_guest_mips32.h ---*/
    161 /*---------------------------------------------------------------*/
    162