[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Problems with oskit-mach

On Thu, Sep 07, 2000 at 03:20:27AM +0900, OKUJI Yoshinori wrote:
> From: Roland McGrath <roland@frob.com>
> 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

Actually almost this exact code is already in [gnumach]/i386/intel/pmap.c.
The cpuid instruction itself should be in and #if defined(i586) || 
defined(i686), I don't remember if that's actually done in oskit or not.
The problem with K6 cpus is that they set bit 13 in %edx after the cpuid
instruction but actually crash at the code that tries to enable PGE in 
%cr4. I can't confirm that it's a definite bug in all K6's I'll try to look
for more info about that.


To UNSUBSCRIBE, email to debian-hurd-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Reply to: