Re: 64 bit arithmetic in the kernel

Jamie Lokier (lkd@tantalophile.demon.co.uk)
Tue, 13 Jul 1999 20:48:37 +0200


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

-
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/