This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: SVC SPSR overwritten in Arm HAL


Mark Salter wrote:
> [...]
> The bne has more of an impact (due to the pipeline) than a simple
> instruction. I think the code should look like this:
> 
>          // return to supervisor mode is simple
>          and     r1,r0,#CPSR_MODE_BITS
>          cmp     r1,#CPSR_SUPERVISOR_MODE
>          msreq   cpsr, r0
>          ldmeqfd sp, {r0-r14, pc}
>          msr     spsr, r0
>          ...
> 
> Cancelling two insns because of condition codes is generally cheaper
> than branching around them. This adds extra overhead to the return to
> SVC mode case and only one insn in the other (much less likely) case.

You are right, but, in case we return to svc mode, the code above makes
the cpsr and its condition code flags being restored to their
pre-exception value ; thus the execution of the ldmeqfd instruction will
be based on an erroneous condition....

Pierre
-- 
________________________________________________________________________
Pierre HABRAKEN - mailto:Pierre dot Habraken at imag dot fr
Tél: 04 76 82 72 83 - Fax: 04 76 82 72 87
IMAG-LSR BP72 38402 SAINT MARTIN D'HERES Cedex
________________________________________________________________________


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]