A class used to load binary files into emulated memory. More...
#include <FileLoader.h>
Public Member Functions | |
| FileLoader (const string &filename) | |
| Constructs a FileLoader object. More... | |
| const string & | GetFilename () const |
| Retrieves the filename of this FileLoader. More... | |
| string | DetectFileFormat (refcount_ptr< const FileLoaderImpl > &loader) const |
| Attempt to detect the file format of the file. More... | |
| bool | Load (refcount_ptr< Component > component, ostream &messages) const |
| Loads the file into a CPU or an AddressDataBus. More... | |
Static Public Member Functions | |
| static void | RunUnitTests (int &nSucceeded, int &nFailures) |
Static Public Member Functions inherited from UnitTestable | |
| static void | RunUnitTests (int &nSucceeded, int &nFailures) |
| Runs unit test cases. More... | |
A class used to load binary files into emulated memory.
A FileLoader is given a name of a binary file, e.g. an ELF file, and attempts to load it into emulated memory.
Binary files may be loaded to either physical or virtual memory addresses. To load to a physical address, we want to write to a component which is an AddressDataBus directly. To load to virtual addresses, we need to go via a particular CPU, because it is the CPU which does the virtual to physical address translation.
The type of the file is normally auto-detected by reading magic sequences at the start of the file.
Definition at line 53 of file FileLoader.h.
| FileLoader::FileLoader | ( | const string & | filename | ) |
Constructs a FileLoader object.
| filename | The name of the file to open. |
Definition at line 43 of file FileLoader.cc.
References FileLoader().
Referenced by FileLoader().
| string FileLoader::DetectFileFormat | ( | refcount_ptr< const FileLoaderImpl > & | loader | ) | const |
Attempt to detect the file format of the file.
| loader | On return from the function, if the file format has been detected, this is set to a pointer to a FileLoaderImpl. Otherwise (if no format was detected), it is NULL. |
Definition at line 59 of file FileLoader.cc.
Referenced by Load().
| const string & FileLoader::GetFilename | ( | ) | const |
Retrieves the filename of this FileLoader.
Definition at line 53 of file FileLoader.cc.
| bool FileLoader::Load | ( | refcount_ptr< Component > | component, |
| ostream & | messages | ||
| ) | const |
Loads the file into a CPU or an AddressDataBus.
Note: The file is usually loaded into a virtual address space. It is therefore necessary to load it into a CPU, and not directly into RAM.
| component | A CPUComponent (or any other component which implements the AddressDataBus interface), into which the file will be loaded. |
| messages | An output stream where debug messages can be put. |
Definition at line 97 of file FileLoader.cc.
References Component::AsAddressDataBus(), DetectFileFormat(), Component::GenerateShortestPossiblePath(), refcount_ptr< T >::IsNULL(), and FileLoaderImpl::LoadIntoComponent().
|
static |
1.8.17