Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20140720061832.GA28475@chokladfabriken.org>
Date: Sun, 20 Jul 2014 09:18:33 +0300
From: Stefan Kristiansson <stefan.kristiansson@...nalahti.fi>
To: Rich Felker <dalias@...c.org>
Cc: musl@...ts.openwall.com
Subject: Re: How to build a musl toolchain for or1k

On Sat, Jul 19, 2014 at 07:06:56PM -0400, Rich Felker wrote:
> On Sun, Jul 20, 2014 at 01:26:29AM +0300, Stefan Kristiansson wrote:
> > Mainline kernel is missing support for a couple of features required
> > by musl (mostly related to the atomic instructions). I've added
> > support for them, but sending out patches for them is yet to be done.
> > In the meantime, they are all present in the smp branch of
> > git://openrisc.net/stefan/linux.
> 
> What kernel features are needed for atomics to work? I figured it was
> mainly a cpu-level issue. Or were changes needed for the kernel to
> properly clear the lwa/swa flag on context switch?
> 

It is mainly a cpu-level issue, and there's actually only two patches in that
branch that are required for musl to work.
1) There's no way on or1k to determine if a data page fault was
a read or write fault other than reading the instruction at the
faulting PC and check if it was a store instructions.
The atomic store instruction (l.swa) was missing from this check.
http://git.openrisc.net/cgit.cgi/stefan/linux/commit/?h=smp&id=a966c95bb10a43cab16e2be97518ad8be0695a95

2) In order to get kernel support for robust_list, there need to be
arch specific implementations of the futex_atomic_* operations.
These implementations were missing.
http://git.openrisc.net/cgit.cgi/stefan/linux/commit/?h=smp&id=d863b0637811dd559363a3f1bf9d966e35b21bab

> It would be really nice if the kernel could also trap and emulate
> l.lwa/l.swa and perhaps also l.msync so that these features could be
> used on old emulators/hardware that lack them.
> 

I agree.

> > git clone -b smp git://openrisc.net/stefan/linux
> > make ARCH=openrisc musl_defconfig
> > make ARCH=openrisc
> 
> What's special in musl_defconfig? :)
> 

Actually very little ;)
The support for the atomic instructions is enabled.

Stefan

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.