1 /* 2 * RISC-V Emulation Helpers for QEMU. 3 * 4 * Copyright (c) 2016-2017 Sagar Karandikar, sagark@eecs.berkeley.edu 5 * Copyright (c) 2017-2018 SiFive, Inc. 6 * Copyright (c) 2022 VRULL GmbH 7 * 8 * This program is free software; you can redistribute it and/or modify it 9 * under the terms and conditions of the GNU General Public License, 10 * version 2 or later, as published by the Free Software Foundation. 11 * 12 * This program is distributed in the hope it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 * more details. 16 * 17 * You should have received a copy of the GNU General Public License along with 18 * this program. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 21 #include "qemu/osdep.h" 22 #include "cpu.h" 23 #include "internals.h" 24 #include "exec/exec-all.h" 25 #include "exec/cpu_ldst.h" 26 #include "exec/helper-proto.h" 27 #include "trace.h" 28 29 /* Exceptions processing helpers */ 30 G_NORETURN void riscv_raise_exception(CPURISCVState *env, 31 RISCVException exception, 32 uintptr_t pc) 33 { 34 CPUState *cs = env_cpu(env); 35 36 trace_riscv_exception(exception, 37 riscv_cpu_get_trap_name(exception, false), 38 env->pc); 39 40 cs->exception_index = exception; 41 cpu_loop_exit_restore(cs, pc); 42 } 43 44 void helper_raise_exception(CPURISCVState *env, uint32_t exception) 45 { 46 riscv_raise_exception(env, exception, 0); 47 } 48 49 target_ulong helper_csrr(CPURISCVState *env, int csr) 50 { 51 /* 52 * The seed CSR must be accessed with a read-write instruction. A 53 * read-only instruction such as CSRRS/CSRRC with rs1=x0 or CSRRSI/ 54 * CSRRCI with uimm=0 will raise an illegal instruction exception. 55 */ 56 if (csr == CSR_SEED) { 57 riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, GETPC()); 58 } 59 60 target_ulong val = 0; 61 RISCVException ret = riscv_csrr(env, csr, &val); 62 63 if (ret != RISCV_EXCP_NONE) { 64 riscv_raise_exception(env, ret, GETPC()); 65 } 66 return val; 67 } 68 69 void helper_csrw(CPURISCVState *env, int csr, target_ulong src) 70 { 71 target_ulong mask = env->xl == MXL_RV32 ? UINT32_MAX : (target_ulong)-1; 72 RISCVException ret = riscv_csrrw(env, csr, NULL, src, mask); 73 74 if (ret != RISCV_EXCP_NONE) { 75 riscv_raise_exception(env, ret, GETPC()); 76 } 77 } 78 79 target_ulong helper_csrrw(CPURISCVState *env, int csr, 80 target_ulong src, target_ulong write_mask) 81 { 82 target_ulong val = 0; 83 RISCVException ret = riscv_csrrw(env, csr, &val, src, write_mask); 84 85 if (ret != RISCV_EXCP_NONE) { 86 riscv_raise_exception(env, ret, GETPC()); 87 } 88 return val; 89 } 90 91 target_ulong helper_csrr_i128(CPURISCVState *env, int csr) 92 { 93 Int128 rv = int128_zero(); 94 RISCVException ret = riscv_csrr_i128(env, csr, &rv); 95 96 if (ret != RISCV_EXCP_NONE) { 97 riscv_raise_exception(env, ret, GETPC()); 98 } 99 100 env->retxh = int128_gethi(rv); 101 return int128_getlo(rv); 102 } 103 104 void helper_csrw_i128(CPURISCVState *env, int csr, 105 target_ulong srcl, target_ulong srch) 106 { 107 RISCVException ret = riscv_csrrw_i128(env, csr, NULL, 108 int128_make128(srcl, srch), 109 UINT128_MAX); 110 111 if (ret != RISCV_EXCP_NONE) { 112 riscv_raise_exception(env, ret, GETPC()); 113 } 114 } 115 116 target_ulong helper_csrrw_i128(CPURISCVState *env, int csr, 117 target_ulong srcl, target_ulong srch, 118 target_ulong maskl, target_ulong maskh) 119 { 120 Int128 rv = int128_zero(); 121 RISCVException ret = riscv_csrrw_i128(env, csr, &rv, 122 int128_make128(srcl, srch), 123 int128_make128(maskl, maskh)); 124 125 if (ret != RISCV_EXCP_NONE) { 126 riscv_raise_exception(env, ret, GETPC()); 127 } 128 129 env->retxh = int128_gethi(rv); 130 return int128_getlo(rv); 131 } 132 133 134 /* 135 * check_zicbo_envcfg 136 * 137 * Raise virtual exceptions and illegal instruction exceptions for 138 * Zicbo[mz] instructions based on the settings of [mhs]envcfg as 139 * specified in section 2.5.1 of the CMO specification. 140 */ 141 static void check_zicbo_envcfg(CPURISCVState *env, target_ulong envbits, 142 uintptr_t ra) 143 { 144 #ifndef CONFIG_USER_ONLY 145 if ((env->priv < PRV_M) && !get_field(env->menvcfg, envbits)) { 146 riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, ra); 147 } 148 149 if (env->virt_enabled && 150 (((env->priv <= PRV_S) && !get_field(env->henvcfg, envbits)) || 151 ((env->priv < PRV_S) && !get_field(env->senvcfg, envbits)))) { 152 riscv_raise_exception(env, RISCV_EXCP_VIRT_INSTRUCTION_FAULT, ra); 153 } 154 155 if ((env->priv < PRV_S) && !get_field(env->senvcfg, envbits)) { 156 riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, ra); 157 } 158 #endif 159 } 160 161 void helper_cbo_zero(CPURISCVState *env, target_ulong address) 162 { 163 RISCVCPU *cpu = env_archcpu(env); 164 uint16_t cbozlen = cpu->cfg.cboz_blocksize; 165 int mmu_idx = riscv_env_mmu_index(env, false); 166 uintptr_t ra = GETPC(); 167 void *mem; 168 169 check_zicbo_envcfg(env, MENVCFG_CBZE, ra); 170 171 /* Mask off low-bits to align-down to the cache-block. */ 172 address &= ~(cbozlen - 1); 173 174 /* 175 * cbo.zero requires MMU_DATA_STORE access. Do a probe_write() 176 * to raise any exceptions, including PMP. 177 */ 178 mem = probe_write(env, address, cbozlen, mmu_idx, ra); 179 180 if (likely(mem)) { 181 memset(mem, 0, cbozlen); 182 } else { 183 /* 184 * This means that we're dealing with an I/O page. Section 4.2 185 * of cmobase v1.0.1 says: 186 * 187 * "Cache-block zero instructions store zeros independently 188 * of whether data from the underlying memory locations are 189 * cacheable." 190 * 191 * Write zeros in address + cbozlen regardless of not being 192 * a RAM page. 193 */ 194 for (int i = 0; i < cbozlen; i++) { 195 cpu_stb_mmuidx_ra(env, address + i, 0, mmu_idx, ra); 196 } 197 } 198 } 199 200 /* 201 * check_zicbom_access 202 * 203 * Check access permissions (LOAD, STORE or FETCH as specified in 204 * section 2.5.2 of the CMO specification) for Zicbom, raising 205 * either store page-fault (non-virtualized) or store guest-page 206 * fault (virtualized). 207 */ 208 static void check_zicbom_access(CPURISCVState *env, 209 target_ulong address, 210 uintptr_t ra) 211 { 212 RISCVCPU *cpu = env_archcpu(env); 213 int mmu_idx = riscv_env_mmu_index(env, false); 214 uint16_t cbomlen = cpu->cfg.cbom_blocksize; 215 void *phost; 216 int ret; 217 218 /* Mask off low-bits to align-down to the cache-block. */ 219 address &= ~(cbomlen - 1); 220 221 /* 222 * Section 2.5.2 of cmobase v1.0.1: 223 * 224 * "A cache-block management instruction is permitted to 225 * access the specified cache block whenever a load instruction 226 * or store instruction is permitted to access the corresponding 227 * physical addresses. If neither a load instruction nor store 228 * instruction is permitted to access the physical addresses, 229 * but an instruction fetch is permitted to access the physical 230 * addresses, whether a cache-block management instruction is 231 * permitted to access the cache block is UNSPECIFIED." 232 */ 233 ret = probe_access_flags(env, address, cbomlen, MMU_DATA_LOAD, 234 mmu_idx, true, &phost, ra); 235 if (ret != TLB_INVALID_MASK) { 236 /* Success: readable */ 237 return; 238 } 239 240 /* 241 * Since not readable, must be writable. On failure, store 242 * fault/store guest amo fault will be raised by 243 * riscv_cpu_tlb_fill(). PMP exceptions will be caught 244 * there as well. 245 */ 246 probe_write(env, address, cbomlen, mmu_idx, ra); 247 } 248 249 void helper_cbo_clean_flush(CPURISCVState *env, target_ulong address) 250 { 251 uintptr_t ra = GETPC(); 252 check_zicbo_envcfg(env, MENVCFG_CBCFE, ra); 253 check_zicbom_access(env, address, ra); 254 255 /* We don't emulate the cache-hierarchy, so we're done. */ 256 } 257 258 void helper_cbo_inval(CPURISCVState *env, target_ulong address) 259 { 260 uintptr_t ra = GETPC(); 261 check_zicbo_envcfg(env, MENVCFG_CBIE, ra); 262 check_zicbom_access(env, address, ra); 263 264 /* We don't emulate the cache-hierarchy, so we're done. */ 265 } 266 267 #ifndef CONFIG_USER_ONLY 268 269 target_ulong helper_sret(CPURISCVState *env) 270 { 271 uint64_t mstatus; 272 target_ulong prev_priv, prev_virt = env->virt_enabled; 273 274 if (!(env->priv >= PRV_S)) { 275 riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, GETPC()); 276 } 277 278 target_ulong retpc = env->sepc; 279 if (!riscv_has_ext(env, RVC) && (retpc & 0x3)) { 280 riscv_raise_exception(env, RISCV_EXCP_INST_ADDR_MIS, GETPC()); 281 } 282 283 if (get_field(env->mstatus, MSTATUS_TSR) && !(env->priv >= PRV_M)) { 284 riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, GETPC()); 285 } 286 287 if (env->virt_enabled && get_field(env->hstatus, HSTATUS_VTSR)) { 288 riscv_raise_exception(env, RISCV_EXCP_VIRT_INSTRUCTION_FAULT, GETPC()); 289 } 290 291 mstatus = env->mstatus; 292 prev_priv = get_field(mstatus, MSTATUS_SPP); 293 mstatus = set_field(mstatus, MSTATUS_SIE, 294 get_field(mstatus, MSTATUS_SPIE)); 295 mstatus = set_field(mstatus, MSTATUS_SPIE, 1); 296 mstatus = set_field(mstatus, MSTATUS_SPP, PRV_U); 297 if (env->priv_ver >= PRIV_VERSION_1_12_0) { 298 mstatus = set_field(mstatus, MSTATUS_MPRV, 0); 299 } 300 env->mstatus = mstatus; 301 302 if (riscv_has_ext(env, RVH) && !env->virt_enabled) { 303 /* We support Hypervisor extensions and virtulisation is disabled */ 304 target_ulong hstatus = env->hstatus; 305 306 prev_virt = get_field(hstatus, HSTATUS_SPV); 307 308 hstatus = set_field(hstatus, HSTATUS_SPV, 0); 309 310 env->hstatus = hstatus; 311 312 if (prev_virt) { 313 riscv_cpu_swap_hypervisor_regs(env); 314 } 315 } 316 317 riscv_cpu_set_mode(env, prev_priv, prev_virt); 318 319 /* 320 * If forward cfi enabled for new priv, restore elp status 321 * and clear spelp in mstatus 322 */ 323 if (cpu_get_fcfien(env)) { 324 env->elp = get_field(env->mstatus, MSTATUS_SPELP); 325 } 326 env->mstatus = set_field(env->mstatus, MSTATUS_SPELP, 0); 327 328 return retpc; 329 } 330 331 static void check_ret_from_m_mode(CPURISCVState *env, target_ulong retpc, 332 target_ulong prev_priv) 333 { 334 if (!(env->priv >= PRV_M)) { 335 riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, GETPC()); 336 } 337 338 if (!riscv_has_ext(env, RVC) && (retpc & 0x3)) { 339 riscv_raise_exception(env, RISCV_EXCP_INST_ADDR_MIS, GETPC()); 340 } 341 342 if (riscv_cpu_cfg(env)->pmp && 343 !pmp_get_num_rules(env) && (prev_priv != PRV_M)) { 344 riscv_raise_exception(env, RISCV_EXCP_INST_ACCESS_FAULT, GETPC()); 345 } 346 } 347 348 target_ulong helper_mret(CPURISCVState *env) 349 { 350 target_ulong retpc = env->mepc; 351 uint64_t mstatus = env->mstatus; 352 target_ulong prev_priv = get_field(mstatus, MSTATUS_MPP); 353 354 check_ret_from_m_mode(env, retpc, prev_priv); 355 356 target_ulong prev_virt = get_field(env->mstatus, MSTATUS_MPV) && 357 (prev_priv != PRV_M); 358 mstatus = set_field(mstatus, MSTATUS_MIE, 359 get_field(mstatus, MSTATUS_MPIE)); 360 mstatus = set_field(mstatus, MSTATUS_MPIE, 1); 361 mstatus = set_field(mstatus, MSTATUS_MPP, 362 riscv_has_ext(env, RVU) ? PRV_U : PRV_M); 363 mstatus = set_field(mstatus, MSTATUS_MPV, 0); 364 if ((env->priv_ver >= PRIV_VERSION_1_12_0) && (prev_priv != PRV_M)) { 365 mstatus = set_field(mstatus, MSTATUS_MPRV, 0); 366 } 367 env->mstatus = mstatus; 368 369 if (riscv_has_ext(env, RVH) && prev_virt) { 370 riscv_cpu_swap_hypervisor_regs(env); 371 } 372 373 riscv_cpu_set_mode(env, prev_priv, prev_virt); 374 /* 375 * If forward cfi enabled for new priv, restore elp status 376 * and clear mpelp in mstatus 377 */ 378 if (cpu_get_fcfien(env)) { 379 env->elp = get_field(env->mstatus, MSTATUS_MPELP); 380 } 381 env->mstatus = set_field(env->mstatus, MSTATUS_MPELP, 0); 382 383 return retpc; 384 } 385 386 target_ulong helper_mnret(CPURISCVState *env) 387 { 388 target_ulong retpc = env->mnepc; 389 target_ulong prev_priv = get_field(env->mnstatus, MNSTATUS_MNPP); 390 target_ulong prev_virt; 391 392 check_ret_from_m_mode(env, retpc, prev_priv); 393 394 prev_virt = get_field(env->mnstatus, MNSTATUS_MNPV) && 395 (prev_priv != PRV_M); 396 env->mnstatus = set_field(env->mnstatus, MNSTATUS_NMIE, true); 397 398 /* 399 * If MNRET changes the privilege mode to a mode 400 * less privileged than M, it also sets mstatus.MPRV to 0. 401 */ 402 if (prev_priv < PRV_M) { 403 env->mstatus = set_field(env->mstatus, MSTATUS_MPRV, false); 404 } 405 406 if (riscv_has_ext(env, RVH) && prev_virt) { 407 riscv_cpu_swap_hypervisor_regs(env); 408 } 409 410 riscv_cpu_set_mode(env, prev_priv, prev_virt); 411 412 /* 413 * If forward cfi enabled for new priv, restore elp status 414 * and clear mnpelp in mnstatus 415 */ 416 if (cpu_get_fcfien(env)) { 417 env->elp = get_field(env->mnstatus, MNSTATUS_MNPELP); 418 } 419 env->mnstatus = set_field(env->mnstatus, MNSTATUS_MNPELP, 0); 420 421 return retpc; 422 } 423 424 void helper_wfi(CPURISCVState *env) 425 { 426 CPUState *cs = env_cpu(env); 427 bool rvs = riscv_has_ext(env, RVS); 428 bool prv_u = env->priv == PRV_U; 429 bool prv_s = env->priv == PRV_S; 430 431 if (((prv_s || (!rvs && prv_u)) && get_field(env->mstatus, MSTATUS_TW)) || 432 (rvs && prv_u && !env->virt_enabled)) { 433 riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, GETPC()); 434 } else if (env->virt_enabled && 435 (prv_u || (prv_s && get_field(env->hstatus, HSTATUS_VTW)))) { 436 riscv_raise_exception(env, RISCV_EXCP_VIRT_INSTRUCTION_FAULT, GETPC()); 437 } else { 438 cs->halted = 1; 439 cs->exception_index = EXCP_HLT; 440 cpu_loop_exit(cs); 441 } 442 } 443 444 void helper_wrs_nto(CPURISCVState *env) 445 { 446 if (env->virt_enabled && (env->priv == PRV_S || env->priv == PRV_U) && 447 get_field(env->hstatus, HSTATUS_VTW) && 448 !get_field(env->mstatus, MSTATUS_TW)) { 449 riscv_raise_exception(env, RISCV_EXCP_VIRT_INSTRUCTION_FAULT, GETPC()); 450 } else if (env->priv != PRV_M && get_field(env->mstatus, MSTATUS_TW)) { 451 riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, GETPC()); 452 } 453 } 454 455 void helper_tlb_flush(CPURISCVState *env) 456 { 457 CPUState *cs = env_cpu(env); 458 if (!env->virt_enabled && 459 (env->priv == PRV_U || 460 (env->priv == PRV_S && get_field(env->mstatus, MSTATUS_TVM)))) { 461 riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, GETPC()); 462 } else if (env->virt_enabled && 463 (env->priv == PRV_U || get_field(env->hstatus, HSTATUS_VTVM))) { 464 riscv_raise_exception(env, RISCV_EXCP_VIRT_INSTRUCTION_FAULT, GETPC()); 465 } else { 466 tlb_flush(cs); 467 } 468 } 469 470 void helper_tlb_flush_all(CPURISCVState *env) 471 { 472 CPUState *cs = env_cpu(env); 473 tlb_flush_all_cpus_synced(cs); 474 } 475 476 void helper_hyp_tlb_flush(CPURISCVState *env) 477 { 478 CPUState *cs = env_cpu(env); 479 480 if (env->virt_enabled) { 481 riscv_raise_exception(env, RISCV_EXCP_VIRT_INSTRUCTION_FAULT, GETPC()); 482 } 483 484 if (env->priv == PRV_M || 485 (env->priv == PRV_S && !env->virt_enabled)) { 486 tlb_flush(cs); 487 return; 488 } 489 490 riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, GETPC()); 491 } 492 493 void helper_hyp_gvma_tlb_flush(CPURISCVState *env) 494 { 495 if (env->priv == PRV_S && !env->virt_enabled && 496 get_field(env->mstatus, MSTATUS_TVM)) { 497 riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, GETPC()); 498 } 499 500 helper_hyp_tlb_flush(env); 501 } 502 503 static int check_access_hlsv(CPURISCVState *env, bool x, uintptr_t ra) 504 { 505 if (env->priv == PRV_M) { 506 /* always allowed */ 507 } else if (env->virt_enabled) { 508 riscv_raise_exception(env, RISCV_EXCP_VIRT_INSTRUCTION_FAULT, ra); 509 } else if (env->priv == PRV_U && !get_field(env->hstatus, HSTATUS_HU)) { 510 riscv_raise_exception(env, RISCV_EXCP_ILLEGAL_INST, ra); 511 } 512 513 int mode = get_field(env->hstatus, HSTATUS_SPVP); 514 if (!x && mode == PRV_S && get_field(env->vsstatus, MSTATUS_SUM)) { 515 mode = MMUIdx_S_SUM; 516 } 517 return mode | MMU_2STAGE_BIT; 518 } 519 520 target_ulong helper_hyp_hlv_bu(CPURISCVState *env, target_ulong addr) 521 { 522 uintptr_t ra = GETPC(); 523 int mmu_idx = check_access_hlsv(env, false, ra); 524 MemOpIdx oi = make_memop_idx(MO_UB, mmu_idx); 525 526 return cpu_ldb_mmu(env, adjust_addr_virt(env, addr), oi, ra); 527 } 528 529 target_ulong helper_hyp_hlv_hu(CPURISCVState *env, target_ulong addr) 530 { 531 uintptr_t ra = GETPC(); 532 int mmu_idx = check_access_hlsv(env, false, ra); 533 MemOpIdx oi = make_memop_idx(MO_TEUW, mmu_idx); 534 535 return cpu_ldw_mmu(env, adjust_addr_virt(env, addr), oi, ra); 536 } 537 538 target_ulong helper_hyp_hlv_wu(CPURISCVState *env, target_ulong addr) 539 { 540 uintptr_t ra = GETPC(); 541 int mmu_idx = check_access_hlsv(env, false, ra); 542 MemOpIdx oi = make_memop_idx(MO_TEUL, mmu_idx); 543 544 return cpu_ldl_mmu(env, adjust_addr_virt(env, addr), oi, ra); 545 } 546 547 target_ulong helper_hyp_hlv_d(CPURISCVState *env, target_ulong addr) 548 { 549 uintptr_t ra = GETPC(); 550 int mmu_idx = check_access_hlsv(env, false, ra); 551 MemOpIdx oi = make_memop_idx(MO_TEUQ, mmu_idx); 552 553 return cpu_ldq_mmu(env, adjust_addr_virt(env, addr), oi, ra); 554 } 555 556 void helper_hyp_hsv_b(CPURISCVState *env, target_ulong addr, target_ulong val) 557 { 558 uintptr_t ra = GETPC(); 559 int mmu_idx = check_access_hlsv(env, false, ra); 560 MemOpIdx oi = make_memop_idx(MO_UB, mmu_idx); 561 562 cpu_stb_mmu(env, adjust_addr_virt(env, addr), val, oi, ra); 563 } 564 565 void helper_hyp_hsv_h(CPURISCVState *env, target_ulong addr, target_ulong val) 566 { 567 uintptr_t ra = GETPC(); 568 int mmu_idx = check_access_hlsv(env, false, ra); 569 MemOpIdx oi = make_memop_idx(MO_TEUW, mmu_idx); 570 571 cpu_stw_mmu(env, adjust_addr_virt(env, addr), val, oi, ra); 572 } 573 574 void helper_hyp_hsv_w(CPURISCVState *env, target_ulong addr, target_ulong val) 575 { 576 uintptr_t ra = GETPC(); 577 int mmu_idx = check_access_hlsv(env, false, ra); 578 MemOpIdx oi = make_memop_idx(MO_TEUL, mmu_idx); 579 580 cpu_stl_mmu(env, adjust_addr_virt(env, addr), val, oi, ra); 581 } 582 583 void helper_hyp_hsv_d(CPURISCVState *env, target_ulong addr, target_ulong val) 584 { 585 uintptr_t ra = GETPC(); 586 int mmu_idx = check_access_hlsv(env, false, ra); 587 MemOpIdx oi = make_memop_idx(MO_TEUQ, mmu_idx); 588 589 cpu_stq_mmu(env, adjust_addr_virt(env, addr), val, oi, ra); 590 } 591 592 /* 593 * TODO: These implementations are not quite correct. They perform the 594 * access using execute permission just fine, but the final PMP check 595 * is supposed to have read permission as well. Without replicating 596 * a fair fraction of cputlb.c, fixing this requires adding new mmu_idx 597 * which would imply that exact check in tlb_fill. 598 */ 599 target_ulong helper_hyp_hlvx_hu(CPURISCVState *env, target_ulong addr) 600 { 601 uintptr_t ra = GETPC(); 602 int mmu_idx = check_access_hlsv(env, true, ra); 603 MemOpIdx oi = make_memop_idx(MO_TEUW, mmu_idx); 604 605 return cpu_ldw_code_mmu(env, addr, oi, GETPC()); 606 } 607 608 target_ulong helper_hyp_hlvx_wu(CPURISCVState *env, target_ulong addr) 609 { 610 uintptr_t ra = GETPC(); 611 int mmu_idx = check_access_hlsv(env, true, ra); 612 MemOpIdx oi = make_memop_idx(MO_TEUL, mmu_idx); 613 614 return cpu_ldl_code_mmu(env, addr, oi, ra); 615 } 616 617 #endif /* !CONFIG_USER_ONLY */ 618