From: Matthias Kruk Date: Thu, 5 Nov 2020 04:07:11 +0000 (+0900) Subject: kernel/arch: Decide whether or not to use PAE based on CPU support X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=611ad3fcdf31ea0669f7fc0919e6989a223e2c4e;p=corax kernel/arch: Decide whether or not to use PAE based on CPU support 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. --- diff --git a/kernel/arch/paging.c b/kernel/arch/paging.c index ede675d..9c841e0 100644 --- a/kernel/arch/paging.c +++ b/kernel/arch/paging.c @@ -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; } /*