Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-01-07 10:24:26

0001 
0002 /*--------------------------------------------------------------------*/
0003 /*--- begin                                 libvex_guest_riscv64.h ---*/
0004 /*--------------------------------------------------------------------*/
0005 
0006 /*
0007    This file is part of Valgrind, a dynamic binary instrumentation
0008    framework.
0009 
0010    Copyright (C) 2020-2023 Petr Pavlu
0011       petr.pavlu@dagobah.cz
0012 
0013    This program is free software; you can redistribute it and/or
0014    modify it under the terms of the GNU General Public License as
0015    published by the Free Software Foundation; either version 2 of the
0016    License, or (at your option) any later version.
0017 
0018    This program is distributed in the hope that it will be useful, but
0019    WITHOUT ANY WARRANTY; without even the implied warranty of
0020    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0021    General Public License for more details.
0022 
0023    You should have received a copy of the GNU General Public License
0024    along with this program; if not, see <http://www.gnu.org/licenses/>.
0025 
0026    The GNU General Public License is contained in the file COPYING.
0027 */
0028 
0029 #ifndef __LIBVEX_PUB_GUEST_RISCV64_H
0030 #define __LIBVEX_PUB_GUEST_RISCV64_H
0031 
0032 #include "libvex_basictypes.h"
0033 
0034 /*------------------------------------------------------------*/
0035 /*--- Vex's representation of the riscv64 CPU state.       ---*/
0036 /*------------------------------------------------------------*/
0037 
0038 typedef struct {
0039    /*   0 */ ULong host_EvC_FAILADDR;
0040    /*   8 */ UInt  host_EvC_COUNTER;
0041    /*  12 */ UInt  pad0;
0042    /*  16 */ ULong guest_x0;
0043    /*  24 */ ULong guest_x1;
0044    /*  32 */ ULong guest_x2;
0045    /*  40 */ ULong guest_x3;
0046    /*  48 */ ULong guest_x4;
0047    /*  56 */ ULong guest_x5;
0048    /*  64 */ ULong guest_x6;
0049    /*  72 */ ULong guest_x7;
0050    /*  80 */ ULong guest_x8;
0051    /*  88 */ ULong guest_x9;
0052    /*  96 */ ULong guest_x10;
0053    /* 104 */ ULong guest_x11;
0054    /* 112 */ ULong guest_x12;
0055    /* 120 */ ULong guest_x13;
0056    /* 128 */ ULong guest_x14;
0057    /* 136 */ ULong guest_x15;
0058    /* 144 */ ULong guest_x16;
0059    /* 152 */ ULong guest_x17;
0060    /* 160 */ ULong guest_x18;
0061    /* 168 */ ULong guest_x19;
0062    /* 176 */ ULong guest_x20;
0063    /* 184 */ ULong guest_x21;
0064    /* 192 */ ULong guest_x22;
0065    /* 200 */ ULong guest_x23;
0066    /* 208 */ ULong guest_x24;
0067    /* 216 */ ULong guest_x25;
0068    /* 224 */ ULong guest_x26;
0069    /* 232 */ ULong guest_x27;
0070    /* 240 */ ULong guest_x28;
0071    /* 248 */ ULong guest_x29;
0072    /* 256 */ ULong guest_x30;
0073    /* 264 */ ULong guest_x31;
0074    /* 272 */ ULong guest_pc;
0075 
0076    /* Floating-point state. */
0077    /* 280 */ ULong guest_f0;
0078    /* 288 */ ULong guest_f1;
0079    /* 296 */ ULong guest_f2;
0080    /* 304 */ ULong guest_f3;
0081    /* 312 */ ULong guest_f4;
0082    /* 320 */ ULong guest_f5;
0083    /* 328 */ ULong guest_f6;
0084    /* 336 */ ULong guest_f7;
0085    /* 344 */ ULong guest_f8;
0086    /* 352 */ ULong guest_f9;
0087    /* 360 */ ULong guest_f10;
0088    /* 368 */ ULong guest_f11;
0089    /* 376 */ ULong guest_f12;
0090    /* 384 */ ULong guest_f13;
0091    /* 392 */ ULong guest_f14;
0092    /* 400 */ ULong guest_f15;
0093    /* 408 */ ULong guest_f16;
0094    /* 416 */ ULong guest_f17;
0095    /* 424 */ ULong guest_f18;
0096    /* 432 */ ULong guest_f19;
0097    /* 440 */ ULong guest_f20;
0098    /* 448 */ ULong guest_f21;
0099    /* 456 */ ULong guest_f22;
0100    /* 464 */ ULong guest_f23;
0101    /* 472 */ ULong guest_f24;
0102    /* 480 */ ULong guest_f25;
0103    /* 488 */ ULong guest_f26;
0104    /* 496 */ ULong guest_f27;
0105    /* 504 */ ULong guest_f28;
0106    /* 512 */ ULong guest_f29;
0107    /* 520 */ ULong guest_f30;
0108    /* 528 */ ULong guest_f31;
0109    /* 536 */ UInt  guest_fcsr;
0110 
0111    /* Various pseudo-regs mandated by Vex or Valgrind. */
0112    /* Emulation notes. */
0113    /* 540 */ UInt guest_EMNOTE;
0114 
0115    /* For clflush/clinval: record start and length of area. */
0116    /* 544 */ ULong guest_CMSTART;
0117    /* 552 */ ULong guest_CMLEN;
0118 
0119    /* Used to record the unredirected guest address at the start of a
0120       translation whose start has been redirected. By reading this
0121       pseudo-register shortly afterwards, the translation can find out what the
0122       corresponding no-redirection address was. Note, this is only set for
0123       wrap-style redirects, not for replace-style ones. */
0124    /* 560 */ ULong guest_NRADDR;
0125 
0126    /* Fallback LL/SC support. */
0127    /* 568 */ ULong guest_LLSC_SIZE; /* 0==no transaction, else 4 or 8. */
0128    /* 576 */ ULong guest_LLSC_ADDR; /* Address of the transaction. */
0129    /* 584 */ ULong guest_LLSC_DATA; /* Original value at ADDR, sign-extended. */
0130 
0131    /* Padding to 16 bytes. */
0132    /* 592 */
0133 } VexGuestRISCV64State;
0134 
0135 /*------------------------------------------------------------*/
0136 /*--- Utility functions for riscv64 guest stuff.           ---*/
0137 /*------------------------------------------------------------*/
0138 
0139 /* ALL THE FOLLOWING ARE VISIBLE TO LIBRARY CLIENT */
0140 
0141 /* Initialise all guest riscv64 state. */
0142 void LibVEX_GuestRISCV64_initialise(/*OUT*/ VexGuestRISCV64State* vex_state);
0143 
0144 #endif /* ndef __LIBVEX_PUB_GUEST_RISCV64_H */
0145 
0146 /*--------------------------------------------------------------------*/
0147 /*---                                       libvex_guest_riscv64.h ---*/
0148 /*--------------------------------------------------------------------*/