linux-mips
[Top] [All Lists]

Re: Once again: test_and_set for CPUs w/o LL/SC

To: Daniel Jacobowitz <dan@debian.org>
Subject: Re: Once again: test_and_set for CPUs w/o LL/SC
From: Johannes Stezenbach <js@convergence.de>
Date: Tue, 15 Oct 2002 19:52:05 +0200
Cc: "Kevin D. Kissell" <kevink@mips.com>, linux-mips@linux-mips.org
In-reply-to: <20021007185136.GA16501@nevyn.them.org>
Mail-followup-to: Johannes Stezenbach <js@convergence.de>, Daniel Jacobowitz <dan@debian.org>, "Kevin D. Kissell" <kevink@mips.com>, linux-mips@linux-mips.org
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20020916164034.GA12489@convergence.de> <20021007144749.GB16641@convergence.de> <01fd01c26e1d$add77240$10eca8c0@grendel> <20021007184344.GA17548@convergence.de> <20021007185136.GA16501@nevyn.them.org>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.4i
On Mon, Oct 07, 2002 at 02:51:36PM -0400, Daniel Jacobowitz wrote:
> On Mon, Oct 07, 2002 at 08:43:44PM +0200, Johannes Stezenbach wrote:
> > The question is how the glibc can detect if
> > a) the CPU does not have LL/SC
> > b) the kernel guarantees k1 != MAGIC
> 
> You should be using an "aux vector"; see how PowerPC provides current
> glibc with the size of a cache line.

It took me a while to figure out how aux vectors work.

It seems to me that MIPS does not use the hardware capabilities
field of the aux vector at all. TO use it, one would
have to

- add a field to struct cpuinfo_mips in include/asm-mips/processor.h,
  and set it in arch/mips/kernel/setup.c after CPU probing;
- define ELF_HWCAP in include/asm-mips/elf.h to return
  something useful from the new cpuinfo_mips field

Or, to just use it to signal "use beql k1, MAGIC instead of LL/SC",
one could just define ELF_HWCAP dependent on kernel-Config.

Anyway, we would have to document the meaning of the HWCAP bits
as part of the kernel ABI.

i386 uses this, as you can see by running e.g.
  $ LD_SHOW_AUXV=1 ls
provided you have glibc-2.2.5.

glibc/sysdeps/generic/dl-sysdep.c then reads it into dl_hwcap,
and it's up to platform specific code to use it.


Regards,
Johannes

<Prev in Thread] Current Thread [Next in Thread>