1 2 /*---------------------------------------------------------------*/ 3 /*--- begin guest_mips_defs.h ---*/ 4 /*---------------------------------------------------------------*/ 5 6 /* 7 This file is part of Valgrind, a dynamic binary instrumentation 8 framework. 9 10 Copyright (C) 2010-2017 RT-RK 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 /* Only to be used within the guest-mips directory. */ 32 33 #ifndef __VEX_GUEST_MIPS_DEFS_H 34 #define __VEX_GUEST_MIPS_DEFS_H 35 36 #include "libvex_basictypes.h" 37 #include "guest_generic_bb_to_IR.h" /* DisResult */ 38 39 /*---------------------------------------------------------*/ 40 /*--- mips to IR conversion ---*/ 41 /*---------------------------------------------------------*/ 42 43 /* Convert one MIPS insn to IR. See the type DisOneInstrFn in 44 guest_generic_bb_to_IR.h. */ 45 extern DisResult disInstr_MIPS ( IRSB* irbb, 46 Bool (*resteerOkFn) (void *, Addr), 47 Bool resteerCisOk, 48 void* callback_opaque, 49 const UChar* guest_code, 50 Long delta, 51 Addr guest_IP, 52 VexArch guest_arch, 53 const VexArchInfo* archinfo, 54 const VexAbiInfo* abiinfo, 55 VexEndness host_endness, 56 Bool sigill_diag ); 57 58 /* Used by the optimiser to specialise calls to helpers. */ 59 extern IRExpr *guest_mips32_spechelper ( const HChar * function_name, 60 IRExpr ** args, 61 IRStmt ** precedingStmts, 62 Int n_precedingStmts ); 63 64 extern IRExpr *guest_mips64_spechelper ( const HChar * function_name, 65 IRExpr ** args, 66 IRStmt ** precedingStmts, 67 Int n_precedingStmts); 68 69 /* Describes to the optimser which part of the guest state require 70 precise memory exceptions. This is logically part of the guest 71 state description. */ 72 extern 73 Bool guest_mips32_state_requires_precise_mem_exns ( Int, Int, 74 VexRegisterUpdates ); 75 76 extern 77 Bool guest_mips64_state_requires_precise_mem_exns ( Int, Int, 78 VexRegisterUpdates ); 79 80 extern VexGuestLayout mips32Guest_layout; 81 extern VexGuestLayout mips64Guest_layout; 82 83 /*---------------------------------------------------------*/ 84 /*--- mips guest helpers ---*/ 85 /*---------------------------------------------------------*/ 86 typedef enum { 87 CEILWS=0, CEILWD, CEILLS, CEILLD, 88 FLOORWS, FLOORWD, FLOORLS, FLOORLD, 89 ROUNDWS, ROUNDWD, ROUNDLS, ROUNDLD, 90 TRUNCWS, TRUNCWD, TRUNCLS, TRUNCLD, 91 CVTDS, CVTDW, CVTSD, CVTSW, 92 CVTWS, CVTWD, CVTDL, CVTLS, 93 CVTLD, CVTSL, ADDS, ADDD, 94 SUBS, SUBD, DIVS 95 } flt_op; 96 97 #if defined (_MIPSEL) 98 #define MIPS_IEND Iend_LE 99 #else 100 #define MIPS_IEND Iend_BE 101 #endif 102 103 extern HWord mips_dirtyhelper_rdhwr ( UInt rd ); 104 105 /* Calculate FCSR in fp32 mode. */ 106 extern UInt mips_dirtyhelper_calculate_FCSR_fp32 ( void* guest_state, UInt fs, 107 UInt ft, flt_op op ); 108 /* Calculate FCSR in fp64 mode. */ 109 extern UInt mips_dirtyhelper_calculate_FCSR_fp64 ( void* guest_state, UInt fs, 110 UInt ft, flt_op op ); 111 112 /*---------------------------------------------------------*/ 113 /*--- Condition code stuff ---*/ 114 /*---------------------------------------------------------*/ 115 116 typedef enum { 117 MIPSCondEQ = 0, /* equal : Z=1 */ 118 MIPSCondNE = 1, /* not equal : Z=0 */ 119 120 MIPSCondHS = 2, /* >=u (higher or same) : C=1 */ 121 MIPSCondLO = 3, /* <u (lower) : C=0 */ 122 123 MIPSCondMI = 4, /* minus (negative) : N=1 */ 124 MIPSCondPL = 5, /* plus (zero or +ve) : N=0 */ 125 126 MIPSCondVS = 6, /* overflow : V=1 */ 127 MIPSCondVC = 7, /* no overflow : V=0 */ 128 129 MIPSCondHI = 8, /* >u (higher) : C=1 && Z=0 */ 130 MIPSCondLS = 9, /* <=u (lower or same) : C=0 || Z=1 */ 131 132 MIPSCondGE = 10, /* >=s (signed greater or equal) : N=V */ 133 MIPSCondLT = 11, /* <s (signed less than) : N!=V */ 134 135 MIPSCondGT = 12, /* >s (signed greater) : Z=0 && N=V */ 136 MIPSCondLE = 13, /* <=s (signed less or equal) : Z=1 || N!=V */ 137 138 MIPSCondAL = 14, /* always (unconditional) : 1 */ 139 MIPSCondNV = 15 /* never (unconditional): : 0 */ 140 } MIPSCondcode; 141 142 #endif /* __VEX_GUEST_MIPS_DEFS_H */ 143 144 /*---------------------------------------------------------------*/ 145 /*--- end guest_mips_defs.h ---*/ 146 /*---------------------------------------------------------------*/ 147