T-EMU  2
The Terma Emulator
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Functions
Loader.h File Reference
#include <stdint.h>
Include dependency graph for Loader.h:

Go to the source code of this file.

Functions

int temu_loadImage (void *mem, const char *file)
 Loads a binary image to the memory object. More...
 
int temu_loadRelocatedImage (void *mem, const char *file, uint64_t pa)
 Loads a binary image to the memory object at the given address. More...
 
int temu_loadBinaryImage (void *mem, const char *file, uint64_t pa)
 Loads a raw binary image to the memory object at the given address. More...
 
int temu_loadElfImage (void *mem, const char *file, uint64_t pa)
 
int temu_loadSrecImage (void *mem, const char *file, uint64_t pa)
 

Function Documentation

int temu_loadBinaryImage ( void *  mem,
const char *  file,
uint64_t  pa 
)

Loads a raw binary image to the memory object at the given address.

The function will assume that the file is a raw binary. This way you can load an ELF file as is to memory (e.g. where it is expected by the boot loader).

Parameters
memMemory object, must conform to the mem interface.
filePath to file to load.
paPhysical address where to load the image.
Returns
0 on success, other values indicates errors.
int temu_loadElfImage ( void *  mem,
const char *  file,
uint64_t  pa 
)
int temu_loadImage ( void *  mem,
const char *  file 
)

Loads a binary image to the memory object.

The function will autodetect the file type (based on extensions and magic headers in the file).

Binary images will be placed at address 0.

The image can be one of the supported file formats.

Parameters
memMemory object, must conform to the mem interface.
filePath to file to load.
Returns
0 on success, other values indicates errors.
int temu_loadRelocatedImage ( void *  mem,
const char *  file,
uint64_t  pa 
)

Loads a binary image to the memory object at the given address.

The function will autodetect the file type (based on extensions and magic headers in the file). The binary is loaded to the given physical address (relocated). The relocation semantics is file type specific:

ELF: The content is shifted by pa - start address. I.e. the start address ends up at pa. SREC: The content is loaded to pa - start address. BIN: The content is loaded to pa.

Parameters
memMemory object, must conform to the mem interface.
filePath to file to load.
paThe physical address to where to load the file.
Returns
0 on success, other values indicates errors.
int temu_loadSrecImage ( void *  mem,
const char *  file,
uint64_t  pa 
)