提交 b2bc2731 编写于 作者: S Suresh Siddha 提交者: Ingo Molnar

x86, cpa: rename PTE attribute macros for kernel direct mapping in early boot

Signed-off-by: NSuresh Siddha <suresh.b.siddha@intel.com>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: arjan@linux.intel.com
Cc: venkatesh.pallipadi@intel.com
Cc: jeremy@goop.org
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 f81b691a
...@@ -172,10 +172,6 @@ num_subarch_entries = (. - subarch_entries) / 4 ...@@ -172,10 +172,6 @@ num_subarch_entries = (. - subarch_entries) / 4
* *
* Note that the stack is not yet set up! * Note that the stack is not yet set up!
*/ */
#define PTE_ATTR 0x007 /* PRESENT+RW+USER */
#define PDE_ATTR 0x067 /* PRESENT+RW+USER+DIRTY+ACCESSED */
#define PGD_ATTR 0x001 /* PRESENT (no other attributes) */
default_entry: default_entry:
#ifdef CONFIG_X86_PAE #ifdef CONFIG_X86_PAE
...@@ -196,9 +192,9 @@ default_entry: ...@@ -196,9 +192,9 @@ default_entry:
movl $pa(pg0), %edi movl $pa(pg0), %edi
movl %edi, pa(init_pg_tables_start) movl %edi, pa(init_pg_tables_start)
movl $pa(swapper_pg_pmd), %edx movl $pa(swapper_pg_pmd), %edx
movl $PTE_ATTR, %eax movl $PTE_IDENT_ATTR, %eax
10: 10:
leal PDE_ATTR(%edi),%ecx /* Create PMD entry */ leal PDE_IDENT_ATTR(%edi),%ecx /* Create PMD entry */
movl %ecx,(%edx) /* Store PMD entry */ movl %ecx,(%edx) /* Store PMD entry */
/* Upper half already zero */ /* Upper half already zero */
addl $8,%edx addl $8,%edx
...@@ -215,7 +211,7 @@ default_entry: ...@@ -215,7 +211,7 @@ default_entry:
* End condition: we must map up to and including INIT_MAP_BEYOND_END * End condition: we must map up to and including INIT_MAP_BEYOND_END
* bytes beyond the end of our own page tables. * bytes beyond the end of our own page tables.
*/ */
leal (INIT_MAP_BEYOND_END+PTE_ATTR)(%edi),%ebp leal (INIT_MAP_BEYOND_END+PTE_IDENT_ATTR)(%edi),%ebp
cmpl %ebp,%eax cmpl %ebp,%eax
jb 10b jb 10b
1: 1:
...@@ -224,7 +220,7 @@ default_entry: ...@@ -224,7 +220,7 @@ default_entry:
movl %eax, pa(max_pfn_mapped) movl %eax, pa(max_pfn_mapped)
/* Do early initialization of the fixmap area */ /* Do early initialization of the fixmap area */
movl $pa(swapper_pg_fixmap)+PDE_ATTR,%eax movl $pa(swapper_pg_fixmap)+PDE_IDENT_ATTR,%eax
movl %eax,pa(swapper_pg_pmd+0x1000*KPMDS-8) movl %eax,pa(swapper_pg_pmd+0x1000*KPMDS-8)
#else /* Not PAE */ #else /* Not PAE */
...@@ -233,9 +229,9 @@ page_pde_offset = (__PAGE_OFFSET >> 20); ...@@ -233,9 +229,9 @@ page_pde_offset = (__PAGE_OFFSET >> 20);
movl $pa(pg0), %edi movl $pa(pg0), %edi
movl %edi, pa(init_pg_tables_start) movl %edi, pa(init_pg_tables_start)
movl $pa(swapper_pg_dir), %edx movl $pa(swapper_pg_dir), %edx
movl $PTE_ATTR, %eax movl $PTE_IDENT_ATTR, %eax
10: 10:
leal PDE_ATTR(%edi),%ecx /* Create PDE entry */ leal PDE_IDENT_ATTR(%edi),%ecx /* Create PDE entry */
movl %ecx,(%edx) /* Store identity PDE entry */ movl %ecx,(%edx) /* Store identity PDE entry */
movl %ecx,page_pde_offset(%edx) /* Store kernel PDE entry */ movl %ecx,page_pde_offset(%edx) /* Store kernel PDE entry */
addl $4,%edx addl $4,%edx
...@@ -249,7 +245,7 @@ page_pde_offset = (__PAGE_OFFSET >> 20); ...@@ -249,7 +245,7 @@ page_pde_offset = (__PAGE_OFFSET >> 20);
* bytes beyond the end of our own page tables; the +0x007 is * bytes beyond the end of our own page tables; the +0x007 is
* the attribute bits * the attribute bits
*/ */
leal (INIT_MAP_BEYOND_END+PTE_ATTR)(%edi),%ebp leal (INIT_MAP_BEYOND_END+PTE_IDENT_ATTR)(%edi),%ebp
cmpl %ebp,%eax cmpl %ebp,%eax
jb 10b jb 10b
movl %edi,pa(init_pg_tables_end) movl %edi,pa(init_pg_tables_end)
...@@ -257,7 +253,7 @@ page_pde_offset = (__PAGE_OFFSET >> 20); ...@@ -257,7 +253,7 @@ page_pde_offset = (__PAGE_OFFSET >> 20);
movl %eax, pa(max_pfn_mapped) movl %eax, pa(max_pfn_mapped)
/* Do early initialization of the fixmap area */ /* Do early initialization of the fixmap area */
movl $pa(swapper_pg_fixmap)+PDE_ATTR,%eax movl $pa(swapper_pg_fixmap)+PDE_IDENT_ATTR,%eax
movl %eax,pa(swapper_pg_dir+0xffc) movl %eax,pa(swapper_pg_dir+0xffc)
#endif #endif
jmp 3f jmp 3f
...@@ -634,19 +630,19 @@ ENTRY(empty_zero_page) ...@@ -634,19 +630,19 @@ ENTRY(empty_zero_page)
/* Page-aligned for the benefit of paravirt? */ /* Page-aligned for the benefit of paravirt? */
.align PAGE_SIZE_asm .align PAGE_SIZE_asm
ENTRY(swapper_pg_dir) ENTRY(swapper_pg_dir)
.long pa(swapper_pg_pmd+PGD_ATTR),0 /* low identity map */ .long pa(swapper_pg_pmd+PGD_IDENT_ATTR),0 /* low identity map */
# if KPMDS == 3 # if KPMDS == 3
.long pa(swapper_pg_pmd+PGD_ATTR),0 .long pa(swapper_pg_pmd+PGD_IDENT_ATTR),0
.long pa(swapper_pg_pmd+PGD_ATTR+0x1000),0 .long pa(swapper_pg_pmd+PGD_IDENT_ATTR+0x1000),0
.long pa(swapper_pg_pmd+PGD_ATTR+0x2000),0 .long pa(swapper_pg_pmd+PGD_IDENT_ATTR+0x2000),0
# elif KPMDS == 2 # elif KPMDS == 2
.long 0,0 .long 0,0
.long pa(swapper_pg_pmd+PGD_ATTR),0 .long pa(swapper_pg_pmd+PGD_IDENT_ATTR),0
.long pa(swapper_pg_pmd+PGD_ATTR+0x1000),0 .long pa(swapper_pg_pmd+PGD_IDENT_ATTR+0x1000),0
# elif KPMDS == 1 # elif KPMDS == 1
.long 0,0 .long 0,0
.long 0,0 .long 0,0
.long pa(swapper_pg_pmd+PGD_ATTR),0 .long pa(swapper_pg_pmd+PGD_IDENT_ATTR),0
# else # else
# error "Kernel PMDs should be 1, 2 or 3" # error "Kernel PMDs should be 1, 2 or 3"
# endif # endif
......
...@@ -110,7 +110,7 @@ startup_64: ...@@ -110,7 +110,7 @@ startup_64:
movq %rdi, %rax movq %rdi, %rax
shrq $PMD_SHIFT, %rax shrq $PMD_SHIFT, %rax
andq $(PTRS_PER_PMD - 1), %rax andq $(PTRS_PER_PMD - 1), %rax
leaq __PAGE_KERNEL_LARGE_EXEC(%rdi), %rdx leaq __PAGE_KERNEL_IDENT_LARGE_EXEC(%rdi), %rdx
leaq level2_spare_pgt(%rip), %rbx leaq level2_spare_pgt(%rip), %rbx
movq %rdx, 0(%rbx, %rax, 8) movq %rdx, 0(%rbx, %rax, 8)
ident_complete: ident_complete:
...@@ -374,7 +374,7 @@ NEXT_PAGE(level2_ident_pgt) ...@@ -374,7 +374,7 @@ NEXT_PAGE(level2_ident_pgt)
/* Since I easily can, map the first 1G. /* Since I easily can, map the first 1G.
* Don't set NX because code runs from these pages. * Don't set NX because code runs from these pages.
*/ */
PMDS(0, __PAGE_KERNEL_LARGE_EXEC, PTRS_PER_PMD) PMDS(0, __PAGE_KERNEL_IDENT_LARGE_EXEC, PTRS_PER_PMD)
NEXT_PAGE(level2_kernel_pgt) NEXT_PAGE(level2_kernel_pgt)
/* /*
......
...@@ -132,6 +132,17 @@ ...@@ -132,6 +132,17 @@
#define __S110 PAGE_SHARED_EXEC #define __S110 PAGE_SHARED_EXEC
#define __S111 PAGE_SHARED_EXEC #define __S111 PAGE_SHARED_EXEC
/*
* early identity mapping pte attrib macros.
*/
#ifdef CONFIG_X86_64
#define __PAGE_KERNEL_IDENT_LARGE_EXEC __PAGE_KERNEL_LARGE_EXEC
#else
#define PTE_IDENT_ATTR 0x007 /* PRESENT+RW+USER */
#define PDE_IDENT_ATTR 0x067 /* PRESENT+RW+USER+DIRTY+ACCESSED */
#define PGD_IDENT_ATTR 0x001 /* PRESENT (no other attributes) */
#endif
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册