aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/head_32.S
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/head_32.S')
-rw-r--r--arch/x86/kernel/head_32.S49
1 files changed, 28 insertions, 21 deletions
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index f7357cc0162c..e835b4eea70b 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -172,10 +172,6 @@ num_subarch_entries = (. - subarch_entries) / 4
172 * 172 *
173 * Note that the stack is not yet set up! 173 * Note that the stack is not yet set up!
174 */ 174 */
175#define PTE_ATTR 0x007 /* PRESENT+RW+USER */
176#define PDE_ATTR 0x067 /* PRESENT+RW+USER+DIRTY+ACCESSED */
177#define PGD_ATTR 0x001 /* PRESENT (no other attributes) */
178
179default_entry: 175default_entry:
180#ifdef CONFIG_X86_PAE 176#ifdef CONFIG_X86_PAE
181 177
@@ -194,10 +190,11 @@ default_entry:
194 xorl %ebx,%ebx /* %ebx is kept at zero */ 190 xorl %ebx,%ebx /* %ebx is kept at zero */
195 191
196 movl $pa(pg0), %edi 192 movl $pa(pg0), %edi
193 movl %edi, pa(init_pg_tables_start)
197 movl $pa(swapper_pg_pmd), %edx 194 movl $pa(swapper_pg_pmd), %edx
198 movl $PTE_ATTR, %eax 195 movl $PTE_IDENT_ATTR, %eax
19910: 19610:
200 leal PDE_ATTR(%edi),%ecx /* Create PMD entry */ 197 leal PDE_IDENT_ATTR(%edi),%ecx /* Create PMD entry */
201 movl %ecx,(%edx) /* Store PMD entry */ 198 movl %ecx,(%edx) /* Store PMD entry */
202 /* Upper half already zero */ 199 /* Upper half already zero */
203 addl $8,%edx 200 addl $8,%edx
@@ -214,24 +211,27 @@ default_entry:
214 * End condition: we must map up to and including INIT_MAP_BEYOND_END 211 * End condition: we must map up to and including INIT_MAP_BEYOND_END
215 * bytes beyond the end of our own page tables. 212 * bytes beyond the end of our own page tables.
216 */ 213 */
217 leal (INIT_MAP_BEYOND_END+PTE_ATTR)(%edi),%ebp 214 leal (INIT_MAP_BEYOND_END+PTE_IDENT_ATTR)(%edi),%ebp
218 cmpl %ebp,%eax 215 cmpl %ebp,%eax
219 jb 10b 216 jb 10b
2201: 2171:
221 movl %edi,pa(init_pg_tables_end) 218 movl %edi,pa(init_pg_tables_end)
219 shrl $12, %eax
220 movl %eax, pa(max_pfn_mapped)
222 221
223 /* Do early initialization of the fixmap area */ 222 /* Do early initialization of the fixmap area */
224 movl $pa(swapper_pg_fixmap)+PDE_ATTR,%eax 223 movl $pa(swapper_pg_fixmap)+PDE_IDENT_ATTR,%eax
225 movl %eax,pa(swapper_pg_pmd+0x1000*KPMDS-8) 224 movl %eax,pa(swapper_pg_pmd+0x1000*KPMDS-8)
226#else /* Not PAE */ 225#else /* Not PAE */
227 226
228page_pde_offset = (__PAGE_OFFSET >> 20); 227page_pde_offset = (__PAGE_OFFSET >> 20);
229 228
230 movl $pa(pg0), %edi 229 movl $pa(pg0), %edi
230 movl %edi, pa(init_pg_tables_start)
231 movl $pa(swapper_pg_dir), %edx 231 movl $pa(swapper_pg_dir), %edx
232 movl $PTE_ATTR, %eax 232 movl $PTE_IDENT_ATTR, %eax
23310: 23310:
234 leal PDE_ATTR(%edi),%ecx /* Create PDE entry */ 234 leal PDE_IDENT_ATTR(%edi),%ecx /* Create PDE entry */
235 movl %ecx,(%edx) /* Store identity PDE entry */ 235 movl %ecx,(%edx) /* Store identity PDE entry */
236 movl %ecx,page_pde_offset(%edx) /* Store kernel PDE entry */ 236 movl %ecx,page_pde_offset(%edx) /* Store kernel PDE entry */
237 addl $4,%edx 237 addl $4,%edx
@@ -245,13 +245,15 @@ page_pde_offset = (__PAGE_OFFSET >> 20);
245 * bytes beyond the end of our own page tables; the +0x007 is 245 * bytes beyond the end of our own page tables; the +0x007 is
246 * the attribute bits 246 * the attribute bits
247 */ 247 */
248 leal (INIT_MAP_BEYOND_END+PTE_ATTR)(%edi),%ebp 248 leal (INIT_MAP_BEYOND_END+PTE_IDENT_ATTR)(%edi),%ebp
249 cmpl %ebp,%eax 249 cmpl %ebp,%eax
250 jb 10b 250 jb 10b
251 movl %edi,pa(init_pg_tables_end) 251 movl %edi,pa(init_pg_tables_end)
252 shrl $12, %eax
253 movl %eax, pa(max_pfn_mapped)
252 254
253 /* Do early initialization of the fixmap area */ 255 /* Do early initialization of the fixmap area */
254 movl $pa(swapper_pg_fixmap)+PDE_ATTR,%eax 256 movl $pa(swapper_pg_fixmap)+PDE_IDENT_ATTR,%eax
255 movl %eax,pa(swapper_pg_dir+0xffc) 257 movl %eax,pa(swapper_pg_dir+0xffc)
256#endif 258#endif
257 jmp 3f 259 jmp 3f
@@ -446,10 +448,10 @@ is386: movl $2,%ecx # set MP
446 je 1f 448 je 1f
447 movl $(__KERNEL_PERCPU), %eax 449 movl $(__KERNEL_PERCPU), %eax
448 movl %eax,%fs # set this cpu's percpu 450 movl %eax,%fs # set this cpu's percpu
449 jmp initialize_secondary # all other CPUs call initialize_secondary 451 movl (stack_start), %esp
4501: 4521:
451#endif /* CONFIG_SMP */ 453#endif /* CONFIG_SMP */
452 jmp i386_start_kernel 454 jmp *(initial_code)
453 455
454/* 456/*
455 * We depend on ET to be correct. This checks for 287/387. 457 * We depend on ET to be correct. This checks for 287/387.
@@ -592,6 +594,11 @@ ignore_int:
592#endif 594#endif
593 iret 595 iret
594 596
597.section .cpuinit.data,"wa"
598.align 4
599ENTRY(initial_code)
600 .long i386_start_kernel
601
595.section .text 602.section .text
596/* 603/*
597 * Real beginning of normal "text" segment 604 * Real beginning of normal "text" segment
@@ -623,19 +630,19 @@ ENTRY(empty_zero_page)
623 /* Page-aligned for the benefit of paravirt? */ 630 /* Page-aligned for the benefit of paravirt? */
624 .align PAGE_SIZE_asm 631 .align PAGE_SIZE_asm
625ENTRY(swapper_pg_dir) 632ENTRY(swapper_pg_dir)
626 .long pa(swapper_pg_pmd+PGD_ATTR),0 /* low identity map */ 633 .long pa(swapper_pg_pmd+PGD_IDENT_ATTR),0 /* low identity map */
627# if KPMDS == 3 634# if KPMDS == 3
628 .long pa(swapper_pg_pmd+PGD_ATTR),0 635 .long pa(swapper_pg_pmd+PGD_IDENT_ATTR),0
629 .long pa(swapper_pg_pmd+PGD_ATTR+0x1000),0 636 .long pa(swapper_pg_pmd+PGD_IDENT_ATTR+0x1000),0
630 .long pa(swapper_pg_pmd+PGD_ATTR+0x2000),0 637 .long pa(swapper_pg_pmd+PGD_IDENT_ATTR+0x2000),0
631# elif KPMDS == 2 638# elif KPMDS == 2
632 .long 0,0 639 .long 0,0
633 .long pa(swapper_pg_pmd+PGD_ATTR),0 640 .long pa(swapper_pg_pmd+PGD_IDENT_ATTR),0
634 .long pa(swapper_pg_pmd+PGD_ATTR+0x1000),0 641 .long pa(swapper_pg_pmd+PGD_IDENT_ATTR+0x1000),0
635# elif KPMDS == 1 642# elif KPMDS == 1
636 .long 0,0 643 .long 0,0
637 .long 0,0 644 .long 0,0
638 .long pa(swapper_pg_pmd+PGD_ATTR),0 645 .long pa(swapper_pg_pmd+PGD_IDENT_ATTR),0
639# else 646# else
640# error "Kernel PMDs should be 1, 2 or 3" 647# error "Kernel PMDs should be 1, 2 or 3"
641# endif 648# endif