mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
To: Rich Felker <dalias@libc.org>
Cc: musl@lists.openwall.com
Subject: Re: How to build a musl toolchain for or1k
Date: Sun, 20 Jul 2014 09:18:33 +0300	[thread overview]
Message-ID: <20140720061832.GA28475@chokladfabriken.org> (raw)
In-Reply-To: <20140719230655.GG17402@brightrain.aerifal.cx>

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


      reply	other threads:[~2014-07-20  6:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-19 22:26 Stefan Kristiansson
2014-07-19 23:06 ` Rich Felker
2014-07-20  6:18   ` Stefan Kristiansson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140720061832.GA28475@chokladfabriken.org \
    --to=stefan.kristiansson@saunalahti.fi \
    --cc=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).