mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Bobby Bingham <koorogi@koorogi.info>
To: musl@lists.openwall.com
Subject: Re: [PATCH v2] add powerpc64 port
Date: Thu, 14 Apr 2016 19:55:51 -0500	[thread overview]
Message-ID: <20160415005551.GA24404@dora.lan> (raw)
In-Reply-To: <20160414191400.GZ21636@brightrain.aerifal.cx>

On Thu, Apr 14, 2016 at 03:14:00PM -0400, Rich Felker wrote:
> On Thu, Apr 14, 2016 at 03:01:38AM -0500, Bobby Bingham wrote:
> > On Thu, Apr 14, 2016 at 01:05:07AM +0200, Szabolcs Nagy wrote:
> > > * Bobby Bingham <koorogi@koorogi.info> [2016-04-04 00:26:11 -0500]:
> > > > +++ b/arch/powerpc64/bits/setjmp.h
> > > > @@ -0,0 +1 @@
> > > > +typedef unsigned long long __jmp_buf[66];
> > > 
> > > hm glibc seems to use long[64] with 16byte alignment,
> > > is the size diff because of alignment?
> > 
> > Yes.  Though apparently the glibc setjmp asm has code to detect a
> > misaligned jmp_buf, but its handling of that case ends up overflowing
> > the jmp_buf.
> > 
> > I can make some changes to get our jmp_buf down to 65, but the only ways
> > to get it down to 64 are either with 16 byte alignment, or to have setjmp
> > spill vector registers to the stack first so it can copy them from there
> > to the jmp_buf through a gpr.
> > 
> > How important is it to match glibc here?
> 
> I think you could avoid the need for alignment or increased buffer
> size by positioning the vector registers at
> jmp_buf_end-vector_save_size rounded _down_ to alignment, then
> positioning the grps around them (so, putting the last gpr at the end
> rather than before the vectors if the buffer as a whole is
> misaligned).

Is it valid to do the following?

	jmp_buf a, b;
	if (!setjmp(a)) {
		memcpy(b, a, sizeof a);
		longjmp(b, 1);
	}

If that's valid, and the two jmp_bufs might be aligned differently, then
this wouldn't work.

> 
> But it might be preferable to have the alignment match ABI too. Is
> there any way it can be achieved with just things guaranteed to exist
> by the psABI (is __int128 required by the psABI?) or does it require
> C11 and/or GNUC attributes to get 16-byte alignment?

The ABI does specify __int128.  I can switch jmp_buf to this.

> 
> Rich


  reply	other threads:[~2016-04-15  0:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-04  5:26 Bobby Bingham
2016-04-13 23:05 ` Szabolcs Nagy
2016-04-13 23:13   ` Rich Felker
2016-04-14  0:58     ` Szabolcs Nagy
2016-04-14  8:01   ` Bobby Bingham
2016-04-14 13:42     ` Szabolcs Nagy
2016-04-15 20:38       ` Szabolcs Nagy
2016-04-16 17:09         ` Rich Felker
2016-04-28  1:38           ` Bobby Bingham
2016-04-28  2:07             ` Rich Felker
2016-04-30 20:15               ` Bobby Bingham
2016-04-14 19:14     ` Rich Felker
2016-04-15  0:55       ` Bobby Bingham [this message]
2016-04-15  2:08         ` Rich Felker

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=20160415005551.GA24404@dora.lan \
    --to=koorogi@koorogi.info \
    --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).