mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
x86/kexec: Fix and expand comments for kexec_reloc()
The order of shutdown is delicate. Explain things a little better. Fix two comments about leaving Long Mode. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Acked-by: Jan Beulich <jbeulich@suse.com> Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
This commit is contained in:
1 parent
ad9c7d86c9
commit
5cdae3c505
1 file changed
+19
-4
@@ -27,6 +27,14 @@
|
|||||||
.section .text.kexec, "ax", @progbits
|
.section .text.kexec, "ax", @progbits
|
||||||
.code64
|
.code64
|
||||||
|
|
||||||
|
/*
|
||||||
|
* kexec_reloc() is entered in it's natural position within Xen.
|
||||||
|
*
|
||||||
|
* A copy of .text.kexec is identity mapped at %rdi within the
|
||||||
|
* pagetables in %rsi. Xen's .text is mapped into %rsi at it's high
|
||||||
|
* alias allowing to pivot, but most other things including the stacks
|
||||||
|
* are not mapped.
|
||||||
|
*/
|
||||||
FUNC(kexec_reloc, PAGE_SIZE)
|
FUNC(kexec_reloc, PAGE_SIZE)
|
||||||
/* %rdi - code page maddr */
|
/* %rdi - code page maddr */
|
||||||
/* %rsi - page table maddr */
|
/* %rsi - page table maddr */
|
||||||
@@ -36,10 +44,17 @@ FUNC(kexec_reloc, PAGE_SIZE)
|
|||||||
|
|
||||||
movq %rcx, %rbp
|
movq %rcx, %rbp
|
||||||
|
|
||||||
/* Setup stack. */
|
/*
|
||||||
|
* Move to the identity mapped stack.
|
||||||
|
*
|
||||||
|
* Note this mapping doesn't exist until the pagetable switch.
|
||||||
|
*/
|
||||||
leaq (.Lreloc_stack_base - kexec_reloc)(%rdi), %rsp
|
leaq (.Lreloc_stack_base - kexec_reloc)(%rdi), %rsp
|
||||||
|
|
||||||
/* Load reloc page table. */
|
/*
|
||||||
|
* Move to the relocation pagetables. Xen's .text is mapped allowing
|
||||||
|
* the pivot, but very little else is.
|
||||||
|
*/
|
||||||
movq %rsi, %cr3
|
movq %rsi, %cr3
|
||||||
|
|
||||||
/* Jump to identity mapped code. */
|
/* Jump to identity mapped code. */
|
||||||
@@ -153,12 +168,12 @@ FUNC_LOCAL(compatibility_mode)
|
|||||||
movl %eax, %gs
|
movl %eax, %gs
|
||||||
movl %eax, %ss
|
movl %eax, %ss
|
||||||
|
|
||||||
/* Disable paging and therefore leave 64 bit mode. */
|
/* Disable paging and therefore leave long mode. */
|
||||||
movl %cr0, %eax
|
movl %cr0, %eax
|
||||||
andl $~X86_CR0_PG, %eax
|
andl $~X86_CR0_PG, %eax
|
||||||
movl %eax, %cr0
|
movl %eax, %cr0
|
||||||
|
|
||||||
/* Disable long mode */
|
/* Clear EFER.LME */
|
||||||
movl $MSR_EFER, %ecx
|
movl $MSR_EFER, %ecx
|
||||||
rdmsr
|
rdmsr
|
||||||
andl $~EFER_LME, %eax
|
andl $~EFER_LME, %eax
|
||||||
|
|||||||