Subject: Re: RFC: Change SWI number base?
To: David Laight <David.Laight@btinternet.com>
From: Richard Earnshaw <email@example.com>
Date: 01/09/2002 00:19:03
> Is it worth defining a thumb swi (1 of 256) just for this piece of code?
I don't really think so.
> I guess this means the swi code does have to check for thumb mode after all.
It must do that, since the PC may not be aligned if we swi from Thumb
mode, so we can't just blindly load a word from the PC as we do now.
> > .code 16
> > .align 0
> > SWI_nnn:
> > bx pc /* Switch to arm code */
> > nop
> > .code 32
> > swi nnn
> > ldrcs ip, L__cerror
> > bxcc lr /* Return if no error */
> > bx ip
> Yes - fairly neat. Need to get the alignment right though.
> think that requires a .align 2 (or a .balign 4), and a sanity check!
No need, "align 0" has always meant "word aligned" for traditional
compatibility with old assemblers (pre gas).
> pull the 'bxcc lr' up an instruction...
It's currently in the delay slot for the load instruction (though you
might argue that failure is sufficiently rare that it isn't worth the
extra cycle for the non failure case in order to save a cycle for the
Note that if we knew __cerror was arm code we could simplify the final