简体   繁体   English

内核符号表映射到虚拟地址空间 - 为什么?

[英]Kernel symbol table mapped into virtual address space - why?

What is /proc/ksyms and /proc/kallsyms, and why is it mapped into a processes address space? 什么是/ proc / ksyms和/ proc / kallsyms,为什么它映射到进程地址空间? What purpose does it serve? 它有什么用途? Is it used in context switching of the kernel during a system call? 它是否在系统调用期间用于内核的上下文切换?

The Solaris manpage for ksyms(7d) explains this. ksyms(7d)的Solaris手册ksyms(7d)解释了这一点。 The data is informative-only, the kernel exposes its currently-used symbol table to kernel debuggers and/or the kernel module loader this way, through /dev/ksyms . 数据仅供参考,内核通过/dev/ksyms将其当前使用的符号表以这种方式暴露给内核调试器和/或内核模块加载器。

Linux does the same through /proc/kallsyms ; Linux通过/proc/kallsyms做同样的/proc/kallsyms ; /proc/ksyms - if present - is a "traditional" file presenting a subset of the same data (ie it's deprecated). /proc/ksyms - 如果存在 - 是一个“传统”文件,表示相同数据的子集(即它已被弃用)。

The difference, as usual for Linux/Solaris, is that the Linux version presents text while the Solaris one is binary. 与Linux / Solaris一样,区别在于Linux版本提供文本,而Solaris版本是二进制版本。 You can run nm /dev/ksyms on the Solaris one to get the same type of output you get from cat /proc/kallsyms on Linux. 您可以在Solaris上运行nm /dev/ksyms ,以获得与Linux上的cat /proc/kallsyms相同类型的输出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM