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

Re: [Xen-devel] [PATCH v4 14/19] xen: init memory regions for PVH



On Fri, Nov 02, 2018 at 01:37:33PM +0100, Juergen Gross wrote:
> Add all usable memory regions to grub memory management and add the
> needed mmap iterate code, which will be used by grub core (e.g.
> grub-core/lib/relocator.c or grub-core/mmap/mmap.c).
> 
> As we are running in 32-bit mode don't add memory above 4GB.
> 
> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
> ---
>  grub-core/kern/i386/xen/pvh.c | 35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
> 
> diff --git a/grub-core/kern/i386/xen/pvh.c b/grub-core/kern/i386/xen/pvh.c
> index d74301f92..67952ea91 100644
> --- a/grub-core/kern/i386/xen/pvh.c
> +++ b/grub-core/kern/i386/xen/pvh.c
> @@ -299,6 +299,30 @@ grub_xen_set_mmap (void)
>                     (grub_uint32_t) (&memmap), 0, 0, 0, 0);
>  }
>  
> +static void
> +grub_xen_mm_init_regions (void)
> +{
> +  grub_uint64_t modend, from, to;
> +  unsigned int i;
> +
> +  modend = grub_modules_get_end ();
> +
> +  for (i = 0; i < nr_map_entries; i++)
> +    {
> +      if (map[i].type != GRUB_MEMORY_AVAILABLE)
> +        continue;
> +      from = map[i].addr;
> +      to = from + map[i].len;
> +      if (from < modend)
> +        from = modend;
> +      if (from >= to || from >= 0x100000000ULL)
> +        continue;
> +      if (to > 0x100000000ULL)
> +        to = 0x100000000ULL;

In previous patches you have used 1ULL << 32 which I think I prefer.
Overall I would consider introducing a GB(X) macro, so that you can
use GB(4) in order to make this even clearer.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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