svn commit: r234337 - in head: lib/libc/arm/gen sys/arm/include

Ian Lepore freebsd at damnhippie.dyndns.org
Mon Apr 16 20:03:18 UTC 2012


On Mon, 2012-04-16 at 12:41 -0700, Juli Mallett wrote:
> On Mon, Apr 16, 2012 at 02:38, Andrew Turner <andrew at freebsd.org> wrote:
> > Log:
> >  Replace the C implementation of __aeabi_read_tp with an assembly version.
> >  This ensures we follow the ABI by preserving registers r1-r3.
> 
> > +ENTRY(__aeabi_read_tp)
> > +       ldr     r0, .Larm_tp_address
> > +       ldr     r0, [r0]
> > +       RET
> > +
> > +.Larm_tp_address:
> > +       .word ARM_TP_ADDRESS
> > +
> 
> Why is this indirection required?  Can't you just use ARM_TP_ADDRESS
> instead of loading it from data?  Also, is our convention for ARM to
> use END() with ENTRY() or not?

It used to be possible to directly load ARM_TP_ADDRESS into a register
when it had a cleverly-crafted value that made use of ARM's ability to
encode a constant value into an instruction if it can be expressed as an
8-bit value shifted by anything up to 31 bits.  (iirc, it used to be
0xe0000000).  At some point that address became a problem for someone
and it got changed to a value which can no longer be encoded within the
instruction.  The alternative is to load it with a single instruction by
using a pc-relative address, or use a series of load-and-shift
instructions to form the new more complex constant.

Ick.

-- Ian




More information about the svn-src-all mailing list