public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Yuri Tikhonov <yur@emcraft•com>
To: Scott Wood <scottwood@freescale•com>
Cc: Wolfgang Denk <wd@denx•de>, Detlev Zundel <dzu@denx•de>,
	linux-kernel@vger•kernel.org, Milton Miller <miltonm@bga•com>,
	linuxppc-dev@ozlabs•org, Al Viro <viro@ZenIV•linux.org.uk>,
	Geert Uytterhoeven <Geert.Uytterhoeven@sonycom•com>,
	Ilya Yanok <yanok@emcraft•com>
Subject: Re[2]: [PATCH] fork_init: fix division by zero
Date: Wed, 10 Dec 2008 20:56:51 +0300	[thread overview]
Message-ID: <527599002.20081210205651@emcraft.com> (raw)
In-Reply-To: <20081210172512.GA19584@ld0162-tx32.am.freescale.net>

=0D=0AHello Scott,

On Wednesday, December 10, 2008 you wrote:

> On Wed, Dec 10, 2008 at 01:29:12PM +0300, Yuri Tikhonov wrote:
>> On Wednesday, December 10, 2008 you wrote:
>> > x * y / z is parsed as (x * y) / z, not x * (y / z).
>>=20
>>  Here we believe in preprocessor: since all PAGE_SIZE, 8, and=20
>> THREAD_SIZE are the constants we expect it will calculate this.
>>=20
>>  E.g. here is the result from this line as produced by cross-gcc=20
>> 4.2.2:
>>=20
>>         lis     r9,0
>>         rlwinm  r29,r29,2,16,29
>>         stw     r29,0(r9)
>>=20
>>  As you see - only rotate-left, i.e. multiplication to the constant.

> Yes, and also note that it is masking the result by 0xfffc, to preserve
> the effect of any overflow in (x * y).

 Right, such a mask was the result of missed brackets. Now (see=20
"[PATCH][v2] fork_init: fix division by zero" I've just posted) the=20
situation is better:

        lis     r9,0
        rlwinm  r29,r29,2,0,29
        stw     r29,0(r9)

 I.e. the mask is 0xFFFFFFFC.

 Regards, Yuri

 --
 Yuri Tikhonov, Senior Software Engineer
 Emcraft Systems, www.emcraft.com

      reply	other threads:[~2008-12-10 17:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-09 17:44 [PATCH] fork_init: fix division by zero Yuri Tikhonov
2008-12-10  8:44 ` Geert Uytterhoeven
2008-12-10 10:01   ` Re[2]: " Yuri Tikhonov
2008-12-10 10:17     ` Al Viro
2008-12-10 10:29       ` Re[2]: " Yuri Tikhonov
2008-12-10 13:06         ` David Howells
2008-12-10 13:09           ` David Howells
2008-12-10 13:15           ` Geert Uytterhoeven
2008-12-10 13:25           ` Re[4]: " Yuri Tikhonov
2008-12-10 21:50           ` Re[2]: " Paul Mackerras
2008-12-10 17:25         ` Scott Wood
2008-12-10 17:56           ` Yuri Tikhonov [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=527599002.20081210205651@emcraft.com \
    --to=yur@emcraft$(echo .)com \
    --cc=Geert.Uytterhoeven@sonycom$(echo .)com \
    --cc=dzu@denx$(echo .)de \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    --cc=miltonm@bga$(echo .)com \
    --cc=scottwood@freescale$(echo .)com \
    --cc=viro@ZenIV$(echo .)linux.org.uk \
    --cc=wd@denx$(echo .)de \
    --cc=yanok@emcraft$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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