Re: 64 bit arithmetic in the kernel

Richard B. Johnson (root@chaos.analogic.com)
Mon, 12 Jul 1999 17:27:43 -0400 (EDT)


On Mon, 12 Jul 1999, 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.
>

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.

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/