Merge branch 'drm-patches' of master.kernel.org:/pub/scm/linux/kernel/git/airlied...
[linux-drm-fsl-dcu.git] / arch / x86_64 / kernel / suspend_asm.S
index 4d659e97df100b354fc07f4aaa4f39f86ca686ff..16d183f67bc1e66e790f6160ae54a436554b9041 100644 (file)
@@ -39,12 +39,13 @@ ENTRY(swsusp_arch_suspend)
        call swsusp_save
        ret
 
-ENTRY(swsusp_arch_resume)
-       /* set up cr3 */        
-       leaq    init_level4_pgt(%rip),%rax
-       subq    $__START_KERNEL_map,%rax
-       movq    %rax,%cr3
-
+ENTRY(restore_image)
+       /* switch to temporary page tables */
+       movq    $__PAGE_OFFSET, %rdx
+       movq    temp_level4_pgt(%rip), %rax
+       subq    %rdx, %rax
+       movq    %rax, %cr3
+       /* Flush TLB */
        movq    mmu_cr4_features(%rip), %rax
        movq    %rax, %rdx
        andq    $~(1<<7), %rdx  # PGE
@@ -53,7 +54,7 @@ ENTRY(swsusp_arch_resume)
        movq    %rcx, %cr3;
        movq    %rax, %cr4;  # turn PGE back on
 
-       movq    pagedir_nosave(%rip), %rdx
+       movq    restore_pblist(%rip), %rdx
 loop:
        testq   %rdx, %rdx
        jz      done
@@ -69,6 +70,11 @@ loop:
        movq    pbe_next(%rdx), %rdx
        jmp     loop
 done:
+       /* go back to the original page tables */
+       movq    $(init_level4_pgt - __START_KERNEL_map), %rax
+       addq    phys_base(%rip), %rax
+       movq    %rax, %cr3
+
        /* Flush TLB, including "global" things (vmalloc) */
        movq    mmu_cr4_features(%rip), %rax
        movq    %rax, %rdx