lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1185046274.5652.15.camel@lappy>
Date:	Sat, 21 Jul 2007 21:31:13 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	"Robert P. J. Day" <rpjday@...dspring.com>
Cc:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: from where comes "__moddi3"?

On Sat, 2007-07-21 at 15:21 -0400, Robert P. J. Day wrote:
> again, probably displaying my abject ignorance, but i wrote a
> trivial module that tries to "var % 15", and i get:
> 
>   WARNING: "__moddi3" undefined!
> 
> and, not surprisingly, when i try to insmod:
> 
>   insmod: error inserting 'seq.ko': -1 Unknown symbol in module
> 
> (using 16 rather than 15 works fine, as i assume that the modulus
> call is simply replaced by an optimized  bitwise comparison.)
> 
>   so ... from where comes __moddi3?  i know there are places in the
> kernel source tree that do non-power-of-2 moduli, and they work fine,
> no?  thanks.

let me guess, 32 bit kernel, and var is 64 bit?

gcc translates that into a libgcc call, which we _explicitly_ do not
have because 64bit divisions are expensive!

use do_div().

16 works because gcc translates that into a right shift.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ