]> git.corax.cc Git - corax/commitdiff
kernel/arch: Decide whether or not to use PAE based on CPU support
authorMatthias Kruk <m@m10k.eu>
Thu, 5 Nov 2020 04:07:11 +0000 (13:07 +0900)
committerMatthias Kruk <m@m10k.eu>
Thu, 5 Nov 2020 04:07:11 +0000 (13:07 +0900)
Make the paging code decide whether to use PAE or not based on whether
the executing CPU supports PAE, not the amount of available memory.

kernel/arch/paging.c

index ede675df7e311859c15f3d9fd42cecb721cbc111..9c841e0e11bf5ad3e75fc746d9db308f8bf89416 100644 (file)
@@ -714,17 +714,12 @@ void* pg_init(struct multiboot_info *info)
 #endif /* FEATURE(DEBUG) */
 
        /*
-        * Figure out if we should be using PAE paging or not. Besides looking at the amount of
-        * available memory, the kernel should probably also see what cpuid has to say about PAE
-        * availability. It's not unreasonable to expect PAE to be supported though, since it has
-        * been around since the Pentium Pro (with the exception of some Pentium Ms).
+        * Figure out if we should be using PAE paging or not
         */
-       if(mem_size < 0x100000000L) {
-               /* we have less than 4G of memory, no need for PAE */
-               _pg_flags = PG_MODE_LEGACY;
-       } else {
-               /* TODO: check if IA-32e paging is supported */
+       if(cpu_get_capabilities() & CPU_CAPABILITY_PAE) {
                _pg_flags = PG_MODE_PAE;
+       } else {
+               _pg_flags = PG_MODE_LEGACY;
        }
 
        /*