From: Roland McGrath <[EMAIL PROTECTED]>
Subject: Re: Problems with oskit-mach
Date: Wed, 6 Sep 2000 13:30:55 -0400 (EDT)
> It is certainly harmless to disable the code that uses PGE. It is just an
> optimization. It would be helpful to figure out exactly when it is and
> isn't safe to use this feature, by looking at the code in Linux or BSD that
> decides whether to try to use it.
You need to check bit 13 of %edx returned by "cpuid 1". This is a
releavant part of FreeBSD (in i386/i386/locore.s):
movl $1,%eax
.byte 0x0f,0xa2 # cpuid 1
movl %eax,R(_cpu_id) # store cpu_id
movl %edx,R(_cpu_feature) # store cpu_feature
[snip]
testl $CPUID_PGE, R(_cpu_feature)
jz 1f
movl %cr4, %eax
orl $CR4_PGE, %eax
movl %eax, %cr4
1:
Thus, this kind of code would be enough:
#include <oskit/x86/cpuid.h>
#include <oskit/x86/proc_reg.h>
...
struct cpu_info cpu_info;
cpuid (&cpu_info);
if (cpu_info.feature_flags & CPUF_PAGE_GLOBAL_EXT)
set_cr4 (get_cr4 () & CR4_PGE);
Okuji