qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC 18/28] target-xtensa: implement exceptions


From: Richard Henderson
Subject: Re: [Qemu-devel] [RFC 18/28] target-xtensa: implement exceptions
Date: Wed, 04 May 2011 09:33:19 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Thunderbird/3.1.10

On 05/03/2011 05:59 PM, Max Filippov wrote:
> +static void gen_check_privilege(DisasContext *dc)
> +{
> +    if (option_enabled(dc, XTENSA_OPTION_MMU)) {
> +        TCGv_i32 tmp = tcg_temp_new_i32();
> +        int label = gen_new_label();
> +
> +        tcg_gen_andi_i32(tmp, cpu_SR[PS], PS_EXCM);
> +        tcg_gen_brcondi_i32(TCG_COND_EQ, tmp, PS_EXCM, label);
> +        tcg_gen_andi_i32(tmp, cpu_SR[PS], PS_RING);
> +        tcg_gen_brcondi_i32(TCG_COND_GEU, tmp, 0, label);
> +
> +        gen_exception_cause(dc, PRIVILEGED_CAUSE);
> +
> +        gen_set_label(label);
> +        tcg_temp_free(tmp);
> +    }
> +}

This is a case where you almost certainly want to check this 
condition inside QEMU and translate the opcode differently.

See cpu_get_tb_cpu_state, which sets bits in *flags.  These
flags can then be checked in tb->flags while translating.
At which point you'd avoid all the conditionalization on
the value in PS here in check_privilege and merely issue
the exception_cause.

The ARM port is a good example for testing these sorts of bits.


r~



reply via email to

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