Blame view

arch/x86/power/hibernate_asm_32.S 1.58 KB
c57591244   Rafael J. Wysocki   x86 PM: rename 32...
1
  /*
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2
3
4
5
6
7
8
9
10
   * This may not use any stack, nor any variable that is not "NoSave":
   *
   * Its rewriting one kernel image with another. What is stack in "old"
   * image could very well be data page in "new" image, and overwriting
   * your own stack under you is bad idea.
   */
  
  #include <linux/linkage.h>
  #include <asm/segment.h>
0341c14da   Jeremy Fitzhardinge   x86: use _types.h...
11
  #include <asm/page_types.h>
86feeaa81   Sam Ravnborg   kbuild: full depe...
12
  #include <asm/asm-offsets.h>
c171f465b   Uros Bizjak   x86, cleanup: use...
13
  #include <asm/processor-flags.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
14

c171f465b   Uros Bizjak   x86, cleanup: use...
15
  .text
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
16
17
  
  ENTRY(swsusp_arch_suspend)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
18
19
20
21
22
  	movl %esp, saved_context_esp
  	movl %ebx, saved_context_ebx
  	movl %ebp, saved_context_ebp
  	movl %esi, saved_context_esi
  	movl %edi, saved_context_edi
c171f465b   Uros Bizjak   x86, cleanup: use...
23
24
  	pushfl
  	popl saved_context_eflags
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
25
26
27
  
  	call swsusp_save
  	ret
2d4a34c93   Rafael J. Wysocki   [PATCH] swsusp: S...
28
  ENTRY(restore_image)
8ae06d223   Shaohua Li   x86-32, resume: d...
29
  	movl	mmu_cr4_features, %ecx
e532c06f2   David Fries   x86: fix i486 sus...
30
31
32
  	movl	resume_pg_dir, %eax
  	subl	$__PAGE_OFFSET, %eax
  	movl	%eax, %cr3
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
33

8ae06d223   Shaohua Li   x86-32, resume: d...
34
35
36
37
38
39
  	jecxz	1f	# cr4 Pentium and higher, skip if zero
  	andl	$~(X86_CR4_PGE), %ecx
  	movl	%ecx, %cr4;  # turn off PGE
  	movl	%cr3, %eax;  # flush TLB
  	movl	%eax, %cr3
  1:
75534b50c   Rafael J. Wysocki   [PATCH] Change th...
40
  	movl	restore_pblist, %edx
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
  	.p2align 4,,7
  
  copy_loop:
  	testl	%edx, %edx
  	jz	done
  
  	movl	pbe_address(%edx), %esi
  	movl	pbe_orig_address(%edx), %edi
  
  	movl	$1024, %ecx
  	rep
  	movsl
  
  	movl	pbe_next(%edx), %edx
  	jmp	copy_loop
  	.p2align 4,,7
  
  done:
2d4a34c93   Rafael J. Wysocki   [PATCH] swsusp: S...
59
  	/* go back to the original page tables */
e532c06f2   David Fries   x86: fix i486 sus...
60
61
62
  	movl	$swapper_pg_dir, %eax
  	subl	$__PAGE_OFFSET, %eax
  	movl	%eax, %cr3
e532c06f2   David Fries   x86: fix i486 sus...
63
64
  	movl	mmu_cr4_features, %ecx
  	jecxz	1f	# cr4 Pentium and higher, skip if zero
e532c06f2   David Fries   x86: fix i486 sus...
65
66
  	movl	%ecx, %cr4;  # turn PGE back on
  1:
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
67
68
69
70
71
72
  
  	movl saved_context_esp, %esp
  	movl saved_context_ebp, %ebp
  	movl saved_context_ebx, %ebx
  	movl saved_context_esi, %esi
  	movl saved_context_edi, %edi
c171f465b   Uros Bizjak   x86, cleanup: use...
73
74
  	pushl saved_context_eflags
  	popfl
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
75
76
77
78
  
  	xorl	%eax, %eax
  
  	ret