lkml.org 
[lkml]   [1999]   [Jul]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 64 bit arithmetic in the kernel
On Tue, 13 Jul 1999, Jamie Lokier wrote:

> Michael Richardson wrote:
> > Is there any easy way to get things like the stuff that it
> > is in libgcc1.a into the Linux kernel? I have need for 64/32 integer divide
> > (gcc calls __udivdi3).
> > This is with 2.2.10, on a Lintel box, and I'm using a module.
>
> Richard Johnson wrote:
> > Use inline asm. In Intel, you put the high long-word into edx, the low
> > long-word into eax, and "div" either by an immediate or something in, say
> > the ecx register. The result is a long-word in eax, with the remainder
> > in edx.
> >
> > This results in an unsigned integer divide, which is what the __udivxxx
> > means.
>
> Actually __udivdi3 is a 64/64 -> 64 divide, while the "div" instruction
> is 64/32 -> 32. Apples and pears.
>
> -- Jamie
>

It depends upon your C runtime library. Version 2.8.1 substitutes the
64/64 version.

This is from libgcc2.c, line 709.

#ifdef L_udivdi3
UDItype __udivmoddi4 ();
UDItype
__udivdi3 (UDItype n, UDItype d)
{
return __udivmoddi4 (n, d, (UDItype *) 0);
}

We are both correct.


Cheers,
Dick Johnson
FILE SYSTEM MODIFIED
Penguin : Linux version 2.2.6 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:52    [W:0.025 / U:2.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site