3

I have read article of Duartes from: http://duartes.org/gustavo/blog/post/how-the-kernel-manages-your-memory

In part that describes about PTE content, bit [0:11] is different with description in ARMv5 Architecture Reference Manual

Detail is:

Bit [0:11] of the PTE contain:

  • In Duartes article: bit 0: P (present), bit 1: R/W , bit 2: U/S (user/supervisor),...
  • In ARMv5 Architecture Reference Manual : Bits[1:0] Identify the type of descriptor (0b11 marks a fine page table descriptor), Bits[4:2]: The meaning of these bits is IMPLEMENTATION DEFINED,...

(Refer at: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0198e/I16780.html ) . I think the Second-level descriptor in ARMv5 Architecture Reference Manual is corresponding with PTE in Duartes's article.

So, question is the PTE descriptor is depending on platform (x86, ARM,...) ?.

For me, I think PTE descriptor should not depend on platform.

Thanks

artless noise
  • 21,212
  • 6
  • 68
  • 105
Thang Le
  • 1,419
  • 1
  • 17
  • 25

2 Answers2

3

As each architecture implement their MMU (memory management unit) differently, the PTE descriptor is architecture dependent.

If we look at Linux, it has a three level page table structure (inherited from the x86 architecture), which in most ARM platforms is wrapped to fit a two level page table structure (newer ARM have support for 3 levels). Linux also uses "dirty" and "accessed" bit that is available in the x86 architecture for the memory management logic of the kernel. These bits are not available in the ARM architecture, which ARM Linux has solved by emulating it in software. This is done by having two versions of the PTE page tables. One for the OS which contains these missing "bits", and one for the actual HW to use.

In the end, the Linux OS for different architectures behave the same. It's all about how the OS are using the hardware mechanisms that the specific architecture is offering as there are pro and cons for each.

MrGigu
  • 1,729
  • 3
  • 23
  • 37
2

The ARM Linux code is different depending on the type of ARM and other conditionals. pgtable.h, page.h and mostly pgtable-2level.h give some details. There are two versions of PTE values; one for Linux and one for hardware.

artless noise
  • 21,212
  • 6
  • 68
  • 105
  • Oh, I surprise to know there are 2 versions of PTE, one for OS and one for hardware. The PTE of OS is a wrapper version of PTE of hardware ?. Anyway, thanks artless noise – Thang Le Jun 05 '13 at 02:05
  • See [How does ARM Linux emulate the dirty, accessed, and file bits of a PTE?](http://stackoverflow.com/questions/32943129/how-does-arm-linux-emulate-the-dirty-accessed-and-file-bits-of-a-pte/32950220#32950220) for some more information. – artless noise Oct 06 '15 at 13:51