- 论坛徽章:
- 0
|
回复 new_learner
不知道会不会有这么一种情况,就会譬如内核有一个静态变量p,加载某一模块,比 ...
kgn28 发表于 2010-07-15 13:47 ![]()
静态变量P不属于kernel code吧?
Figure 2-13 shows how the first 3 MB of RAM are filled by Linux. We have assumed that the kernel requires less than 3 MB of RAM.
The symbol _text, which corresponds to physical address 0x00100000, denotes the address of the first byte of kernel code. The end of the kernel code is similarly identified by the symbol _etext. Kernel data is divided into two groups: initialized and uninitialized. The initialized data starts right after _etext and ends at _edata. The uninitialized data follows and ends up at _end.
The symbols appearing in the figure are not defined in Linux source code; they are produced while compiling the kernel.
You can find the linear address of these symbols in the file System.map, which is created right after the kernel is compiled.
在看一下is_kernel_text()的实现:
- static inline int is_kernel_text(unsigned long addr)
- {
- if (addr >= (unsigned long)_stext && addr <= (unsigned long)_etext)
- return 1;
- return in_gate_area_no_task(addr);
- }
复制代码 静态变量P应该在initialized区,也就是_etext到_edata这部分,不属于is_kernel_text的范围。 |
|