aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/relocate_kernel_32.S
diff options
context:
space:
mode:
authorHuang Ying <ying.huang@intel.com>2008-10-30 21:48:15 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-31 05:01:57 -0400
commit9868ee63b896ee4d2ceb8c292e88d7f4e66caaf9 (patch)
tree688fff3c2f44fa260a3a05589fa8b7529ddc9fb8 /arch/x86/kernel/relocate_kernel_32.S
parent92be3d6bdf2cb34972ab50e12ad4da1076e690da (diff)
kexec/i386: setup kexec page table in C
Impact: change the kexec bootstrap code implementation from assembly to C This patch transforms the kexec page tables setup code from assembler code to C code in machine_kexec_prepare. This improves readability and reduces code line number. Signed-off-by: Huang Ying <ying.huang@intel.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/relocate_kernel_32.S')
-rw-r--r--arch/x86/kernel/relocate_kernel_32.S114
1 files changed, 0 insertions, 114 deletions
diff --git a/arch/x86/kernel/relocate_kernel_32.S b/arch/x86/kernel/relocate_kernel_32.S
index 377da3f78e8c..a160f3119725 100644
--- a/arch/x86/kernel/relocate_kernel_32.S
+++ b/arch/x86/kernel/relocate_kernel_32.S
@@ -10,15 +10,12 @@
10#include <asm/page.h> 10#include <asm/page.h>
11#include <asm/kexec.h> 11#include <asm/kexec.h>
12#include <asm/processor-flags.h> 12#include <asm/processor-flags.h>
13#include <asm/pgtable.h>
14 13
15/* 14/*
16 * Must be relocatable PIC code callable as a C function 15 * Must be relocatable PIC code callable as a C function
17 */ 16 */
18 17
19#define PTR(x) (x << 2) 18#define PTR(x) (x << 2)
20#define PAGE_ATTR (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY)
21#define PAE_PGD_ATTR (_PAGE_PRESENT)
22 19
23/* control_page + KEXEC_CONTROL_CODE_MAX_SIZE 20/* control_page + KEXEC_CONTROL_CODE_MAX_SIZE
24 * ~ control_page + PAGE_SIZE are used as data storage and stack for 21 * ~ control_page + PAGE_SIZE are used as data storage and stack for
@@ -59,117 +56,6 @@ relocate_kernel:
59 movl %cr4, %eax 56 movl %cr4, %eax
60 movl %eax, CR4(%edi) 57 movl %eax, CR4(%edi)
61 58
62#ifdef CONFIG_X86_PAE
63 /* map the control page at its virtual address */
64
65 movl PTR(VA_PGD)(%ebp), %edi
66 movl PTR(VA_CONTROL_PAGE)(%ebp), %eax
67 andl $0xc0000000, %eax
68 shrl $27, %eax
69 addl %edi, %eax
70
71 movl PTR(PA_PMD_0)(%ebp), %edx
72 orl $PAE_PGD_ATTR, %edx
73 movl %edx, (%eax)
74
75 movl PTR(VA_PMD_0)(%ebp), %edi
76 movl PTR(VA_CONTROL_PAGE)(%ebp), %eax
77 andl $0x3fe00000, %eax
78 shrl $18, %eax
79 addl %edi, %eax
80
81 movl PTR(PA_PTE_0)(%ebp), %edx
82 orl $PAGE_ATTR, %edx
83 movl %edx, (%eax)
84
85 movl PTR(VA_PTE_0)(%ebp), %edi
86 movl PTR(VA_CONTROL_PAGE)(%ebp), %eax
87 andl $0x001ff000, %eax
88 shrl $9, %eax
89 addl %edi, %eax
90
91 movl PTR(PA_CONTROL_PAGE)(%ebp), %edx
92 orl $PAGE_ATTR, %edx
93 movl %edx, (%eax)
94
95 /* identity map the control page at its physical address */
96
97 movl PTR(VA_PGD)(%ebp), %edi
98 movl PTR(PA_CONTROL_PAGE)(%ebp), %eax
99 andl $0xc0000000, %eax
100 shrl $27, %eax
101 addl %edi, %eax
102
103 movl PTR(PA_PMD_1)(%ebp), %edx
104 orl $PAE_PGD_ATTR, %edx
105 movl %edx, (%eax)
106
107 movl PTR(VA_PMD_1)(%ebp), %edi
108 movl PTR(PA_CONTROL_PAGE)(%ebp), %eax
109 andl $0x3fe00000, %eax
110 shrl $18, %eax
111 addl %edi, %eax
112
113 movl PTR(PA_PTE_1)(%ebp), %edx
114 orl $PAGE_ATTR, %edx
115 movl %edx, (%eax)
116
117 movl PTR(VA_PTE_1)(%ebp), %edi
118 movl PTR(PA_CONTROL_PAGE)(%ebp), %eax
119 andl $0x001ff000, %eax
120 shrl $9, %eax
121 addl %edi, %eax
122
123 movl PTR(PA_CONTROL_PAGE)(%ebp), %edx
124 orl $PAGE_ATTR, %edx
125 movl %edx, (%eax)
126#else
127 /* map the control page at its virtual address */
128
129 movl PTR(VA_PGD)(%ebp), %edi
130 movl PTR(VA_CONTROL_PAGE)(%ebp), %eax
131 andl $0xffc00000, %eax
132 shrl $20, %eax
133 addl %edi, %eax
134
135 movl PTR(PA_PTE_0)(%ebp), %edx
136 orl $PAGE_ATTR, %edx
137 movl %edx, (%eax)
138
139 movl PTR(VA_PTE_0)(%ebp), %edi
140 movl PTR(VA_CONTROL_PAGE)(%ebp), %eax
141 andl $0x003ff000, %eax
142 shrl $10, %eax
143 addl %edi, %eax
144
145 movl PTR(PA_CONTROL_PAGE)(%ebp), %edx
146 orl $PAGE_ATTR, %edx
147 movl %edx, (%eax)
148
149 /* identity map the control page at its physical address */
150
151 movl PTR(VA_PGD)(%ebp), %edi
152 movl PTR(PA_CONTROL_PAGE)(%ebp), %eax
153 andl $0xffc00000, %eax
154 shrl $20, %eax
155 addl %edi, %eax
156
157 movl PTR(PA_PTE_1)(%ebp), %edx
158 orl $PAGE_ATTR, %edx
159 movl %edx, (%eax)
160
161 movl PTR(VA_PTE_1)(%ebp), %edi
162 movl PTR(PA_CONTROL_PAGE)(%ebp), %eax
163 andl $0x003ff000, %eax
164 shrl $10, %eax
165 addl %edi, %eax
166
167 movl PTR(PA_CONTROL_PAGE)(%ebp), %edx
168 orl $PAGE_ATTR, %edx
169 movl %edx, (%eax)
170#endif
171
172relocate_new_kernel:
173 /* read the arguments and say goodbye to the stack */ 59 /* read the arguments and say goodbye to the stack */
174 movl 20+4(%esp), %ebx /* page_list */ 60 movl 20+4(%esp), %ebx /* page_list */
175 movl 20+8(%esp), %ebp /* list of pages */ 61 movl 20+8(%esp), %ebp /* list of pages */