[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v3 1/2] xen/x86: Zero out .bss for PV guests
On Thu, Feb 25, 2016 at 10:16 AM, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx> wrote: > Baremetal kernels clear .bss early in the boot but Xen PV guests don't > execute that code. They have been able to run without problems because > Xen domain builder happens to give out zeroed pages. However, since this > is not really guaranteed, .bss should be explicitly cleared. > > Signed-off-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx> > Cc: stable@xxxxxxxxxxxxxxx > --- > arch/x86/xen/xen-head.S | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S > index b65f59a..11dbe49 100644 > --- a/arch/x86/xen/xen-head.S > +++ b/arch/x86/xen/xen-head.S > @@ -38,6 +38,20 @@ > __INIT > ENTRY(startup_xen) > cld > + > +#ifdef CONFIG_X86_32 > +#define WSIZE_SHIFT 2 > +#else > +#define WSIZE_SHIFT 3 > +#endif > + /* Clear .bss */ > + xor %eax,%eax > + mov $__bss_start, %__ASM_REG(di) > + mov $__bss_stop, %__ASM_REG(cx) > + sub %__ASM_REG(di), %__ASM_REG(cx) > + shr $WSIZE_SHIFT, %__ASM_REG(cx) > + rep __ASM_SIZE(stos) > + > #ifdef CONFIG_X86_32 > mov %esi,xen_start_info > mov $init_thread_union+THREAD_SIZE,%esp Better, but can still be improved. Replace WSIZE_SHIFT with __ASM_SEL(2, 3), and use the macros for the registers (ie. __ASM_DI). -- Brian Gerst _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |