[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Mini-OS: x86: zero out .bss segment at boot



Juergen Gross, le mer. 07 févr. 2024 11:31:38 +0100, a ecrit:
> The .bss segment should be zeroed at very early boot.

Is that not done by the elf loader of Xen?

> While adding the extern declaration of __bss_start for x86, make it
> together with the other linker table defined section boundaries
> common for all architectures.
> 
> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
> ---
>  arch/x86/setup.c      | 2 ++
>  include/arm/arch_mm.h | 1 -
>  include/mm.h          | 2 ++
>  include/x86/arch_mm.h | 1 -
>  4 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/setup.c b/arch/x86/setup.c
> index b27bbed7..3dddf4ad 100644
> --- a/arch/x86/setup.c
> +++ b/arch/x86/setup.c
> @@ -184,6 +184,8 @@ arch_init(void *par)
>  {
>       static char hello[] = "Bootstrapping...\n";
>  
> +     memset(&__bss_start, 0, &_end - &__bss_start);
> +
>       hpc_init();
>       (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(hello), hello);
>  
> diff --git a/include/arm/arch_mm.h b/include/arm/arch_mm.h
> index 79d9e05b..335eb4ff 100644
> --- a/include/arm/arch_mm.h
> +++ b/include/arm/arch_mm.h
> @@ -3,7 +3,6 @@
>  
>  typedef uint64_t paddr_t;
>  
> -extern char _text, _etext, _erodata, _edata, _end, __bss_start;
>  extern int _boot_stack[];
>  extern int _boot_stack_end[];
>  extern uint32_t physical_address_offset;     /* Add this to a virtual 
> address to get the physical address (wraps at 4GB) */
> diff --git a/include/mm.h b/include/mm.h
> index 4fc364ff..e02e080b 100644
> --- a/include/mm.h
> +++ b/include/mm.h
> @@ -46,6 +46,8 @@
>  #define round_pgdown(_p)  ((_p) & PAGE_MASK)
>  #define round_pgup(_p)    (((_p) + (PAGE_SIZE - 1)) & PAGE_MASK)
>  
> +extern char _text, _etext, _erodata, _edata, _end, __bss_start;
> +
>  extern unsigned long nr_free_pages;
>  
>  extern unsigned long *mm_alloc_bitmap;
> diff --git a/include/x86/arch_mm.h b/include/x86/arch_mm.h
> index a1b975dc..6b398cef 100644
> --- a/include/x86/arch_mm.h
> +++ b/include/x86/arch_mm.h
> @@ -225,7 +225,6 @@ extern unsigned long *phys_to_machine_mapping;
>  #else
>  extern pgentry_t page_table_base[];
>  #endif
> -extern char _text, _etext, _erodata, _edata, _end;
>  extern unsigned long mfn_zero;
>  static __inline__ maddr_t phys_to_machine(paddr_t phys)
>  {
> -- 
> 2.35.3



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.