Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Apr 2012 14:03:09 -0600
From:      Ian Lepore <freebsd@damnhippie.dyndns.org>
To:        Juli Mallett <jmallett@freebsd.org>
Cc:        Andrew Turner <andrew@freebsd.org>, svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r234337 - in head: lib/libc/arm/gen sys/arm/include
Message-ID:  <1334606589.1082.201.camel@revolution.hippie.lan>
In-Reply-To: <CACVs6=8BYYN0ZW7zzHZduns-ZH9hUF=M1EmXfoOkCZVMh1ubpg@mail.gmail.com>
References:  <201204160938.q3G9cLmw026093@svn.freebsd.org> <CACVs6=8BYYN0ZW7zzHZduns-ZH9hUF=M1EmXfoOkCZVMh1ubpg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 2012-04-16 at 12:41 -0700, Juli Mallett wrote:
> On Mon, Apr 16, 2012 at 02:38, Andrew Turner <andrew@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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1334606589.1082.201.camel>