在哪里可以找到Linux全局mem_map数组的地址? [英] Where can I find the address of the Linux global mem_map array?

查看:111
本文介绍了在哪里可以找到Linux全局mem_map数组的地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的发行版(Ubuntu 14.04.3 LTS)似乎没有导出此引用,因此我无法在模块加载时解析地址.我正在寻找另一种无需重新编译内核即可确定地址的方法.

My distro (Ubuntu 14.04.3 LTS) doesn't seem to export this reference so I can't resolve the address at module load time. I'm looking for another way to determine the address without a kernel re-compile.

我正在Macbook Pro上以VMware Fusion的身份来宾运行.内核是3.13.0-74通用的.

I'm running as a guest under VMware Fusion on a macbook pro. Kernel is 3.13.0-74-generic.

预先感谢

推荐答案

使用kallsyms_lookup_name.在linux/kallsyms.h中定义为

unsigned long kallsyms_lookup_name(const char *name);

用法很简单:

struct page *my_mem_map = (struct page*)kallsyms_lookup_name("mem_map");


从内核2.6.33开始,为模块导出

kallsyms_lookup_name.


kallsyms_lookup_name is exported for modules since kernel 2.6.33.

对于较早的内核,或一次发现多个符号,可以使用通用函数kallsyms_on_each_symbol.迭代所有符号并为它们调用用户指定的函数.

For earlier kernels, or for find several symbols at once, generic function kallsyms_on_each_symbol can be used. It iterates over all symbols and calls user-specified function for them.

这篇关于在哪里可以找到Linux全局mem_map数组的地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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