Home | History | Annotate | Download | only in priv
      1 /*---------------------------------------------------------------*/
      2 /*--- begin                               guest_tilegx_defs.h ---*/
      3 /*---------------------------------------------------------------*/
      4 
      5 /*
      6    This file is part of Valgrind, a dynamic binary instrumentation
      7    framework.
      8 
      9    Copyright (C) 2010-2015 Tilera Corp.
     10 
     11    This program is free software; you can redistribute it and/or
     12    modify it under the terms of the GNU General Public License as
     13    published by the Free Software Foundation; either version 2 of the
     14    License, or (at your option) any later version.
     15 
     16    This program is distributed in the hope that it will be useful, but
     17    WITHOUT ANY WARRANTY; without even the implied warranty of
     18    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     19    General Public License for more details.
     20 
     21    You should have received a copy of the GNU General Public License
     22    along with this program; if not, write to the Free Software
     23    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
     24    02111-1307, USA.
     25 
     26    The GNU General Public License is contained in the file COPYING.
     27 */
     28 
     29  /* Contributed by Zhi-Gang Liu <zliu at tilera dot com> */
     30 
     31 #ifndef __VEX_GUEST_TILEGX_DEFS_H
     32 #define __VEX_GUEST_TILEGX_DEFS_H
     33 
     34 #ifdef __tilegx__
     35 #include "tilegx_disasm.h"
     36 #endif
     37 
     38 /*---------------------------------------------------------*/
     39 /*--- tilegx to IR conversion                           ---*/
     40 /*---------------------------------------------------------*/
     41 
     42 /* Convert one TILEGX insn to IR.  See the type DisOneInstrFn in
     43    bb_to_IR.h. */
     44 extern DisResult disInstr_TILEGX ( IRSB* irbb,
     45                                    Bool (*resteerOkFn) ( void *, Addr ),
     46                                    Bool resteerCisOk,
     47                                    void* callback_opaque,
     48                                    const UChar* guest_code,
     49                                    Long delta,
     50                                    Addr guest_IP,
     51                                    VexArch guest_arch,
     52                                    const VexArchInfo* archinfo,
     53                                    const VexAbiInfo* abiinfo,
     54                                    VexEndness host_endness_IN,
     55                                    Bool sigill_diag_IN );
     56 
     57 /* Used by the optimiser to specialise calls to helpers. */
     58 extern IRExpr *guest_tilegx_spechelper ( const HChar * function_name,
     59                                          IRExpr ** args,
     60                                          IRStmt ** precedingStmts,
     61                                          Int n_precedingStmts );
     62 
     63 /* Describes to the optimser which part of the guest state require
     64    precise memory exceptions.  This is logically part of the guest
     65    state description. */
     66 extern Bool guest_tilegx_state_requires_precise_mem_exns (
     67   Int, Int, VexRegisterUpdates );
     68 
     69 extern VexGuestLayout tilegxGuest_layout;
     70 
     71 /*---------------------------------------------------------*/
     72 /*--- tilegx guest helpers                              ---*/
     73 /*---------------------------------------------------------*/
     74 
     75 extern ULong tilegx_dirtyhelper_gen ( ULong opc,
     76                                       ULong rd0,
     77                                       ULong rd1,
     78                                       ULong rd2,
     79                                       ULong rd3 );
     80 
     81 /*---------------------------------------------------------*/
     82 /*--- Condition code stuff                              ---*/
     83 /*---------------------------------------------------------*/
     84 
     85 /* Defines conditions which we can ask for TILEGX */
     86 
     87 typedef enum {
     88   TILEGXCondEQ = 0,      /* equal                         : Z=1 */
     89   TILEGXCondNE = 1,      /* not equal                     : Z=0 */
     90   TILEGXCondHS = 2,      /* >=u (higher or same)          : C=1 */
     91   TILEGXCondLO = 3,      /* <u  (lower)                   : C=0 */
     92   TILEGXCondMI = 4,      /* minus (negative)              : N=1 */
     93   TILEGXCondPL = 5,      /* plus (zero or +ve)            : N=0 */
     94   TILEGXCondVS = 6,      /* overflow                      : V=1 */
     95   TILEGXCondVC = 7,      /* no overflow                   : V=0 */
     96   TILEGXCondHI = 8,      /* >u   (higher)                 : C=1 && Z=0 */
     97   TILEGXCondLS = 9,      /* <=u  (lower or same)          : C=0 || Z=1 */
     98   TILEGXCondGE = 10,     /* >=s (signed greater or equal) : N=V */
     99   TILEGXCondLT = 11,     /* <s  (signed less than)        : N!=V */
    100   TILEGXCondGT = 12,     /* >s  (signed greater)          : Z=0 && N=V */
    101   TILEGXCondLE = 13,     /* <=s (signed less or equal)    : Z=1 || N!=V */
    102   TILEGXCondAL = 14,     /* always (unconditional)        : 1 */
    103   TILEGXCondNV = 15      /* never (unconditional):        : 0 */
    104 } TILEGXCondcode;
    105 
    106 #endif            /* __VEX_GUEST_TILEGX_DEFS_H */
    107 
    108 /*---------------------------------------------------------------*/
    109 /*--- end                                 guest_tilegx_defs.h ---*/
    110 /*---------------------------------------------------------------*/
    111