On 27/12/2018 15:56, Roger Pau Monne wrote:
> This function is based on the Linux e820__range_remove function,
> modified to fit Xen coding style.
>
> Signed-off-by: Roger Pau Monné <roger....@citrix.com>
> ---
> ---
>  xen/arch/x86/e820.c        | 56 ++++++++++++++++++++++++++++++++++++++
>  xen/include/asm-x86/e820.h |  2 ++
>  2 files changed, 58 insertions(+)
>
> diff --git a/xen/arch/x86/e820.c b/xen/arch/x86/e820.c
> index 590ea985ef..2b03c56b93 100644
> --- a/xen/arch/x86/e820.c
> +++ b/xen/arch/x86/e820.c
> @@ -599,6 +599,62 @@ int __init e820_add_range(
>      return 1;
>  }
>  
> +uint64_t __init e820_remove_range(struct e820map *e820, uint64_t start,
> +                                  uint64_t end, uint32_t type, bool 
> check_type)
> +{
> +    unsigned int i;
> +    uint64_t real_removed_size = 0;
> +
> +    ASSERT(end > start);
> +
> +    for ( i = 0; i < e820->nr_map; i++ )
> +    {
> +        struct e820entry *entry = &e820->map[i];
> +        uint64_t final_start, final_end, entry_end;
> +
> +        if ( check_type && entry->type != type )
> +            continue;
> +
> +        entry_end = entry->addr + entry->size;
> +
> +        /* Completely covered? */
> +        if ( entry->addr >= start && entry_end <= end )
> +        {
> +            real_removed_size += entry->size;
> +            memset(entry, 0, sizeof(*entry));
> +            continue;
> +        }
> +
> +        /* Is the new range completely covered? */
> +        if (entry->addr < start && entry_end > end) {

One remaining piece of Linux style.  Can be fixed on commit.

Acked-by: Andrew Cooper <andrew.coop...@citrix.com>

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

Reply via email to