linux内核中的PTE结构 [英] PTE structure in the linux kernel

查看:785
本文介绍了linux内核中的PTE结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试在Linux源代码中查找与禁用PAE的x86系统上的PTE对应的结构/联合.到目前为止,我仅在arch/x86/include/asm/page_32.h

I have been trying to look around in the linux source code for a structure/union that'd correspond to the PTE on x86 system with PAE disabled. So far I've found only the following in arch/x86/include/asm/page_32.h

typedef union {
        pteval_t pte;
        pteval_t pte_low;
} pte_t;

我现在有点困惑,因为我面前已经打开了英特尔参考手册第3A卷,而且该手册中没有任何内容对应于PTE中存在的十几个奇数字段.

I'm a bit confused right now since I have the Intel Reference Manual Vol 3A open in front of me and nothing in that union corresponds to the dozen odd fields present in the PTE as the manual explains.

这可能是一个微不足道的问题,但是对我来说,它已经变得更像是理解linux内核中的内存管理过程中的绊脚石.

This might be a trivial question but for me it has become more like a stumbling block in the process of understanding memory management in the linux kernel.

我有2.6.29源码

推荐答案

pteval_t只是将页表项视为不透明的blob-在您要查看的体系结构上,它只是一个32位无符号值.

The pteval_t just treats the page table entry as an opaque blob - on the architecture you're looking at, it's just a 32 bit unsigned value.

使用按位运算符和掩码访问PTE中的字段-在我方便使用的源代码中(Linux 2.6.24),这些定义在include/asm-x86/pgtable_32.h中.您在《英特尔参考手册》中看到的字段(其中大多数是单位标志)在此处定义-例如:

The fields within the PTE are accessed using bitwise operators and masks - in the source I have handy (Linux 2.6.24), these are defined in include/asm-x86/pgtable_32.h. The fields you see in the Intel Reference Manual (most of which are single-bit flags) are defined here - for example:

#define _PAGE_PRESENT   0x001
#define _PAGE_RW    0x002
#define _PAGE_USER  0x004
#define _PAGE_PWT   0x008
#define _PAGE_PCD   0x010
#define _PAGE_ACCESSED  0x020
#define _PAGE_DIRTY 0x040
#define _PAGE_PSE   0x080   /* 4 MB (or 2MB) page, Pentium+, if present.. */
#define _PAGE_GLOBAL    0x100   /* Global TLB entry PPro+ */
#define _PAGE_UNUSED1   0x200   /* available for programmer */
#define _PAGE_UNUSED2   0x400
#define _PAGE_UNUSED3   0x800

这篇关于linux内核中的PTE结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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