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