wiki:Component/Loader

Loader

Loader is an utility used to load binary files into platforms. It holds information about one or more files, and may load any loadable section by its address and size.

Usage

  • Loader( const std::string &filename, ... )

Creates a new Loader, capable of loading all the filenames passed.

  • void load( void *buffer, uintptr_t address, size_t length )

buffer must be at least length bytes long.

Loads in buffer any segment overlapping memory region between address to address+length. Used addresses are LMAs (loading memory address) of sections.

If a section is too big to fit in the given buffer, it is truncated and a warning is generated to stderr.

Handlers

Loader does not directly handle different file types. It relies on handlers to support all needed file types. Your platform must link against needed file loader handler to work properly.

For instance, to support ELF files, you need to add the following line to your platform_desc:

  Uses('common:elf_file_loader'),

Handlers are tried in order, and if all fails, error is raised.

Current existing handlers are:

Last modified 13 years ago Last modified on Mar 25, 2009, 9:37:04 AM