[SeaBIOS] [PATCH v2 1/5] linker: utility to patch in-memory ROM files

Michael S. Tsirkin mst at redhat.com
Sun Sep 22 15:44:37 CEST 2013


On Sun, Sep 22, 2013 at 02:18:45PM +0300, Michael S. Tsirkin wrote:
> On Sun, Sep 22, 2013 at 01:49:58PM +0300, Michael S. Tsirkin wrote:
> > On Thu, Jul 25, 2013 at 08:06:27PM -0400, Kevin O'Connor wrote:
> > > On Thu, Jul 25, 2013 at 03:55:56PM +0300, Michael S. Tsirkin wrote:
> > > > On Mon, Jul 15, 2013 at 11:01:02AM +0300, Michael S. Tsirkin wrote:
> > > > > On Sun, Jul 14, 2013 at 02:24:52PM -0400, Kevin O'Connor wrote:
> > > > > > I'd prefer to see this tracked within the "linker" code and not in the
> > > > > > generic romfile struct.
> > > > > 
> > > > > A way to associate a romfile instance with a value seems generally
> > > > > useful, no?  Still, that's not too hard - it would only mean an extra
> > > > > linked list of 
> > > > > 
> > > > > struct linker {
> > > > > 	char name[56]
> > > > > 	void *data;
> > > > > 	struct hlist_node node;
> > > > > }
> > > > > 
> > > > > is this preferable?
> > > 
> > > Sure, but it's probably easier to do something like:
> > > 
> > > struct linkfiles { char *name; void *data; };
> > > 
> > > void linker_loader_execute(const char *name)
> > > {
> > >     int size;
> > >     struct linker_loader_entry_s *entries = romfile_loadfile(name, &size);
> > >     int numentries = size/sizeof(entries[0]);
> > >     if (! entries)
> > >         return;
> > >     struct linkfiles *files = malloc_tmp(sizeof(files[0]) * numentries);
> > > 
> > > and then just populate and use the array of filenames.
> > 
> > OK I'll do this but it's more code as I can't use plain romfile_find
> > anymore, and have to code up my own lookup.
> > 
> > > > > > Also, is there another name besides "linker" that could be used?
> > > > > > SeaBIOS has code to self-relocate and fixup code relocations.  I think
> > > > > > having code in the repo called "linker" could cause confusion.
> > > > > > 
> > > > > 
> > > > > romfile_loader?
> > > 
> > > Shrug.  How about "tabledeploy"?
> > > 
> > > -Kevin
> 
> 
> So I tried this out


Latest version that I posted uses the approach suggested by Kevin here.
It adds about 200 bytes to code size.
If we want to cut that out and go back to data pointer,
we can do this as a patch on top.

Pls let me know.

-- 
MST




More information about the SeaBIOS mailing list