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

Re: [Xen-devel] [PATCH v3 08/16] hvmloader: Locate the BIOS blob



On Mon, Feb 29, 2016 at 09:56:48AM -0700, Jan Beulich wrote:
> >>> On 25.02.16 at 15:56, <anthony.perard@xxxxxxxxxx> wrote:
> > --- a/tools/firmware/hvmloader/hvmloader.c
> > +++ b/tools/firmware/hvmloader/hvmloader.c
> > @@ -254,10 +254,32 @@ static void acpi_enable_sci(void)
> >      BUG_ON(!(pm1a_cnt_val & ACPI_PM1C_SCI_EN));
> >  }
> >  
> > +const struct hvm_modlist_entry *get_module_entry(
> > +    const struct hvm_start_info *info,
> > +    const char *name)
> > +{
> > +    const struct hvm_modlist_entry *modlist =
> > +        (struct hvm_modlist_entry *)info->modlist_paddr;
> > +    int i;
> 
> unsigned int

ok

> > +    for ( i = 0; i < info->nr_modules; i++ )
> > +    {
> > +        uint32_t module_name = modlist[i].cmdline_paddr;
> 
> The right side is uint64_t, so you may be truncating here.

Yes, I need to check that.

> Also blank line between declaration(s) and statement(s) please.

ok.

> > @@ -293,8 +315,16 @@ int main(void)
> >      }
> >  
> >      printf("Loading %s ...\n", bios->name);
> > -    if ( bios->bios_load )
> > -        bios->bios_load(bios);
> > +    bios_module = get_module_entry(hvm_start_info, "bios");
> > +    if ( bios_module && bios->bios_load )
> > +    {
> > +        uint32_t paddr = bios_module->paddr;
> > +        bios->bios_load(bios, (void*)paddr, bios_module->size);
> 
> bios_module->size is a 64-bit quantity too, so would also need
> checking.

Yes.

> > +    }
> > +    else if ( bios->bios_load )
> > +    {
> > +        bios->bios_load(bios, 0, 0);
> > +    }
> >      else
> >      {
> >          BUG_ON(bios->bios_address + bios->image_size >
> 
> Is all of the remaining code (from the first "else if" above) intended
> to go away eventually?

The "else if" would be kept for the benefit of rombios (if it's compiled
in), and the last "else" will be turned into a BUG.

-- 
Anthony PERARD

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

 


Rackspace

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