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

Re: [Xen-devel] [PATCH v5 09/16] x86: add multiboot2 protocol support



>>> On 30.08.16 at 16:41, <daniel.kiper@xxxxxxxxxx> wrote:
> On Thu, Aug 25, 2016 at 05:50:04AM -0600, Jan Beulich wrote:
>> >>> On 20.08.16 at 00:43, <daniel.kiper@xxxxxxxxxx> wrote:
>> > +        case MULTIBOOT2_TAG_TYPE_MMAP:
>> > +            if ( get_mb2_data(tag, mmap, entry_size) < sizeof(*mmap_src) )
>> > +                break;
>> > +
>> > +            mbi_out->flags |= MBI_MEMMAP;
>> > +            mbi_out->mmap_length = get_mb2_data(tag, mmap, size);
>> > +            mbi_out->mmap_length -= sizeof(multiboot2_tag_mmap_t);
>> > +            mbi_out->mmap_length /= get_mb2_data(tag, mmap, entry_size);
>> > +            mbi_out->mmap_length *= sizeof(memory_map_t);
>> > +
>> > +            mbi_out->mmap_addr = alloc_mem(mbi_out->mmap_length);
>> > +
>> > +            mmap_src = get_mb2_data(tag, mmap, entries);
>> > +            mmap_dst = (memory_map_t *)mbi_out->mmap_addr;
>> > +
>> > +            for ( i = 0; i < mbi_out->mmap_length / sizeof(memory_map_t); 
>> > i++ )
>> > +            {
>> > +                /* Init size member properly. */
>> > +                mmap_dst[i].size = sizeof(memory_map_t);
>> > +                mmap_dst[i].size -= sizeof(((memory_map_t){0}).size);
>> > +                /* Now copy a given region data. */
>> > +                mmap_src = (void *)mmap_src + i * get_mb2_data(tag, mmap, 
>> > entry_size);
>>
>> Why do you multiply by i here? The way you've written it you want to
>> increment mmap_src by entry_size _at the end_ of each iteration. Or
> 
> This is another option. If you wish I can do that.

This is not just another option - afaict the code as is won't work for
more than one map entry.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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