ia64/xen-unstable

changeset 5766:35ccaeaffeb7

Enable NX/XD feature for 32-bit PAE Xen.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Jul 13 12:58:41 2005 +0000 (2005-07-13)
parents 3473b453dbae
children 79d52bd557cf
files xen/arch/x86/boot/x86_32.S xen/arch/x86/boot/x86_64.S
line diff
     1.1 --- a/xen/arch/x86/boot/x86_32.S	Wed Jul 13 08:45:26 2005 +0000
     1.2 +++ b/xen/arch/x86/boot/x86_32.S	Wed Jul 13 12:58:41 2005 +0000
     1.3 @@ -2,6 +2,7 @@
     1.4  #include <public/xen.h>
     1.5  #include <asm/desc.h>
     1.6  #include <asm/page.h>
     1.7 +#include <asm/msr.h>
     1.8  
     1.9  #define  SECONDARY_CPU_FLAG 0xA5A5A5A5
    1.10                  
    1.11 @@ -57,13 +58,13 @@ 1:      lss     stack_start-__PAGE_OFFSE
    1.12  
    1.13          /* Set up FPU. */
    1.14          fninit
    1.15 -        
    1.16 +
    1.17          /* Set up CR4, except global flag which Intel requires should be     */
    1.18          /* left until after paging is enabled (IA32 Manual Vol. 3, Sec. 2.5) */
    1.19          mov     mmu_cr4_features-__PAGE_OFFSET,%ecx
    1.20          and     $0x7f,%cl   # CR4.PGE (global enable)
    1.21          mov     %ecx,%cr4
    1.22 -                
    1.23 +
    1.24          cmp     $(SECONDARY_CPU_FLAG),%ebx
    1.25          je      start_paging
    1.26                  
    1.27 @@ -125,6 +126,24 @@ 1:      mov     %eax,(%edi)
    1.28          loop    1b
    1.29  
    1.30  start_paging:
    1.31 +#ifdef CONFIG_X86_PAE
    1.32 +        /* Enable Execute-Disable (NX/XD) support if it is available. */
    1.33 +        push    %ebx
    1.34 +        mov     $0x80000000,%eax
    1.35 +        cpuid
    1.36 +        cmp     $0x80000000,%eax    /* Any function > 0x80000000? */
    1.37 +        jbe     no_execute_disable
    1.38 +        mov     $0x80000001,%eax
    1.39 +        cpuid
    1.40 +        bt      $20,%edx            /* Execute Disable? */
    1.41 +        jnc     no_execute_disable
    1.42 +        movl    $MSR_EFER,%ecx
    1.43 +        rdmsr
    1.44 +        bts     $_EFER_NX,%eax
    1.45 +        wrmsr
    1.46 +no_execute_disable:
    1.47 +        pop     %ebx
    1.48 +#endif
    1.49          mov     $idle_pg_table-__PAGE_OFFSET,%eax
    1.50          mov     %eax,%cr3
    1.51          mov     $0x80050033,%eax /* hi-to-lo: PG,AM,WP,NE,ET,MP,PE */
     2.1 --- a/xen/arch/x86/boot/x86_64.S	Wed Jul 13 08:45:26 2005 +0000
     2.2 +++ b/xen/arch/x86/boot/x86_64.S	Wed Jul 13 12:58:41 2005 +0000
     2.3 @@ -63,7 +63,7 @@ 3:      in      %dx,%al
     2.4          /* Check for Multiboot bootloader */
     2.5          cmp     $0x2BADB002,%eax
     2.6          jne     not_multiboot
     2.7 -        
     2.8 +
     2.9          /* Save the Multiboot info structure for later use. */
    2.10          mov     %ebx,0x100300       # multiboot_ptr
    2.11  
    2.12 @@ -91,7 +91,7 @@ skip_boot_checks:
    2.13          mov     %eax,%cr3
    2.14  
    2.15          /* Set up EFER (Extended Feature Enable Register). */
    2.16 -        movl    $MSR_EFER, %ecx
    2.17 +        movl    $MSR_EFER,%ecx
    2.18          rdmsr
    2.19          btsl    $_EFER_LME,%eax /* Long Mode      */
    2.20          btsl    $_EFER_SCE,%eax /* SYSCALL/SYSRET */