|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v2 7/7] x86/kexec: Zero GPRs before entering new kernel
Purgatory zeros these general purpose registers before jumping to the
new kernel. When doing kexec on an EFI kernel there is no purgatory so
we need to zero the registers here instead. This change shouldn't affect
the functionality of legacy kexec.
Signed-off-by: Kevin Lampis <kevin.lampis@xxxxxxxxxx>
---
Changes in v2:
- Move the 32bit lines to the correct place
- Reword the patch subject line
- Fix indentation
---
xen/arch/x86/x86_64/kexec_reloc.S | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/xen/arch/x86/x86_64/kexec_reloc.S
b/xen/arch/x86/x86_64/kexec_reloc.S
index ab9fa7f2b8..f8ec457a19 100644
--- a/xen/arch/x86/x86_64/kexec_reloc.S
+++ b/xen/arch/x86/x86_64/kexec_reloc.S
@@ -78,6 +78,20 @@ FUNC(kexec_reloc, PAGE_SIZE)
testq $KEXEC_RELOC_FLAG_COMPAT, %r8
jnz .L_call_32_bit
+ xor %edi, %edi
+ xor %eax, %eax
+ xor %ebx, %ebx
+ xor %ecx, %ecx
+ xor %edx, %edx
+ xor %r8d, %r8d
+ xor %r9d, %r9d
+ xor %r10d, %r10d
+ xor %r11d, %r11d
+ xor %r12d, %r12d
+ xor %r13d, %r13d
+ xor %r14d, %r14d
+ xor %r15d, %r15d
+
/* Jump to the image entry point */
jmp *%rbp
@@ -94,6 +108,7 @@ FUNC(kexec_reloc, PAGE_SIZE)
lea compatibility_mode(%rip), %rax
push $0x10
push %rax
+
lretq
END(kexec_reloc)
@@ -171,6 +186,11 @@ FUNC_LOCAL(compatibility_mode)
xorl %eax, %eax
movl %eax, %cr4
+ xor %edi, %edi
+ xor %ebx, %ebx
+ xor %ecx, %ecx
+ xor %edx, %edx
+
/* Jump to the image entry point. */
jmp *%ebp
END(compatibility_mode)
--
2.52.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |