* __udivdi3 and linux kernel u64 division question [x86]
@ 2005-05-24 12:29 Mateusz Berezecki
2005-05-24 12:37 ` Arjan van de Ven
2005-05-24 13:08 ` Jan-Benedict Glaw
0 siblings, 2 replies; 3+ messages in thread
From: Mateusz Berezecki @ 2005-05-24 12:29 UTC (permalink / raw)
To: linux-kernel
Hi list members,
After a failure of compilation of the similar code snippet
u64 mconst = somebig64bitvalue;
u64 tmp = some32bitvalue;
u64 r = mconst / tmp;
I encounter compilation error and gcc reporting __udivdi3 has not been
found!
After firing up cscope I found that this function has never(?) been
implemented for
x86 architecture. How is it possible that during compilation process of
some module
make system tries to link with nonexisting function?
I've also found a do_div() and it was sufficent for my purposes but Im
still curious about
__udivdi3. Can someone explain this issue to me?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: __udivdi3 and linux kernel u64 division question [x86]
2005-05-24 12:29 __udivdi3 and linux kernel u64 division question [x86] Mateusz Berezecki
@ 2005-05-24 12:37 ` Arjan van de Ven
2005-05-24 13:08 ` Jan-Benedict Glaw
1 sibling, 0 replies; 3+ messages in thread
From: Arjan van de Ven @ 2005-05-24 12:37 UTC (permalink / raw)
To: Mateusz Berezecki; +Cc: linux-kernel
On Tue, 2005-05-24 at 14:29 +0200, Mateusz Berezecki wrote:
> Hi list members,
>
> After a failure of compilation of the similar code snippet
>
>
> u64 mconst = somebig64bitvalue;
> u64 tmp = some32bitvalue;
> u64 r = mconst / tmp;
you shouldn't do this in linux
> I've also found a do_div() and it was sufficent for my purposes but Im
> still curious about
> __udivdi3. Can someone explain this issue to me?
do_div is a very small subset of divides.
Also.. you forgot to put the URL of your module into your email..
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: __udivdi3 and linux kernel u64 division question [x86]
2005-05-24 12:29 __udivdi3 and linux kernel u64 division question [x86] Mateusz Berezecki
2005-05-24 12:37 ` Arjan van de Ven
@ 2005-05-24 13:08 ` Jan-Benedict Glaw
1 sibling, 0 replies; 3+ messages in thread
From: Jan-Benedict Glaw @ 2005-05-24 13:08 UTC (permalink / raw)
To: Mateusz Berezecki; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1535 bytes --]
On Tue, 2005-05-24 14:29:44 +0200, Mateusz Berezecki <mateuszb@gmail.com> wrote:
> u64 mconst = somebig64bitvalue;
> u64 tmp = some32bitvalue;
> u64 r = mconst / tmp;
>
> I encounter compilation error and gcc reporting __udivdi3 has not been
> found!
> After firing up cscope I found that this function has never(?) been
> implemented for
> x86 architecture. How is it possible that during compilation process of
> some module
> make system tries to link with nonexisting function?
>
> I've also found a do_div() and it was sufficent for my purposes but Im
> still curious about
> __udivdi3. Can someone explain this issue to me?
In some cases, gcc decides that a given division is too complicated to
do it in one assembler instruction. That's especially true for things
that newer CPUs support but older lack. In these cases, gcc emits a
function call instead of the actual division and normally, libgcc would
provide these functions.
However, it's each architecture's decision to link-in libgcc or not,
because it can open another can of worms. Alternatively, you can
implement these little functions on your own and put them somewhere in
some library file.
MfG, JBG
--
Jan-Benedict Glaw jbglaw@lug-owl.de . +49-172-7608481 _ O _
"Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg _ _ O
fuer einen Freien Staat voll Freier Bürger" | im Internet! | im Irak! O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-05-24 13:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-24 12:29 __udivdi3 and linux kernel u64 division question [x86] Mateusz Berezecki
2005-05-24 12:37 ` Arjan van de Ven
2005-05-24 13:08 ` Jan-Benedict Glaw
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.