|
@@ -10,15 +10,12 @@
|
|
#include <asm/page.h>
|
|
#include <asm/page.h>
|
|
#include <asm/kexec.h>
|
|
#include <asm/kexec.h>
|
|
#include <asm/processor-flags.h>
|
|
#include <asm/processor-flags.h>
|
|
-#include <asm/pgtable.h>
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
* Must be relocatable PIC code callable as a C function
|
|
* Must be relocatable PIC code callable as a C function
|
|
*/
|
|
*/
|
|
|
|
|
|
#define PTR(x) (x << 2)
|
|
#define PTR(x) (x << 2)
|
|
-#define PAGE_ATTR (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY)
|
|
|
|
-#define PAE_PGD_ATTR (_PAGE_PRESENT)
|
|
|
|
|
|
|
|
/* control_page + KEXEC_CONTROL_CODE_MAX_SIZE
|
|
/* control_page + KEXEC_CONTROL_CODE_MAX_SIZE
|
|
* ~ control_page + PAGE_SIZE are used as data storage and stack for
|
|
* ~ control_page + PAGE_SIZE are used as data storage and stack for
|
|
@@ -59,117 +56,6 @@ relocate_kernel:
|
|
movl %cr4, %eax
|
|
movl %cr4, %eax
|
|
movl %eax, CR4(%edi)
|
|
movl %eax, CR4(%edi)
|
|
|
|
|
|
-#ifdef CONFIG_X86_PAE
|
|
|
|
- /* map the control page at its virtual address */
|
|
|
|
-
|
|
|
|
- movl PTR(VA_PGD)(%ebp), %edi
|
|
|
|
- movl PTR(VA_CONTROL_PAGE)(%ebp), %eax
|
|
|
|
- andl $0xc0000000, %eax
|
|
|
|
- shrl $27, %eax
|
|
|
|
- addl %edi, %eax
|
|
|
|
-
|
|
|
|
- movl PTR(PA_PMD_0)(%ebp), %edx
|
|
|
|
- orl $PAE_PGD_ATTR, %edx
|
|
|
|
- movl %edx, (%eax)
|
|
|
|
-
|
|
|
|
- movl PTR(VA_PMD_0)(%ebp), %edi
|
|
|
|
- movl PTR(VA_CONTROL_PAGE)(%ebp), %eax
|
|
|
|
- andl $0x3fe00000, %eax
|
|
|
|
- shrl $18, %eax
|
|
|
|
- addl %edi, %eax
|
|
|
|
-
|
|
|
|
- movl PTR(PA_PTE_0)(%ebp), %edx
|
|
|
|
- orl $PAGE_ATTR, %edx
|
|
|
|
- movl %edx, (%eax)
|
|
|
|
-
|
|
|
|
- movl PTR(VA_PTE_0)(%ebp), %edi
|
|
|
|
- movl PTR(VA_CONTROL_PAGE)(%ebp), %eax
|
|
|
|
- andl $0x001ff000, %eax
|
|
|
|
- shrl $9, %eax
|
|
|
|
- addl %edi, %eax
|
|
|
|
-
|
|
|
|
- movl PTR(PA_CONTROL_PAGE)(%ebp), %edx
|
|
|
|
- orl $PAGE_ATTR, %edx
|
|
|
|
- movl %edx, (%eax)
|
|
|
|
-
|
|
|
|
- /* identity map the control page at its physical address */
|
|
|
|
-
|
|
|
|
- movl PTR(VA_PGD)(%ebp), %edi
|
|
|
|
- movl PTR(PA_CONTROL_PAGE)(%ebp), %eax
|
|
|
|
- andl $0xc0000000, %eax
|
|
|
|
- shrl $27, %eax
|
|
|
|
- addl %edi, %eax
|
|
|
|
-
|
|
|
|
- movl PTR(PA_PMD_1)(%ebp), %edx
|
|
|
|
- orl $PAE_PGD_ATTR, %edx
|
|
|
|
- movl %edx, (%eax)
|
|
|
|
-
|
|
|
|
- movl PTR(VA_PMD_1)(%ebp), %edi
|
|
|
|
- movl PTR(PA_CONTROL_PAGE)(%ebp), %eax
|
|
|
|
- andl $0x3fe00000, %eax
|
|
|
|
- shrl $18, %eax
|
|
|
|
- addl %edi, %eax
|
|
|
|
-
|
|
|
|
- movl PTR(PA_PTE_1)(%ebp), %edx
|
|
|
|
- orl $PAGE_ATTR, %edx
|
|
|
|
- movl %edx, (%eax)
|
|
|
|
-
|
|
|
|
- movl PTR(VA_PTE_1)(%ebp), %edi
|
|
|
|
- movl PTR(PA_CONTROL_PAGE)(%ebp), %eax
|
|
|
|
- andl $0x001ff000, %eax
|
|
|
|
- shrl $9, %eax
|
|
|
|
- addl %edi, %eax
|
|
|
|
-
|
|
|
|
- movl PTR(PA_CONTROL_PAGE)(%ebp), %edx
|
|
|
|
- orl $PAGE_ATTR, %edx
|
|
|
|
- movl %edx, (%eax)
|
|
|
|
-#else
|
|
|
|
- /* map the control page at its virtual address */
|
|
|
|
-
|
|
|
|
- movl PTR(VA_PGD)(%ebp), %edi
|
|
|
|
- movl PTR(VA_CONTROL_PAGE)(%ebp), %eax
|
|
|
|
- andl $0xffc00000, %eax
|
|
|
|
- shrl $20, %eax
|
|
|
|
- addl %edi, %eax
|
|
|
|
-
|
|
|
|
- movl PTR(PA_PTE_0)(%ebp), %edx
|
|
|
|
- orl $PAGE_ATTR, %edx
|
|
|
|
- movl %edx, (%eax)
|
|
|
|
-
|
|
|
|
- movl PTR(VA_PTE_0)(%ebp), %edi
|
|
|
|
- movl PTR(VA_CONTROL_PAGE)(%ebp), %eax
|
|
|
|
- andl $0x003ff000, %eax
|
|
|
|
- shrl $10, %eax
|
|
|
|
- addl %edi, %eax
|
|
|
|
-
|
|
|
|
- movl PTR(PA_CONTROL_PAGE)(%ebp), %edx
|
|
|
|
- orl $PAGE_ATTR, %edx
|
|
|
|
- movl %edx, (%eax)
|
|
|
|
-
|
|
|
|
- /* identity map the control page at its physical address */
|
|
|
|
-
|
|
|
|
- movl PTR(VA_PGD)(%ebp), %edi
|
|
|
|
- movl PTR(PA_CONTROL_PAGE)(%ebp), %eax
|
|
|
|
- andl $0xffc00000, %eax
|
|
|
|
- shrl $20, %eax
|
|
|
|
- addl %edi, %eax
|
|
|
|
-
|
|
|
|
- movl PTR(PA_PTE_1)(%ebp), %edx
|
|
|
|
- orl $PAGE_ATTR, %edx
|
|
|
|
- movl %edx, (%eax)
|
|
|
|
-
|
|
|
|
- movl PTR(VA_PTE_1)(%ebp), %edi
|
|
|
|
- movl PTR(PA_CONTROL_PAGE)(%ebp), %eax
|
|
|
|
- andl $0x003ff000, %eax
|
|
|
|
- shrl $10, %eax
|
|
|
|
- addl %edi, %eax
|
|
|
|
-
|
|
|
|
- movl PTR(PA_CONTROL_PAGE)(%ebp), %edx
|
|
|
|
- orl $PAGE_ATTR, %edx
|
|
|
|
- movl %edx, (%eax)
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
-relocate_new_kernel:
|
|
|
|
/* read the arguments and say goodbye to the stack */
|
|
/* read the arguments and say goodbye to the stack */
|
|
movl 20+4(%esp), %ebx /* page_list */
|
|
movl 20+4(%esp), %ebx /* page_list */
|
|
movl 20+8(%esp), %ebp /* list of pages */
|
|
movl 20+8(%esp), %ebp /* list of pages */
|