ia64/xen-unstable

changeset 19770:64a932c92a7c

x86: fix s3 resume on AMD CPUs

Avoid longjmp as it has different semantics than on Intel CPUs in long
mode. Also add a few comments and remove a pointless reload of DS.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Keir Fraser <keir.fraser@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Jun 16 14:19:34 2009 +0100 (2009-06-16)
parents 2d68d518038b
children 0ea75c3b7743
files xen/arch/x86/acpi/wakeup_prot.S xen/arch/x86/boot/wakeup.S
line diff
     1.1 --- a/xen/arch/x86/acpi/wakeup_prot.S	Tue Jun 16 14:04:15 2009 +0100
     1.2 +++ b/xen/arch/x86/acpi/wakeup_prot.S	Tue Jun 16 14:19:34 2009 +0100
     1.3 @@ -142,6 +142,12 @@ ENTRY(do_suspend_lowlevel)
     1.4          LOAD_GREG(sp)
     1.5  
     1.6  #if defined(__x86_64__)
     1.7 +        /* Reload code selector */
     1.8 +        pushq   $(__HYPERVISOR_CS64)
     1.9 +        leaq    1f(%rip),%rax
    1.10 +        pushq   %rax
    1.11 +        lretq
    1.12 +1:
    1.13  
    1.14          mov     REF(saved_cr8), %rax
    1.15          mov     %rax, %cr8
     2.1 --- a/xen/arch/x86/boot/wakeup.S	Tue Jun 16 14:04:15 2009 +0100
     2.2 +++ b/xen/arch/x86/boot/wakeup.S	Tue Jun 16 14:19:34 2009 +0100
     2.3 @@ -110,6 +110,7 @@ video_flags:    .long 0
     2.4          # Add offset for any reference to xen specific symbols
     2.5  
     2.6  wakeup_32:
     2.7 +        /* Set up segment registers and initial stack for protected mode */
     2.8          mov     $BOOT_DS, %eax
     2.9          mov     %eax, %ds
    2.10          mov     %eax, %ss
    2.11 @@ -152,6 +153,7 @@ 1:      wrmsr
    2.12  
    2.13          wbinvd
    2.14  
    2.15 +        /* Enable paging and flush prefetch queue */
    2.16          mov     $0x80050033,%eax /* hi-to-lo: PG,AM,WP,NE,ET,MP,PE */
    2.17          mov     %eax,%cr0
    2.18          jmp     1f
    2.19 @@ -163,31 +165,22 @@ 1:
    2.20          ljmp    $BOOT_CS64, $bootsym_phys(wakeup_64)
    2.21  
    2.22          .code64
    2.23 -        .align  8
    2.24 -        .word   0,0,0
    2.25 -lgdt_descr:
    2.26 -        .word   LAST_RESERVED_GDT_BYTE
    2.27 -        .quad   boot_cpu_gdt_table - FIRST_RESERVED_GDT_BYTE
    2.28 -        
    2.29  wakeup_64:
    2.30 -        lgdt    lgdt_descr(%rip)
    2.31 -        mov     $(__HYPERVISOR_DS64), %eax
    2.32 -        mov     %eax, %ds
    2.33 +        /* Jump to high mappings and the higher-level wakeup code. */
    2.34 +        movq    ret_point(%rip), %rbx
    2.35 +        jmp     *%rbx
    2.36  
    2.37 -        # long jump to return point, with cs reload
    2.38 -        rex64 ljmp    *ret_point(%rip)
    2.39 -
    2.40 -        .align 8
    2.41  ret_point:
    2.42          .quad   __ret_point
    2.43 -        .word   __HYPERVISOR_CS64
    2.44  
    2.45  #else /* !defined(__x86_64__) */
    2.46 +
    2.47          lgdt    gdt_descr
    2.48          mov     $(__HYPERVISOR_DS), %eax
    2.49          mov     %eax, %ds
    2.50  
    2.51          ljmp    $(__HYPERVISOR_CS), $__ret_point
    2.52 +
    2.53  #endif
    2.54  
    2.55  bogus_saved_magic: