mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-03-24 22:25:11 +00:00
target/riscv: Move the hfence instructions to the rvh decode
Also correct the name of the VVMA instruction. Backports commit b8429ded723ec52568e05f6a24ed78c93224687c from qemu
This commit is contained in:
parent
39ff690eff
commit
8eb8bc290f
|
@ -64,7 +64,7 @@
|
||||||
@r2 ....... ..... ..... ... ..... ....... %rs1 %rd
|
@r2 ....... ..... ..... ... ..... ....... %rs1 %rd
|
||||||
|
|
||||||
@hfence_gvma ....... ..... ..... ... ..... ....... %rs2 %rs1
|
@hfence_gvma ....... ..... ..... ... ..... ....... %rs2 %rs1
|
||||||
@hfence_bvma ....... ..... ..... ... ..... ....... %rs2 %rs1
|
@hfence_vvma ....... ..... ..... ... ..... ....... %rs2 %rs1
|
||||||
|
|
||||||
@sfence_vma ....... ..... ..... ... ..... ....... %rs2 %rs1
|
@sfence_vma ....... ..... ..... ... ..... ....... %rs2 %rs1
|
||||||
@sfence_vm ....... ..... ..... ... ..... ....... %rs1
|
@sfence_vm ....... ..... ..... ... ..... ....... %rs1
|
||||||
|
@ -77,8 +77,6 @@ uret 0000000 00010 00000 000 00000 1110011
|
||||||
sret 0001000 00010 00000 000 00000 1110011
|
sret 0001000 00010 00000 000 00000 1110011
|
||||||
mret 0011000 00010 00000 000 00000 1110011
|
mret 0011000 00010 00000 000 00000 1110011
|
||||||
wfi 0001000 00101 00000 000 00000 1110011
|
wfi 0001000 00101 00000 000 00000 1110011
|
||||||
hfence_gvma 0110001 ..... ..... 000 00000 1110011 @hfence_gvma
|
|
||||||
hfence_bvma 0010001 ..... ..... 000 00000 1110011 @hfence_bvma
|
|
||||||
sfence_vma 0001001 ..... ..... 000 00000 1110011 @sfence_vma
|
sfence_vma 0001001 ..... ..... 000 00000 1110011 @sfence_vma
|
||||||
sfence_vm 0001000 00100 ..... 000 00000 1110011 @sfence_vm
|
sfence_vm 0001000 00100 ..... 000 00000 1110011 @sfence_vm
|
||||||
|
|
||||||
|
@ -207,3 +205,7 @@ fcvt_w_d 1100001 00000 ..... ... ..... 1010011 @r2_rm
|
||||||
fcvt_wu_d 1100001 00001 ..... ... ..... 1010011 @r2_rm
|
fcvt_wu_d 1100001 00001 ..... ... ..... 1010011 @r2_rm
|
||||||
fcvt_d_w 1101001 00000 ..... ... ..... 1010011 @r2_rm
|
fcvt_d_w 1101001 00000 ..... ... ..... 1010011 @r2_rm
|
||||||
fcvt_d_wu 1101001 00001 ..... ... ..... 1010011 @r2_rm
|
fcvt_d_wu 1101001 00001 ..... ... ..... 1010011 @r2_rm
|
||||||
|
|
||||||
|
# *** RV32H Base Instruction Set ***
|
||||||
|
hfence_gvma 0110001 ..... ..... 000 00000 1110011 @hfence_gvma
|
||||||
|
hfence_vvma 0010001 ..... ..... 000 00000 1110011 @hfence_vvma
|
||||||
|
|
|
@ -99,43 +99,3 @@ static bool trans_sfence_vm(DisasContext *ctx, arg_sfence_vm *a)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool trans_hfence_gvma(DisasContext *ctx, arg_sfence_vma *a)
|
|
||||||
{
|
|
||||||
#ifndef CONFIG_USER_ONLY
|
|
||||||
TCGContext *tcg_ctx = ctx->uc->tcg_ctx;
|
|
||||||
if (has_ext(ctx, RVH)) {
|
|
||||||
/* Hpervisor extensions exist */
|
|
||||||
/*
|
|
||||||
* if (env->priv == PRV_M ||
|
|
||||||
* (env->priv == PRV_S &&
|
|
||||||
* !riscv_cpu_virt_enabled(env) &&
|
|
||||||
* get_field(ctx->mstatus_fs, MSTATUS_TVM))) {
|
|
||||||
*/
|
|
||||||
gen_helper_tlb_flush(tcg_ctx, tcg_ctx->cpu_env);
|
|
||||||
return true;
|
|
||||||
/* } */
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool trans_hfence_bvma(DisasContext *ctx, arg_sfence_vma *a)
|
|
||||||
{
|
|
||||||
#ifndef CONFIG_USER_ONLY
|
|
||||||
TCGContext *tcg_ctx = ctx->uc->tcg_ctx;
|
|
||||||
if (has_ext(ctx, RVH)) {
|
|
||||||
/* Hpervisor extensions exist */
|
|
||||||
/*
|
|
||||||
* if (env->priv == PRV_M ||
|
|
||||||
* (env->priv == PRV_S &&
|
|
||||||
* !riscv_cpu_virt_enabled(env) &&
|
|
||||||
* get_field(ctx->mstatus_fs, MSTATUS_TVM))) {
|
|
||||||
*/
|
|
||||||
gen_helper_tlb_flush(tcg_ctx, tcg_ctx->cpu_env);
|
|
||||||
return true;
|
|
||||||
/* } */
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
57
qemu/target/riscv/insn_trans/trans_rvh.inc.c
Normal file
57
qemu/target/riscv/insn_trans/trans_rvh.inc.c
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
/*
|
||||||
|
* RISC-V translation routines for the RVXI Base Integer Instruction Set.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2020 Western Digital
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms and conditions of the GNU General Public License,
|
||||||
|
* version 2 or later, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static bool trans_hfence_gvma(DisasContext *ctx, arg_sfence_vma *a)
|
||||||
|
{
|
||||||
|
#ifndef CONFIG_USER_ONLY
|
||||||
|
TCGContext *tcg_ctx = ctx->uc->tcg_ctx;
|
||||||
|
if (has_ext(ctx, RVH)) {
|
||||||
|
/* Hpervisor extensions exist */
|
||||||
|
/*
|
||||||
|
* if (env->priv == PRV_M ||
|
||||||
|
* (env->priv == PRV_S &&
|
||||||
|
* !riscv_cpu_virt_enabled(env) &&
|
||||||
|
* get_field(ctx->mstatus_fs, MSTATUS_TVM))) {
|
||||||
|
*/
|
||||||
|
gen_helper_tlb_flush(tcg_ctx, tcg_ctx->cpu_env);
|
||||||
|
return true;
|
||||||
|
/* } */
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool trans_hfence_vvma(DisasContext *ctx, arg_sfence_vma *a)
|
||||||
|
{
|
||||||
|
#ifndef CONFIG_USER_ONLY
|
||||||
|
TCGContext *tcg_ctx = ctx->uc->tcg_ctx;
|
||||||
|
if (has_ext(ctx, RVH)) {
|
||||||
|
/* Hpervisor extensions exist */
|
||||||
|
/*
|
||||||
|
* if (env->priv == PRV_M ||
|
||||||
|
* (env->priv == PRV_S &&
|
||||||
|
* !riscv_cpu_virt_enabled(env) &&
|
||||||
|
* get_field(ctx->mstatus_fs, MSTATUS_TVM))) {
|
||||||
|
*/
|
||||||
|
gen_helper_tlb_flush(tcg_ctx, tcg_ctx->cpu_env);
|
||||||
|
return true;
|
||||||
|
/* } */
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
|
}
|
|
@ -742,6 +742,7 @@ static bool gen_shift(DisasContext *ctx, arg_r *a,
|
||||||
#include "insn_trans/trans_rva.inc.c"
|
#include "insn_trans/trans_rva.inc.c"
|
||||||
#include "insn_trans/trans_rvf.inc.c"
|
#include "insn_trans/trans_rvf.inc.c"
|
||||||
#include "insn_trans/trans_rvd.inc.c"
|
#include "insn_trans/trans_rvd.inc.c"
|
||||||
|
#include "insn_trans/trans_rvh.inc.c"
|
||||||
#include "insn_trans/trans_privileged.inc.c"
|
#include "insn_trans/trans_privileged.inc.c"
|
||||||
|
|
||||||
/* Include the auto-generated decoder for 16 bit insn */
|
/* Include the auto-generated decoder for 16 bit insn */
|
||||||
|
|
Loading…
Reference in a new issue