[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 6/7] target/riscv: Remove the Hypervisor access check func
From: |
Richard Henderson |
Subject: |
Re: [PATCH v3 6/7] target/riscv: Remove the Hypervisor access check function |
Date: |
Tue, 3 Nov 2020 12:26:27 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
On 11/3/20 11:51 AM, Alistair Francis wrote:
> @@ -199,7 +271,16 @@ static bool trans_hlv_wu(DisasContext *ctx, arg_hlv_wu
> *a)
> TCGv t0 = tcg_temp_new();
> TCGv t1 = tcg_temp_new();
>
> - gen_helper_hyp_access_check(cpu_env);
> + if (!ctx->hlsx) {
> + if (ctx->virt_enabled) {
> + generate_exception(ctx, RISCV_EXCP_VIRT_INSTRUCTION_FAULT);
> + } else {
> + generate_exception(ctx, RISCV_EXCP_ILLEGAL_INST);
> + }
> + exit_tb(ctx); /* no chaining */
> + ctx->base.is_jmp = DISAS_NORETURN;
> + return false;
> + }
>
> gen_get_gpr(t0, a->rs1);
>
> @@ -221,7 +302,16 @@ static bool trans_hlv_d(DisasContext *ctx, arg_hlv_d *a)
> TCGv t0 = tcg_temp_new();
> TCGv t1 = tcg_temp_new();
>
> - gen_helper_hyp_access_check(cpu_env);
> + if (!ctx->hlsx) {
> + if (ctx->virt_enabled) {
> + generate_exception(ctx, RISCV_EXCP_VIRT_INSTRUCTION_FAULT);
> + } else {
> + generate_exception(ctx, RISCV_EXCP_ILLEGAL_INST);
> + }
> + exit_tb(ctx); /* no chaining */
> + ctx->base.is_jmp = DISAS_NORETURN;
generate_exception already is noreturn. The exit_tb is unreachable. You
should extract this to a helper function anyway, instead of 6 copies.
I would squash this with the previous, so that you don't add
helper_hyp_access_check and then remove it in the next patch.
r~
- [PATCH v3 1/7] target/riscv: Merge m/vsstatus and m/vsstatush into one uint64_t unit, (continued)
- [PATCH v3 1/7] target/riscv: Merge m/vsstatus and m/vsstatush into one uint64_t unit, Alistair Francis, 2020/11/03
- [PATCH v3 2/7] target/riscv: Add a virtualised MMU Mode, Alistair Francis, 2020/11/03
- [PATCH v3 3/7] target/riscv: Set the virtualised MMU mode when doing hyp accesses, Alistair Francis, 2020/11/03
- [PATCH v3 4/7] target/riscv: Remove the HS_TWO_STAGE flag, Alistair Francis, 2020/11/03
- [PATCH v3 5/7] target/riscv: Remove the hyp load and store functions, Alistair Francis, 2020/11/03
- [PATCH v3 6/7] target/riscv: Remove the Hypervisor access check function, Alistair Francis, 2020/11/03
- Re: [PATCH v3 6/7] target/riscv: Remove the Hypervisor access check function,
Richard Henderson <=
- [PATCH v3 7/7] target/riscv: Split the Hypervisor execute load helpers, Alistair Francis, 2020/11/03