From: Matti Aarnio <matti.aarnio@zmailer.org>
To: Artur Klauser <Artur.Klauser@computer.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: div64.h:do_div() bug
Date: Mon, 29 Sep 2003 17:18:20 +0300 [thread overview]
Message-ID: <20030929141820.GE1058@mea-ext.zmailer.org> (raw)
In-Reply-To: <Pine.LNX.4.51.0309291503030.7947@enm.xynhfre.bet>
On Mon, Sep 29, 2003 at 03:25:19PM +0200, Artur Klauser wrote:
> I've found that a bug in asm-arm/div64.h:do_div() is preventing correct
> conversion of timestamps in smbfs (and probably ntfs as well) from NT to
> Unix format. I'll post a patch that fixes the bug, but I think it is also
> present in other architectures - at least SPARC, SH, and CRIS look
> suspicious.
>
> If people with access to these architectures could run the following small
> test and let me know the outcome, I can fix it there too - thanks.
Call it "lack/lazyness of implementation"
Long ago it was used only in printk() debug printouts.
Now it is used all over the place. At least its users are aware of
it being slow, and not just using GCC's magic bultin codes.
> //-----------------------------------------------------------------------------
> #define __KERNEL__
> #include <asm/types.h> // get kernel definition of u64, u32
> #undef __KERNEL__
> #include <asm/div64.h> // get definition of do_div()
> #include <stdio.h>
>
> main () {
> union {
> u64 n64;
> u32 n32[2];
> } in, out;
>
> in.n32[0] = 1;
> in.n32[1] = 1;
> out = in;
>
> do_div(out.n64, 1);
>
> if (in.n64 != out.n64) {
> printf("FAILURE: asm/div64.h:do_div() is broken for 64-bit dividends\n");
> exit(1);
> } else {
> printf("Congratulations: asm/div64.h:do_div() handles 64-bit dividends\n");
> }
> return 0;
> }
next prev parent reply other threads:[~2003-09-29 14:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-29 13:25 Artur Klauser
2003-09-29 14:18 ` Matti Aarnio [this message]
2003-09-30 9:52 ` Rogier Wolff
2003-09-30 10:14 ` Matti Aarnio
2003-09-30 11:28 ` Matti Aarnio
2003-09-30 12:30 ` Andreas Schwab
2003-09-30 12:41 ` Artur Klauser
2003-09-30 12:53 ` div64.h:do_div() bug - SPARC, SH anbody? Artur Klauser
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=20030929141820.GE1058@mea-ext.zmailer.org \
--to=matti.aarnio@zmailer.org \
--cc=Artur.Klauser@computer.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®