[SeaBIOS] [PATCH 2/3] Remove fhdr member from cbfs

Vladimir 'φ-coder/phcoder' Serbinenko phcoder at gmail.com
Tue May 19 07:40:29 CEST 2015


On 19.05.2015 04:13, Kevin O'Connor wrote:
> On Mon, May 18, 2015 at 08:06:45PM +0000, Vladimir 'phcoder' Serbinenko wrote:
>> fhdr is used only to boot other payloads but it isn't actually necesarry
>> there. Remove it
> 
>> diff --git a/src/boot.c b/src/boot.c
>> index d6b1fb7..31dfafd 100644
>> --- a/src/boot.c
>> +++ b/src/boot.c
>> @@ -660,7 +660,7 @@ boot_cdrom(struct drive_s *drive_g)
>>  
>>  // Boot from a CBFS payload
>>  static void
>> -boot_cbfs(struct cbfs_file *file)
>> +boot_cbfs(struct cbfs_romfile_s *file)
>>  {
>>      if (!CONFIG_COREBOOT_FLASH)
>>          return;
>> diff --git a/src/fw/coreboot.c b/src/fw/coreboot.c
>> index 6610b3a..7815de4 100644
>> --- a/src/fw/coreboot.c
>> +++ b/src/fw/coreboot.c
>> @@ -334,7 +334,6 @@ struct cbfs_file {
>>  
>>  struct cbfs_romfile_s {
>>      struct romfile_s file;
>> -    struct cbfs_file *fhdr;
>>      void *data;
>>      u32 rawsize, flags;
>>  };
>> @@ -445,7 +444,6 @@ coreboot_cbfs_init(void)
>>          memset(cfile, 0, sizeof(*cfile));
>>          strtcpy(cfile->file.name, fhdr->filename, sizeof(cfile->file.name));
>>          cfile->file.size = cfile->rawsize = be32_to_cpu(fhdr->len);
>> -        cfile->fhdr = fhdr;
>>          cfile->file.copy = cbfs_copyfile;
>>          cfile->data = (void*)fhdr + be32_to_cpu(fhdr->offset);
>>          int len = strlen(cfile->file.name);
>> @@ -484,12 +482,12 @@ struct cbfs_payload {
>>  };
>>  
>>  void
>> -cbfs_run_payload(struct cbfs_file *fhdr)
>> +cbfs_run_payload(struct cbfs_romfile_s *cbfs)
>>  {
> 
> This is not correct.  The 'struct cbfs_file' is allocated with
> malloc_tmp() - the contents of which are not valid once the post phase
> ends.  More details are available at:
> http://seabios.org/Memory_Model
> 
Let's drop this patch for now then.
> -Kevin
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 213 bytes
Desc: OpenPGP digital signature
URL: <http://www.seabios.org/pipermail/seabios/attachments/20150519/6f4c2992/attachment.asc>


More information about the SeaBIOS mailing list