Intel® ISA Extensions
Use hardware-based isolation and memory encryption to provide more code protection in your solutions.
1093 Discussions

Setting Kernel space to non-cacheable on x86_64 using IA_PAT MSR or page table walks

Ibrahim__Ahmad
Beginner
647 Views

I am trying to disable the caching for the Linux operating system only, i.e., Kernel space. I figured out that there are two ways to do this:

1- Using MTRR: This turned out to be infeasible as MTRR allow disabling caching for ranges of physical addresses. I am using a 64bit Tinycore Linux on x86_64, which means that kernel space can be mapped to the whole RAM (unlike 32bit systems where space maps to low physical memory).

2- Using PAT: This seems to be the better option as it works on virtual pages. However I am not sure whether I should use the IA32_PAT register and how? or modify the page table entries for kernel pages and how?

Could anyone provide full code for disabling cache for kernel space only or at least instructions from using IA32_PAT or modifying page table entries?

I found this question: Linux Kernel: manually modify page table entry flags but the code it does not include the whole code and it is not answered.

I also found these questions for page table walks: Getting error when compiling kernel for page table walk, and linux kernel - how to get physical address (memory management)?

0 Kudos
0 Replies
Reply