__udivdi3未定义 - 如何找到使用它的code? [英] __udivdi3 undefined — how to find the code that uses it?

查看:817
本文介绍了__udivdi3未定义 - 如何找到使用它的code?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编译在32位Linux内核结果的内核模块

Compiling a kernel module on 32-Bit Linux kernel results in

"__udivdi3" [mymodule.ko] undefined!
"__umoddi3" [mymodule.ko] undefined!

一切都在64位系统上的罚款。据我所知,这样做的原因是,64位整数除法和模数不是32位的Linux内核的支援。

Everything is fine on 64-bit systems. As far as I know, the reason for this is that 64-bit integer division and modulo are not supported inside a 32-bit Linux kernel.

我如何找到code发出64位操作。他们很难找到手动,因为我不能轻松地检查如果/是32位宽或64位宽。如果正常的功能是不确定的,我可以grep它们,但这里,这是不可能的。是否有搜索引用另一种好办法吗?某种机器code grep的?

How can I find the code issuing the 64-bit operations. They are hard to find manually because I cannot easily check if an "/" is 32-bit wide or 64-bit wide. If "normal" functions are undefined, I can grep them, but this is not possible here. Is there another good way to search the references? Some kind of "machine code grep"?

该模块由code的一些千行。我真的不手动检查每一行。

The module consists of some thousand lines of code. I can really not check every line manually.

推荐答案

首先,你可以使用 do_div 宏做64位除法。 (注意原型 uint32_t的do_div(uint64_t中分红,uint32_t的除数)股息可以被计算多次

First, you can do 64 bit division by using the do_div macro. (note the prototype is uint32_t do_div(uint64_t dividend, uint32_t divisor) and that "dividend" may be evaluated multiple times.

{
    unsigned long long int x = 6;
    unsigned long int y = 4;
    unsigned long int rem;

    rem = do_div(x, y);
    /* x now contains the result of x/y */
}

此外,你应该能够要么找到得到long long int (或 uint64_t中)类型的使用在你的code,或者交替,你可以建立与 -g 标记您的模块,并使用 objdump的-S​​ 来拿到源代码注释的反汇编。

Additionally, you should be able to either find usage of long long int (or uint64_t) types in your code, or alternately, you can build your module with the -g flag and use objdump -S to get a source annotated disassembly.

注意:适用于2.6内核,我没有检查任何东西使用率较低

note: this applies to 2.6 kernels, I have not checked usage for anything lower

这篇关于__udivdi3未定义 - 如何找到使用它的code?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆