This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
Re: mips RDHWR instruction in glibc
- From: Daniel Jacobowitz <dan at debian dot org>
- To: Atsushi Nemoto <anemo at mba dot ocn dot ne dot jp>
- Cc: libc-ports at sourceware dot org, linux-mips at linux-mips dot org
- Date: Wed, 14 Jun 2006 12:50:40 -0400
- Subject: Re: mips RDHWR instruction in glibc
- References: <20060615.001238.65193088.anemo@mba.ocn.ne.jp>
On Thu, Jun 15, 2006 at 12:12:38AM +0900, Atsushi Nemoto wrote:
> If a system call returned an error, glibc must save the result to
> errno, which is thread-local, so RDHWR used. I can understand this
> scenario. But it seems the RDHWR is often called on non-error cases.
Libc uses TLS for many things other than just errno. The GCC port
knows how to generate the agreed-upon rdhwr instruction directly.
> For example, in the code below, RDHWR is placed _before_ checking the
> error. I suppose these instructions were reordered by gcc's
> optimization, but the optimization would have large negative effect in
> this case.
You'd have to figure out how to get GCC not to eagerly schedule the
rdhwr. This might be quite hard. I don't know much about this part of
the scheduler.
--
Daniel Jacobowitz
CodeSourcery