9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: ron minnich <rminnich@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>,
	Pavel Zholkover <paulzhol@gmail.com>
Subject: Re: [9fans] plan9 go output faults on 9vx with rfork
Date: Sat, 22 Jan 2011 18:43:01 -0800	[thread overview]
Message-ID: <AANLkTintBhp2pxpdAGnMD2H=1J-gA+cF=GfFzX=MzPrr@mail.gmail.com> (raw)
In-Reply-To: <AANLkTi=fi2Xm0R1Jx2NcrKUkyJaYqnizDP0xJPgaenMY@mail.gmail.com>

This started to look like a 32/64 problem and I think it is. If you
trace the cmpswap, at some point we see 100000000 as a value, just
like somebody added 1 to ffffffff, and it went to, not 0, as expected,
but a bigger value.

See this code:

long
syssemacquire(uint32 *arg)
{
        int block;
        long *addr;
        Segment *s;

        addr = uvalidaddr(arg[0], sizeof(long), 1);
        evenaddr(arg[0]);
        block = arg[1];

        if((s = seg(up, arg[0], 0)) == nil)
                error(Ebadarg);
        if(*addr < 0)
                error(Ebadarg);
        return semacquire(s, addr, block);
}

And note how the u32int is actually converted to a pointer to a long,
which is 64 bits. I put a panic in there on sizeof(*addr) !=
sizeof(*arg) and bang! away we go.

So it's a 32/64 bit cleanliness problem. And it's not just for go,
it's for everything.

This is a huge problem as pentium is little-endian and you're going to
end up trashing data. Bad.

I will try to put a fix in now. We just need to be a little cleaner
about realizing that the syscall interface is always 32 bits, even
when 9vx is built as 64 bits. This is pretty much the TOS thing all
over again.

ron



  parent reply	other threads:[~2011-01-23  2:43 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AANLkTikJ3y5exFtTic+8dhUsUqeZBDmR=S-8VzKDK0GH@mail.gmail.com>
     [not found] ` <AANLkTink4CrELJfGf3W15caSYX8Se5ygsm_WeMRdCBz=@mail.gmail.com>
     [not found]   ` <AANLkTikUa1KF+8NP54BHicus++YbeZbD48E7z=1H0Y5V@mail.gmail.com>
     [not found]     ` <AANLkTinAe_r2EbqOHZGVjaN8yDbhja0m5MUuJfMrn6Cs@mail.gmail.com>
2011-01-20  6:59       ` ron minnich
2011-01-20 16:48         ` David Leimbach
     [not found]         ` <AANLkTintaOjTpC6Eaz3Ka7256KXYzaDeYg3jsqbCT5Wx@mail.gmail.com>
     [not found]           ` <AANLkTim3MH0t6H1522DnHf-P_E7a0rtt6FzY9f3ti10i@mail.gmail.com>
     [not found]             ` <AANLkTi=1btTKGVd_gKk+abAjTEwsEPMBhP4L3agrDubg@mail.gmail.com>
     [not found]               ` <AANLkTimuhE_G46f0J3nRBos1kVSDvTvUwvUb8u0RsR4A@mail.gmail.com>
     [not found]                 ` <AANLkTiki2v5MgdxwgjQpJopnrRQhBXKm80+aua_FFAef@mail.gmail.com>
     [not found]                   ` <AANLkTi=fi2Xm0R1Jx2NcrKUkyJaYqnizDP0xJPgaenMY@mail.gmail.com>
2011-01-23  2:43                     ` ron minnich [this message]
2011-01-23  2:48                       ` erik quanstrom
2011-01-23  2:56                         ` ron minnich
2011-01-23  3:00                           ` erik quanstrom
2011-01-23 19:20                             ` Charles Forsyth
2011-01-23 19:15                               ` Devon H. O'Dell
2011-01-23 20:40                                 ` EBo
2011-01-23 22:00                                   ` ron minnich
2011-01-24 12:11                                     ` EBo
2011-01-24 17:18                                     ` yy
2011-01-24 17:24                                       ` erik quanstrom
2011-01-25 14:28                                         ` Richard Miller
2011-01-24 17:24                                       ` ron minnich
2011-02-08  0:05                                         ` yy
2011-01-24 20:02                                       ` Steve Simon
2011-01-23 23:40                                   ` Charles Forsyth
2011-01-24  1:18                                     ` ron minnich
2011-01-24 12:17                                       ` EBo
2011-01-24 17:16                                         ` ron minnich

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='AANLkTintBhp2pxpdAGnMD2H=1J-gA+cF=GfFzX=MzPrr@mail.gmail.com' \
    --to=rminnich@gmail.com \
    --cc=9fans@9fans.net \
    --cc=paulzhol@gmail.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.
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).