mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: Mahesh Bodapati <Mahesh.Bodapati@imgtec.com>
Cc: Szabolcs Nagy <nsz@port70.net>,
	Jaydeep Patil <Jaydeep.Patil@imgtec.com>,
	Anand Takale <Anand.Takale@imgtec.com>,
	musl@lists.openwall.com
Subject: Re: Re: mips n64 porting review
Date: Thu, 4 Feb 2016 23:27:34 -0500	[thread overview]
Message-ID: <20160205042734.GV9349@brightrain.aerifal.cx> (raw)
In-Reply-To: <20160204235246.GU9349@brightrain.aerifal.cx>

On Thu, Feb 04, 2016 at 06:52:47PM -0500, Rich Felker wrote:
> On Wed, Feb 03, 2016 at 06:36:57PM -0500, Rich Felker wrote:
> > On Wed, Feb 03, 2016 at 03:41:13PM +0000, Mahesh Bodapati wrote:
> > > Hi Rich,
> > > I have attached the patch which has all the MIPS n64 porting work. I
> > > have created mips64port remote branch on GitHub and the repository
> > > is https://github.com/MaheshBodapati/musl/tree/mips64port which has
> > > the broken down patches and the base revision on which I have
> > > prepared patch is v1.1.12-41-g3abb094.
> > 
> > Some preliminary review:
> 
> One more thing that came up in reviewing syscall_cp.s was actually a
> bug copied from existing code in musl, which is fixed by this commit:
> 
> http://git.musl-libc.org/cgit/musl/commit/?id=756c8af8589265e99e454fe3adcda1d0bc5e1963
> 
> In practice the code seemed to work but it was wrong with respect to
> ABI requirements.
> 
> I think the way you're saving $gp on the stack in sigsetjmp.s is also
> invalid since that part of the stack will have been clobbered by the
> time setjmp returns a second time. You could save it inside an unused
> part of the jump buffer, but it might be better to just avoid the $gp
> register and instead use temp registers and possibly some pc-relative
> address computations.

Likewise in pipe.s, it's overly complicated by the fact that it's
saving $gp on the stack and thereby can't make a tail call to
__syscall_ret like it's intended to. If you just use a different
register instead of $gp that's call-clobbered you can tail-call just
like the 32-bit mips version. Alternatively it's possible now to write
src/unistd/mips64/pipe.c instead using inline asm and let the compiler
handle the nastiness of the calling convention. I'd be happy with
either approach; the C version is probably mildly nicer, especially if
the compiler still does the tail-call right and doesn't generate come
bloated monstrosity. (Note that you can't use C for sigsetjmp though
because it can't use the stack.)

At this point I think I've looked through all the mips64 files at
least once and caught all the important issues.

Rich


  reply	other threads:[~2016-02-05  4:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <DE16056458B9894F9D46202EC1BBB28B3BDC3210@PUMAIL01.pu.imgtec.org>
2016-02-03 23:36 ` Rich Felker
2016-02-04 23:52   ` Rich Felker
2016-02-05  4:27     ` Rich Felker [this message]
2016-02-12 18:51       ` Rich Felker
2016-02-15  4:46         ` Jaydeep Patil
2016-02-04  0:45 ` Szabolcs Nagy

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=20160205042734.GV9349@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=Anand.Takale@imgtec.com \
    --cc=Jaydeep.Patil@imgtec.com \
    --cc=Mahesh.Bodapati@imgtec.com \
    --cc=musl@lists.openwall.com \
    --cc=nsz@port70.net \
    /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).