x86: Implement PAT support for memory type configuration.

Using the page attribute table to set the memory type on a per page
mapping basis is the more modern and flexible approach to physical
memory type handling compared to using MTRRs.

Most of the needed infrastructure was already in place, as setting the
page table entry attributes was already done for uncachable and
write-back memory types. Using the PAT now also allows to set the last
remaining memory type of write-combining through the PTE flags. The PAT
is configured to have entry 4 mean write-combining and the PAT bit in
the PTE is set to point to that.

When PAT is supported and not disabled, MTRRs are completely ignored
and left as set up by the system firmware, where the basic uncachable
and RAM ranges are supposed to be set up. These configurations are then
overridden by the PTE flags as needed.

Change-Id: I0a74b3fc7d3ba9fa384251290ce41621b69d3a02
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8340
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Michael Lotz
2024-09-17 20:45:28 +00:00
committed by waddlesplash
parent 8271b4a8bf
commit 32a3bddfdf
9 changed files with 95 additions and 26 deletions
+1
View File
@@ -15,6 +15,7 @@
#define B_SAFEMODE_DISABLE_SMEP_SMAP "disable_smep_smap"
#define B_SAFEMODE_DISABLE_APM "disable_apm"
#define B_SAFEMODE_DISABLE_SMP "disable_smp"
#define B_SAFEMODE_DISABLE_PAT "disable_pat"
#define B_SAFEMODE_DISABLE_HYPER_THREADING "disable_hyperthreading"
#define B_SAFEMODE_FAIL_SAFE_VIDEO_MODE "fail_safe_video_mode"
#define B_SAFEMODE_4_GB_MEMORY_LIMIT "4gb_memory_limit"