mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
x86/kexec: Disable FRED earlier in kexec_reloc()
With FRED just as with IDT, it's unsafe to run the exception handlers after switching stack. To remove this unsafe window, %cr4 needs clearing earlier. In turn, we may need to switch to PCID 0 earlier too in order to be able to clear CR4.PCIDE. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com> --- CC: Jan Beulich <JBeulich@suse.com> CC: Roger Pau Monné <roger.pau@citrix.com>
This commit is contained in:
1 parent
c3974cbf20
commit
4665d17967
1 file changed
+15
-7
@@ -54,6 +54,21 @@ FUNC(kexec_reloc, PAGE_SIZE)
|
||||
lidt (%rsp)
|
||||
add $10, %rsp
|
||||
|
||||
/* Move to PCID 0 if necessary, as a prerequisite to clearing CR4.PCIDE */
|
||||
mov %cr3, %rax
|
||||
test $0xfff, %eax
|
||||
jz 1f
|
||||
and $~0xfff, %rax
|
||||
mov %rax, %cr3
|
||||
1:
|
||||
|
||||
/*
|
||||
* Set CR4 to PAE only. This may disable FRED, which must happen
|
||||
* before switching off Xen's stack.
|
||||
*/
|
||||
mov $X86_CR4_PAE, %eax
|
||||
mov %rax, %cr4
|
||||
|
||||
/*
|
||||
* Move to the identity mapped stack.
|
||||
*
|
||||
@@ -86,13 +101,6 @@ FUNC(kexec_reloc, PAGE_SIZE)
|
||||
orl $(X86_CR0_PG | X86_CR0_PE), %eax
|
||||
movq %rax, %cr0
|
||||
|
||||
/*
|
||||
* Set cr4 to a known state:
|
||||
* - physical address extension enabled
|
||||
*/
|
||||
movl $X86_CR4_PAE, %eax
|
||||
movq %rax, %cr4
|
||||
|
||||
movq %rdx, %rdi
|
||||
call relocate_pages
|
||||
|
||||
|
||||