vserver 2.0 rc7
[linux-2.6.git] / arch / x86_64 / kernel / suspend_asm.S
index 633a869..53f8e16 100644 (file)
@@ -54,16 +54,10 @@ ENTRY(swsusp_arch_resume)
        movq    %rax, %cr4;  # turn PGE back on
 
        movq    pagedir_nosave(%rip), %rdx
-       /* compute the limit */
-       movl    nr_copy_pages(%rip), %eax
-       testl   %eax, %eax
-       jz      done
-       movq    %rdx,%r8
-       movl    $SIZEOF_PBE,%r9d
-       mul             %r9  # with rax, clobbers rdx
-       movq    %r8, %rdx
-       addq    %r8, %rax
 loop:
+       testq   %rdx, %rdx
+       jz      done
+
        /* get addresses from the pbe and copy the page */
        movq    pbe_address(%rdx), %rsi
        movq    pbe_orig_address(%rdx), %rdi
@@ -72,16 +66,24 @@ loop:
        movsq
 
        /* progress to the next pbe */
-       addq    $SIZEOF_PBE, %rdx
-       cmpq    %rax, %rdx
-       jb      loop
+       movq    pbe_next(%rdx), %rdx
+       jmp     loop
 done:
+       /* Flush TLB, including "global" things (vmalloc) */
+       movq    mmu_cr4_features(%rip), %rax
+       movq    %rax, %rdx
+       andq    $~(1<<7), %rdx;  # PGE
+       movq    %rdx, %cr4;  # turn off PGE
+       movq    %cr3, %rcx;  # flush TLB
+       movq    %rcx, %cr3
+       movq    %rax, %cr4;  # turn PGE back on
+
        movl    $24, %eax
        movl    %eax, %ds
 
        movq saved_context_esp(%rip), %rsp
        movq saved_context_ebp(%rip), %rbp
-       movq saved_context_eax(%rip), %rax
+       /* Don't restore %rax, it must be 0 anyway */
        movq saved_context_ebx(%rip), %rbx
        movq saved_context_ecx(%rip), %rcx
        movq saved_context_edx(%rip), %rdx
@@ -96,5 +98,7 @@ done:
        movq saved_context_r14(%rip), %r14
        movq saved_context_r15(%rip), %r15
        pushq saved_context_eflags(%rip) ; popfq
-       call    swsusp_restore
+
+       xorq    %rax, %rax
+
        ret