qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 21/26] target-xtensa: implement unaligned except


From: Max Filippov
Subject: Re: [Qemu-devel] [PATCH 21/26] target-xtensa: implement unaligned exception option
Date: Sun, 22 May 2011 16:10:16 +0400
User-agent: KMail/1.13.6 (Linux/2.6.34.8-68.fc13.x86_64; KDE/4.5.5; x86_64; ; )

> > +static void gen_load_store_alignment(DisasContext *dc, int shift, TCGv_i32 
> > addr)
> > +{
> > +    TCGv_i32 tmp = tcg_temp_local_new_i32();
> > +    tcg_gen_mov_i32(tmp, addr);
> > +    tcg_gen_andi_i32(addr, addr, ~0 << shift);
> > +    if (option_enabled(dc, XTENSA_OPTION_UNALIGNED_EXCEPTION)) {
> > +        int label = gen_new_label();
> > +        tcg_gen_brcond_i32(TCG_COND_EQ, addr, tmp, label);
> > +        gen_exception_cause_vaddr(dc, LOAD_STORE_ALIGNMENT_CAUSE, tmp);
> > +        gen_set_label(label);
> > +    }
> > +    tcg_temp_free(tmp);
> > +}
> 
> This is not the correct method for this.  Set ALIGNED_ONLY before
> defining the softmmu_templates.  Define do_unaligned_access to raise
> the exception.  See e.g. target-sparc/op_helper.c.

There are three alignment possibilities for xtensa: no unaligned exception, 
unaligned exception and hardware alignment.
In the first case unaligned access silently goes to aligned address. It looks 
like it cannot be done via do_unaligned_access, can it?
In the third case most unaligned accesses are handled transparently by the 
hardware. But e.g. unaligned access by multiprocessor synchronization 
instructions still cause alignment exception. Do I need to implement a 
different alignment checking mechanism for those unhandled cases?

Thanks.
-- Max



reply via email to

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