qemu-devel
[Top][All Lists]
Advanced

[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~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]