From: Bastien Nocera <hadess@hadess.net>
To: linuxppc-dev@lists.linuxppc.org
Subject: bug in asm-ppc/div64.h
Date: 11 Mar 2003 11:05:58 +0000 [thread overview]
Message-ID: <1047380759.5250.7889.camel@bnocera.surrey.redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 885 bytes --]
Hello,
While chasing a date bug in smbfs with Urban Widmark, it so happened
that we stumbled across a bug in do_div on PPC 32bit, ie. it doesn't
work.
I attached a test case, provided by Urban. do_div is used in quite a few
places like vsprintf, the matrox fb code, etc.
When running on x86:
now: 1047238073
adjusted: 24edd64059e100
/ 10000000: 3df4e80a
1039460362
Check the run on PPC. It's wrong by quite a scale.
Any ideas on how to solve this properly ?
Cheers
--
/Bastien Nocera
http://www.redhat.com
Perfection is reached, not when there is no longer anything to add, but
when there is no longer anything to take away.
Antoine de Saint-Exupery
--
/Bastien Nocera
http://hadess.net
#2 0x4205a2cc in printf ("Oh my %s\n", preferred_deity) from
/lib/i686/libc.so.6 printf ("Oh my %s\n", preferred_deity);
Segmentation fault
[-- Attachment #2: smbfs-time.c --]
[-- Type: text/x-c, Size: 550 bytes --]
#include <stdio.h>
#include <time.h>
#include <asm/types.h>
#include <asm/div64.h>
typedef __u64 u64;
#define NTFS_TIME_OFFSET ((u64)(369*365 + 89) * 24 * 3600 * 10000000)
static time_t
smb_ntutc2unixutc(u64 ntutc)
{
u64 t = ntutc - NTFS_TIME_OFFSET;
printf("adjusted: %Lx\n", t);
do_div(t, 10000000);
printf("/ 10000000: %Lx\n", t);
return (time_t)t;
}
int main()
{
time_t t;
t = time(NULL);
printf("now: %ld\n", t);
t = smb_ntutc2unixutc(0x01c29fb515986100LL);
printf("%ld\n", t);
}
next reply other threads:[~2003-03-11 11:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-11 11:05 Bastien Nocera [this message]
2003-03-11 14:21 ` Debugging Giuliano Pochini
2003-03-11 19:28 ` Debugging Olaf Hering
2003-03-13 8:28 ` Debugging Giuliano Pochini
2003-03-13 8:52 ` Debugging Olaf Hering
-- strict thread matches above, loose matches on Subject: below --
2003-03-11 11:03 bug in asm-ppc/div64.h Bastien Nocera
2003-03-11 11:04 ` Paul Mackerras
2003-03-11 11:23 ` Bastien Nocera
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=1047380759.5250.7889.camel@bnocera.surrey.redhat.com \
--to=hadess@hadess.net \
--cc=linuxppc-dev@lists.linuxppc.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;
as well as URLs for NNTP newsgroup(s).