Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1339974

[PATCH] xen/x86: Zero out .bss for PV guests

From Boris Ostrovsky <boris.ostrovsky@oracle.com>
Newsgroups linux.kernel
Subject [PATCH] xen/x86: Zero out .bss for PV guests
Date 2016-02-22 23:10 +0100
Message-ID <r56Q3-3YI-45@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Baremetal kernels clear .bss early in the boot. Since Xen PV guests don't
excecute that early code they should do it too.

(Since we introduce macros for specifying 32- and 64-bit registers we
can get rid of ifdefs in startup_xen())

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
---
 arch/x86/xen/xen-head.S | 29 ++++++++++++++++++++++-------
 1 file changed, 22 insertions(+), 7 deletions(-)

diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S
index b65f59a..2af87d1 100644
--- a/arch/x86/xen/xen-head.S
+++ b/arch/x86/xen/xen-head.S
@@ -35,16 +35,31 @@
 #define PVH_FEATURES (0)
 #endif
 
-	__INIT
-ENTRY(startup_xen)
-	cld
 #ifdef CONFIG_X86_32
-	mov %esi,xen_start_info
-	mov $init_thread_union+THREAD_SIZE,%esp
+#define REG(register)	%e##register
+#define WSIZE_SHIFT	2
+#define STOS		stosl
 #else
-	mov %rsi,xen_start_info
-	mov $init_thread_union+THREAD_SIZE,%rsp
+#define REG(register)	%r##register
+#define WSIZE_SHIFT	3
+#define STOS		stosq
 #endif
+
+	__INIT
+ENTRY(startup_xen)
+	cld
+
+	/* Clear .bss */
+	xor REG(ax),REG(ax)
+	mov $__bss_start,REG(di)
+	mov $__bss_stop,REG(cx)
+	sub REG(di),REG(cx)
+	shr $WSIZE_SHIFT,REG(cx)
+	rep STOS
+
+	mov REG(si),xen_start_info
+	mov $init_thread_union+THREAD_SIZE,REG(sp)
+
 	jmp xen_start_kernel
 
 	__FINIT
-- 
2.1.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] xen/x86: Zero out .bss for PV guests Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2016-02-22 23:10 +0100
  Re: [Xen-devel] [PATCH] xen/x86: Zero out .bss for PV guests David Vrabel <david.vrabel@citrix.com> - 2016-02-24 15:20 +0100
    Re: [Xen-devel] [PATCH] xen/x86: Zero out .bss for PV guests Andrew Cooper <andrew.cooper3@citrix.com> - 2016-02-24 15:20 +0100
      Re: [Xen-devel] [PATCH] xen/x86: Zero out .bss for PV guests Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2016-02-24 16:00 +0100
        Re: [Xen-devel] [PATCH] xen/x86: Zero out .bss for PV guests David Vrabel <david.vrabel@citrix.com> - 2016-02-24 16:00 +0100
          Re: [Xen-devel] [PATCH] xen/x86: Zero out .bss for PV guests "Luis R. Rodriguez" <mcgrof@kernel.org> - 2016-02-24 17:30 +0100
            Re: [Xen-devel] [PATCH] xen/x86: Zero out .bss for PV guests Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2016-02-24 17:50 +0100

csiph-web